From patchwork Mon Dec 16 08:10:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13909354 Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5BAD71FF7A2; Mon, 16 Dec 2024 08:10:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734336652; cv=none; b=r9AsUc6niTokiu0sJeJ7HQh2YadRmRYbEVt1lDxclcrCZOWPLLl041cMp/3kdqqf9rqXjyLZ5Wr62eMLvBS7gFtfKeEqSZGXLp8NRVu/tl4+RBnBDIrCuPw6oXMwXRDEOKMadLJVtCApYjakP/lAVJKhlQ77URNM2IUNBv2El3g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734336652; c=relaxed/simple; bh=rklkBZpycmpnbNdy0x0UtScNM9eIxtzUDg5s1Uh/ToU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G+1J7Bs0NwPSJkTlZJnq8zWPNtnbZniUQBKM2We24r7eV9v+mM4HsbMe95/dNsvoIPKM8H2maX3CHq+R30/x/6tj+y3KBM4zB10ibfDT2jDY/hTM3RR0OKXDNrabX1TEJoW335EaBQAkpKb+0O2RsxzWY6mqszcKj9NWF4eDSIM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-5d3d479b1e6so4878914a12.2; Mon, 16 Dec 2024 00:10:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734336649; x=1734941449; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zHZ6DN0fprXEFrfULeL6o6cv5cJ/mLMEVblPKgAwH20=; b=w7BqVIiHO2b60C5SABWGo1joYf5gQxHfbqoWLBcTtNFuoWU9FtEJ73YfC7sXuzLtzv bCiUZSqUIuPmT5oQQq6S0Y3XUp0n5ITiLWsptHi3QnC2S3HYn/P9Wm3nuwHm3g9Q7upA ODiolbTFPgmxVZB92XboK1SUM5TeYmdSr1bEACrqEAc9Z6UzncZnQU9npQZuwmpF3A// HV0AVBvb6xqpc2+VsqWOkG7oVrTOfhilVpE8TDs8lRJiEJdYrlg0eZ5zrmhFQ7uMUnAV Bo0t29H3qx6EipN/NoPtpNVEblNNRPI30UGpxRWfFDiSfy6vYUaJAKo+K68JuI/oVEvq qRYA== X-Forwarded-Encrypted: i=1; AJvYcCWEvnpcf99n05bLk7ZWQVEewzNw1Ggi174bE2IsHgZuTV5dOqHyGdHKvpXdZZG79ykqHnyUgGJuX4ulvL4=@vger.kernel.org X-Gm-Message-State: AOJu0Yz63PycvLBI04rD2yw9QOlgogXzm4uLIUhElmPYKdYTIhKupOmq kBhoNegjb7zER/C4zttr+N9kxk31tntHtELq3WwZ2QBstZTQVpnX X-Gm-Gg: ASbGnctbpTf3Mj71BJheJz+a7JruHbtRmaUKq9iQdF/z1WT4PvhHxVu9yqIxese7GZ+ DV46QQmJJFCUTPr6bg2zL5Q7IUMDKaOwQIUek+3fIc+WkkTbLY5WKxItEjeqldMCNaVJuFEylc6 gdWmhWgctEfZ87ehZZw+3UxS7OM81oUwqdA1paTizKSL7Yw5Y/CawtKqnWCMC7xeY9UFjgat6hg bTj+UyidNhKdvowZTo4eurE0PDvgW/i+uHwwS6Mde529atpbXLj6Uc3ji9PBfAWJD9XCAxTBuiW BA7ZruVWAsKRCWgJJtn9//q3U6+D+oCbbDKd X-Google-Smtp-Source: AGHT+IHDGowW9Oabh48yxmGwzjHGNLKdKpWrlHkOSDKCUVjCCQ1sRxzdeNkBJkbOvvRRpg7Mmrl+2g== X-Received: by 2002:a05:6402:5415:b0:5d0:bf5e:eb8 with SMTP id 4fb4d7f45d1cf-5d63c3dbc28mr26330019a12.23.1734336648483; Mon, 16 Dec 2024 00:10:48 -0800 (PST) Received: from [127.0.0.1] (p200300f6f7081700fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f708:1700:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab9635a000sm299013566b.113.2024.12.16.00.10.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 00:10:48 -0800 (PST) From: Johannes Thumshirn Date: Mon, 16 Dec 2024 09:10:39 +0100 Subject: [PATCH v2 1/3] btrfs: cache stripe tree usage in io_geometry Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-1-42b6d0274da7@kernel.org> References: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-0-42b6d0274da7@kernel.org> In-Reply-To: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-0-42b6d0274da7@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Filipe Manana , Johannes Thumshirn , Johannes Thumshirn X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1584; i=jth@kernel.org; h=from:subject:message-id; bh=/5D5piZXC5jz6vomUPd9zh50bn2AXLREKO3R42gB1yA=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaTHP2jLvHqiLq4yeMIzy8POfIfqC6uumM2dP3u6WQjPT /9J7ex7OkpZGMS4GGTFFFmOh9rulzA9wj7l0GszmDmsTCBDGLg4BWAima8Y/hmyvop5vqp7Vee1 TLHamSm3PLz8qpPTfPY+VCwoCba6XM3IsH7DY46iEyIXJXPM27YKL9FsiXib31HIfc7YJmp69gl nVgA= X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Cache the return of btrfs_need_stripe_tree_update() in struct btrfs_io_geometry. Signed-off-by: Johannes Thumshirn Reviewed-by: Filipe Manana --- fs/btrfs/volumes.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1cccaf9c2b0d5d4029440c46a4a92c7d6541d474..fa190f7108545eacf82ef2b5f1f3838d56ca683e 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -48,6 +48,7 @@ struct btrfs_io_geometry { u64 raid56_full_stripe_start; int max_errors; enum btrfs_map_op op; + bool use_rst; }; const struct btrfs_raid_attr btrfs_raid_array[BTRFS_NR_RAID_TYPES] = { @@ -6346,8 +6347,7 @@ static int set_io_stripe(struct btrfs_fs_info *fs_info, u64 logical, { dst->dev = map->stripes[io_geom->stripe_index].dev; - if (io_geom->op == BTRFS_MAP_READ && - btrfs_need_stripe_tree_update(fs_info, map->type)) + if (io_geom->op == BTRFS_MAP_READ && io_geom->use_rst) return btrfs_get_raid_extent_offset(fs_info, logical, length, map->type, io_geom->stripe_index, dst); @@ -6579,6 +6579,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, io_geom.raid56_full_stripe_start = (u64)-1; max_len = btrfs_max_io_len(map, map_offset, &io_geom); *length = min_t(u64, map->chunk_len - map_offset, max_len); + io_geom.use_rst = btrfs_need_stripe_tree_update(fs_info, map->type); if (dev_replace->replace_task != current) down_read(&dev_replace->rwsem); From patchwork Mon Dec 16 08:10:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13909355 Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AD111FF7BE; Mon, 16 Dec 2024 08:10:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734336653; cv=none; b=R3HdCNgRuXyEiGO09N0sbob/HQ4KmVnumibGIkPivrYRnUBv/d7SgDOORvVs5Dblh+HUHXxSxWTLDmWxO7mseZjRYPQ/HQ9yeK9uu3LbtsV5eL/weSzQ+wa9wWXWh3C/UinOCf2Z5ygIfnuxU2IZfrtguzWuQJRIdNtUm1Dmh3E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734336653; c=relaxed/simple; bh=hQhGyaMBEowC2R1tTMNuKMGO/V5a1g4mixVuy4H5gjA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ClOQA5N2I0qNJocGmZoFr2KrK1I+i+UVhX0yu//u5FkygBqBXfHTlrKGSrd2STGpdYmvrLacnm3TU7aQ2t2Hcg/DSYUErspEmv6D/Fviiuq65y+ujmL5BSw0pyolZRfOj3I7Y2GNBoTiZeNxhEI+kIx5/Q4f7BedUtydJ5tXBIQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f45.google.com with SMTP id a640c23a62f3a-aa66e4d1d5aso617883766b.2; Mon, 16 Dec 2024 00:10:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734336650; x=1734941450; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ubOWkPBCqZViUNDRxYFuVw+FV+8QDXQo5XOc7MPemnk=; b=H1CaiLeaPzON5zS4R7A+e5142k0p0e4zgEiu1iN1f/fYT2PM32S7buHmkU74lhCX78 6zr4ujHuqt9zP/HdLF/Y7/0T7dmaFljxUZPcH329JgQMyJamKCMjZfhKE4/pnqEiY8NA LdJ0vSeZ2xsYV+tlpM81LeFj2u+FmNeX3P/iTPKY1FfDbOB789lF9XJSHloxMNPLyysk 7oBVUXi0SQih1xPFcDcKU988eLC6bjIX2UijRlr9cjddR2FEdrJJBnhXOoCjJdJAZYbz +NV+F5gHiQelS+gKU5KDD1YhTPgJn2ZGZfo6UvaxlJqwFDdwLLbT3AJShCcnFrWMiu96 KFow== X-Forwarded-Encrypted: i=1; AJvYcCXAetLSjg6aIQH6AMWI5DbVxv/FzMN8xymIlKYaOkLLmn1XPO+5mEcqfIeLTd/42/cHRwmoryCPbdeIKsU=@vger.kernel.org X-Gm-Message-State: AOJu0YyN1yeuj99hOijuads6D3Lr4kSGwPdJsaaP5r9iga6wBZsD2iwd VWEJ9ji+ZEhbGuS5aebNgly2PEG+HAtdioqmoBgrkJS1QPHQTEAU X-Gm-Gg: ASbGncsZITWNQ09urP0k4+yfJx/lv42+ZPOF5WDhPKkw1OMlEvM70aeIBpp+OUN2h5C A60IRGliCdPzSxpqX7v3rxSB8pzgBhZYYbEtkH9Sb8Gjd0c7TzTlVl1wUY0zNWTr0L2UQHxR6GS /W2+SOdPlyYyv/Z9V3Hw5bwzmla6oI5D4Tz1nBKja1FvMfCggq5zs2qIBxqR7EoxaP0EQksQQYd 7/SpQQrLPdqEfaxh51+0y1KJM0NoYWa9NoNyVlmmQjluakY9O25nCO85JmlFxAPBLeLSikBdhzy yF2g+/trX4Oafn9zj3EQEqQ8dOeCV/OP5p+3 X-Google-Smtp-Source: AGHT+IHwUA1aq6YnB9jAt/lmxLCtcX0i1EG0DXOUPCbEF68poPJbkaZDDM69m1sshq4hhS069Y8ZTg== X-Received: by 2002:a17:906:6a04:b0:aa6:af4b:7c90 with SMTP id a640c23a62f3a-aab77ebf83dmr1162709166b.58.1734336649558; Mon, 16 Dec 2024 00:10:49 -0800 (PST) Received: from [127.0.0.1] (p200300f6f7081700fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f708:1700:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab9635a000sm299013566b.113.2024.12.16.00.10.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 00:10:49 -0800 (PST) From: Johannes Thumshirn Date: Mon, 16 Dec 2024 09:10:40 +0100 Subject: [PATCH v2 2/3] btrfs: cache RAID stripe tree decision in btrfs_io_context Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-2-42b6d0274da7@kernel.org> References: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-0-42b6d0274da7@kernel.org> In-Reply-To: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-0-42b6d0274da7@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Filipe Manana , Johannes Thumshirn , Johannes Thumshirn X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1775; i=jth@kernel.org; h=from:subject:message-id; bh=Fxo2E0W6vytL2KFqXYlgw7HuAk1pRB3J9eQSpw8UY68=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaTHP2hbzyXocOyJrPP3Fw5/xWzWeU7ZXt54POBqXVx62 uHN8c5nOkpZGMS4GGTFFFmOh9rulzA9wj7l0GszmDmsTCBDGLg4BWAiJ40ZfrPof5JrWO/tdEYl icd65QNt+8hvDGfDFEwFilr1uzN36TD8FZBvbimdH3+U5wLX1VdXd3acTWjO/JZzcLPpo5z3vay SfAA= X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Cache the decision if a particular I/O needs to update RAID stripe tree entries in struct btrfs_io_context. Signed-off-by: Johannes Thumshirn Reviewed-by: Filipe Manana --- fs/btrfs/bio.c | 3 +-- fs/btrfs/volumes.c | 1 + fs/btrfs/volumes.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 7ea6f0b43b95072b380172dc16e3c0de208a952b..bc80ee4f95a5a8de05f2664f68ac4fcb62864d7b 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -725,8 +725,7 @@ static bool btrfs_submit_chunk(struct btrfs_bio *bbio, int mirror_num) bio->bi_opf |= REQ_OP_ZONE_APPEND; } - if (is_data_bbio(bbio) && bioc && - btrfs_need_stripe_tree_update(bioc->fs_info, bioc->map_type)) { + if (is_data_bbio(bbio) && bioc && bioc->use_rst) { /* * No locking for the list update, as we only add to * the list in the I/O submission path, and list diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index fa190f7108545eacf82ef2b5f1f3838d56ca683e..088ba0499e184c93a402a3f92167cccfa33eec58 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6663,6 +6663,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, goto out; } bioc->map_type = map->type; + bioc->use_rst = io_geom.use_rst; /* * For RAID56 full map, we need to make sure the stripes[] follows the diff --git a/fs/btrfs/volumes.h b/fs/btrfs/volumes.h index 3a416b1bc24cb0735c783de90fb7490d795d7d96..10bdd731e3fcc889237b4e1b05cc9389bc937659 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -485,6 +485,7 @@ struct btrfs_io_context { struct bio *orig_bio; atomic_t error; u16 max_errors; + bool use_rst; u64 logical; u64 size; From patchwork Mon Dec 16 08:10:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13909356 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEBFB1FFC61; Mon, 16 Dec 2024 08:10:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734336654; cv=none; b=M2x9jj3OkFsl8uc//PR9NGhBQF2e5vBLderuTLV5wEbcOBR5lkHIJRRh1+OF+7jmDnu9zkIZp5dp/7jwLnRvzgqVNdxVoaw2kF6tOpU3tZVb1F61jvn14m/yHOQ6P5UpV9d+L1ig6EPH0fS0b1roq9Bo2JzohCmR8xUwATQrehM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734336654; c=relaxed/simple; bh=4c603uTNAwr5v/6+xrBGBpFPfCttRch2pLDlAFH0K80=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=i0zDNnwTZIo7IRQ0xsH6EySIM+UQ23O0QfEmMInYQVOZzCqmf4JDkN1/C/Ac5VCmvEUnaSAO3v5lXZBur3lpqRFa75jtw/pZ9VXMywTHzSTCNNhgAznehcSpwwFhTefkx3OMG9VKGTmNsmRWUXKuw4/Nuxd+FxeaZ/MZuqaCpeQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5d3f28a4fccso5703577a12.2; Mon, 16 Dec 2024 00:10:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734336651; x=1734941451; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yHc4YCLZspdqL2zoQEWiAY4cxdZYclIx9AhPDOUD8/4=; b=clWZ/o9VQYRhEtKlpV7DOzBYzke3JJ/Kplbii880/sRyqOyANBEQ6rtPy6fRfFaPrX v/6vtgi5MO8HdmHjIArWOBAn62Q1M0sR7K/HfGByfNYlo/rfaJaf2ME2PcDD4CPQ2OSw jZklzMnw043BxpZrT6iQQiWE+UD8nS73UvEB0x3/9dcs+dFkSOA4h1Q9/OryzWLt2P2+ oFH7jO5vmQWsnHS9+xQIloZrO0xwREdxn+Z5bdqcGdxNw2M5U2UkVCkBwG3G7Hi8Zovg bQR0UUXEldiI+mOI++bRkSsVTZoFFuzsZwFOQRu8muVXbETbLcbwkZ+hp36aAM1L2jfc xdmQ== X-Forwarded-Encrypted: i=1; AJvYcCU7U3BG2lmSDfnbHUaZMgfweE3xs4d22l+dLYAA/WisnV6oqpMm92Ezw9TVCap+rP5aQ5Cv6MsWDDPamUs=@vger.kernel.org X-Gm-Message-State: AOJu0YwY1DDwKtTkQG9cxDv5BPEqBmOi0lcR4mUC+pzTiJmh5O1RomkL 4YOATYn+UezRkBlOt19qtNbMxLnge8mhoRevzhnoHNkLPI9oFPRP X-Gm-Gg: ASbGncuMAq9a50UHMWPhwo8JKkS2UBVPsyxm9zQr/n7bo2N71VVYPcLsq2/vH7I1OaT T1AD8gMFsqZamajYFtMo4RcKT7izudmyRU+O8ngjQga+09Q7g8EF01m4awEplByF2YVhMGQW4UD CoF78EaCE+ah4TPg0J+MrMfYvGXGQlR+LpTBJdYzxVcAYQGJjlKL4vWABaVhpund3FW1QiDQniL QfecINEJIbwUi/25KpoJjUuoDBdPt+1DD3doXlyondx5zOQbCYUzBJV1zc5LUjBN2NnT5p40kFa DVnSYdvss0e/qemTof58dGFDvlo33lLj0XdO X-Google-Smtp-Source: AGHT+IH9ldVas3acJmpAU7kzyJpGULMIkUBNF2yWJBn3mtkPRFOAgJf8fV2cPREvin017sdfkF+H4A== X-Received: by 2002:a17:906:31d4:b0:aa6:9624:78f7 with SMTP id a640c23a62f3a-aab77909c84mr1108965866b.17.1734336650580; Mon, 16 Dec 2024 00:10:50 -0800 (PST) Received: from [127.0.0.1] (p200300f6f7081700fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f708:1700:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aab9635a000sm299013566b.113.2024.12.16.00.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 00:10:50 -0800 (PST) From: Johannes Thumshirn Date: Mon, 16 Dec 2024 09:10:41 +0100 Subject: [PATCH v2 3/3] btrfs: pass btrfs_io_geometry to is_single_device_io Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-3-42b6d0274da7@kernel.org> References: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-0-42b6d0274da7@kernel.org> In-Reply-To: <20241216-btrfs_need_stripe_tree_update-cleanups-v2-0-42b6d0274da7@kernel.org> To: Chris Mason , Josef Bacik , David Sterba Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Filipe Manana , Johannes Thumshirn , Johannes Thumshirn X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1892; i=jth@kernel.org; h=from:subject:message-id; bh=hofpE60IAMuznsG9YF0VqcKYrjrHH5YeItqCqOIioPc=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaTHP2jzmHNuTnujks6x0AuKuYuczAUKT7+//GXjzuf/D VbVnF71t6OUhUGMi0FWTJHleKjtfgnTI+xTDr02g5nDygQyhIGLUwAmYtHN8N/nqcW2V3IBx+Kz egIePV71I3/BMSWu9BOyyrXdwWfiXnIyMkw6u+qWxuYpW/3XKKfHrW2VTPIuyTVLfpSancv349y 913wA X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Now that we have the stripe tree decision saved in struct btrfs_io_geometry we can pass it into is_single_device_io() and get rid of another call to btrfs_need_raid_stripe_tree_update(). Signed-off-by: Johannes Thumshirn Reviewed-by: Filipe Manana --- fs/btrfs/volumes.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 088ba0499e184c93a402a3f92167cccfa33eec58..fcd80ba9dd4286305ebeea58adc5950a532cc06c 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -6362,7 +6362,7 @@ static bool is_single_device_io(struct btrfs_fs_info *fs_info, const struct btrfs_io_stripe *smap, const struct btrfs_chunk_map *map, int num_alloc_stripes, - enum btrfs_map_op op, int mirror_num) + struct btrfs_io_geometry *io_geom) { if (!smap) return false; @@ -6370,10 +6370,10 @@ static bool is_single_device_io(struct btrfs_fs_info *fs_info, if (num_alloc_stripes != 1) return false; - if (btrfs_need_stripe_tree_update(fs_info, map->type) && op != BTRFS_MAP_READ) + if (io_geom->use_rst && io_geom->op != BTRFS_MAP_READ) return false; - if ((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && mirror_num > 1) + if ((map->type & BTRFS_BLOCK_GROUP_RAID56_MASK) && io_geom->mirror_num > 1) return false; return true; @@ -6648,8 +6648,7 @@ int btrfs_map_block(struct btrfs_fs_info *fs_info, enum btrfs_map_op op, * physical block information on the stack instead of allocating an * I/O context structure. */ - if (is_single_device_io(fs_info, smap, map, num_alloc_stripes, op, - io_geom.mirror_num)) { + if (is_single_device_io(fs_info, smap, map, num_alloc_stripes, &io_geom)) { ret = set_io_stripe(fs_info, logical, length, smap, map, &io_geom); if (mirror_num_ret) *mirror_num_ret = io_geom.mirror_num;