From patchwork Thu Dec 12 12:54:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13905165 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 E8EDE214236; Thu, 12 Dec 2024 12:54:51 +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=1734008093; cv=none; b=IYZlujOs+j15A+BGTik6aENJ50kGrygtSCoVlLCyKDxQIUH07ZtF6kzAyiG6au9M1TSRm/dZNPj6XjaYgw+0Jp8NsYC+m2K+FZrbyYBxNXC/4kfJ/f3e9YjnKIhRD3Fg1pdFXIfURVcZaw4R8Ed/cdCfPZYSpx9FCs4aGNwbTRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734008093; c=relaxed/simple; bh=ehiwohuVozwTI+2huPsJ4SX1bw2G3Og2BiDEY0kWHlw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=oUA471hpS3FYJ2BPcFPx6GF3Ps/3XyClomg9k44yPZzNCqAZ1cYsJZRcc3UT93vK5Idq8uoNQTIs4rwA682m6su0pdYorOIxuHLC17elZL9sxZI+Ko6qo6qx1hAiAHesyQjIXLTwtgIIR1Xqkjd8qD1X2Aa3zWvPlLmO+W48DsU= 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-5d3f28a4fccso823546a12.2; Thu, 12 Dec 2024 04:54:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734008090; x=1734612890; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HcJcEN7t283VckUD+iHCuwkxl5YnOdBeEa9iNyBsUSI=; b=rVQgmGkSIChPczEm2g+0GIINP9815x8TIXBaWCQi45lEja8XMnkdvwqDqbgEhs7N0u HDpYg7WItb+oOH5jclmjC3Qc1c9JG8/sXmvP7i7Wl6U9nsQalFwZvoUwCTkEK7U7VLWF Gp/xrxVG7sR+fXt5oO5BtF/8FgmFO0wr7AG97+AGjShWeBcxsczucCwROztHw8xkpCvA opAxWDNEjdc+1yuGF/G0iymr03ol6jib9N4dgD8d1ojOQeZwTa/TNBz8IjYBrLXtLtRo XCzO/kMBHk2ay49NrZyiSMrvk7rDFJq3yKYyIOg7YI+Qtm5JXGFDJnKBH3gmhryjM9AP 9x1Q== X-Forwarded-Encrypted: i=1; AJvYcCV/Pb2W6v5wq1IWD7+E8QPxdx7saWPzu/dXrdcBaB9/nExB9Xa5nHL2Fi88xTuBUFwFs5R3oRaRbttLEQJ8@vger.kernel.org, AJvYcCWh1/WEZ0/eL8RuqvXzlaQujjYq9SZDUYr6lTr0q3HzfJva8kV3ueKmnzSjvT+zLe0wP9bytX8bfYE54g==@vger.kernel.org X-Gm-Message-State: AOJu0YxYVTrdxti8oGZCuW7QxBbSukQn9nfcXzjHOZqaWuilGz3NOlzx AfoR0wNZEe6yqpczihKy3wA6HDmgtoxPvOiRJewiFWzWwnN6jkyc X-Gm-Gg: ASbGncs0jlhs7pN/ZcFOtqV9+/V+/Ayg6IgljWHceJyMqWQljyk1N/ckeqyUghMFnJl nYwZ9zooZzWyREIOJRkOiVtR1E/ntJdbl4NlonXhn2sXjohl2FrMQJ8hbowhQRrjLjGZ6qkA6xQ 2cytJfA4GGeaWlFsi2Mjn0CQzEWoNP23K3Qz/XVrmhZnUt5fyCBCSKP8s9mb2eOGvHpKCv1/4s5 lUBU2jHVW6QfddZHF2Ml/HTYCPhsx8VlQhGk/7VtolXvSmxbaNX1BGo9MWtJUVmoz+p5uX7I5Fz jBtyvzo3AKsQ/Pz5E4hOuuw9Az3PvmvlRavcUjg= X-Google-Smtp-Source: AGHT+IGSjNa9QUN1494FSKSv5mCuYUwFKonxrdaSNxMKHuVR1Ha7kz21TA2TOicxprW3fDcL5eOZSQ== X-Received: by 2002:a05:6402:35ce:b0:5d0:b9c7:479a with SMTP id 4fb4d7f45d1cf-5d6337dffc9mr153108a12.25.1734008089993; Thu, 12 Dec 2024 04:54:49 -0800 (PST) Received: from nuc.fritz.box (p200300f6f7081700fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f708:1700:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d14c74c3d5sm10309638a12.52.2024.12.12.04.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 04:54:49 -0800 (PST) From: Johannes Thumshirn To: Chris Mason , Josef Bacik , David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn , Johannes Thumshirn Subject: [PATCH 1/3] btrfs: cache stripe tree usage in io_geometry Date: Thu, 12 Dec 2024 13:54:26 +0100 Message-ID: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-1-d842b6d8d02b@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-0-d842b6d8d02b@kernel.org> References: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-0-d842b6d8d02b@kernel.org> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1536; i=jth@kernel.org; h=from:subject:message-id; bh=DISFLb+CmKpum56sSEBO4U3wTr62J5bLTzQsVr4YvlQ=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaRH3XnePaF1Vujy476Hl/zTPzBbZdcGb6PJfx8IrZjPn zuz8kQPU0cpC4MYF4OsmCLL8VDb/RKmR9inHHptBjOHlQlkCAMXpwBMZFkPI0OXpkb070/VVoz8 IhvvTvky++yVj5eiP0Qw3k+bd+zKOa8CRoZ9a4IrmNmNs5x/W/luOm2tIBnhN/vfky3HzS6tdry aoM8HAA== 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 --- 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 Thu Dec 12 12:54:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13905166 Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (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 CB08B1714D7; Thu, 12 Dec 2024 12:54:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734008094; cv=none; b=lO/88AnsdHf3zYqdt1bb+9JM20WElmZuzvppRLxS8YKUUDYB/2eMkRYUQdqjOzv9SoLEIUGlCe1pQ3mtygENbqu+1u4FKtec34Ms8DNTztZFYjUhpZA+BFM0jpFqNwuYY7i5tr9hmLqLzCfOfxcFIVZg0l4B9mWgRzrknYt6eu0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734008094; c=relaxed/simple; bh=fYru4kQCo1LnZUgA+Z/Qi8fmBO0/O0GnNlXRuFhad+o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Mv+EnPqp2jIB6AHgBvJJ5nLzTJnnODHABaGgf6xOoCaE3lQCGN0X8QHTiXbZr4rRPJnTxsKLT1YlV1LwgKeHZmkDrnntNxDkMc9cGs4Ib80xlknPP6BdBsZz+dhP9hHSPAyUv97uArFR7QbtaaEjOFaPCLQzwJKp6FpFRvDT0iE= 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.51 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-f51.google.com with SMTP id 4fb4d7f45d1cf-5d4e2aa7ea9so1043012a12.2; Thu, 12 Dec 2024 04:54:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734008091; x=1734612891; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b2eGl5AD9w7fNTmt8bsmGpbrk4SqbqqcrbLsYkMD9Sc=; b=HMbELSy5MHZ1CC2HHnjAbso1Tf1mxK8/OZnEQ4V9nQMJlffvRNdwhwHEd4qam+g4a8 J2MHY4ewRuT+4BX5VD7aPvEJod+52Dxi72eaUCCnuTEn8cHc8pXlYowwRqEu7ymSo8m8 NcFRW1c/RU5gPPEgqK2IZ4C4x3IDq7yXD5WTvkBcxILI41JLEIKlXmM/4OmXO3A+izuo 3GUhxUqeGN72GmCqjeyqca+Vu0MB7Qu9KUYDQ3iUvsXJFZx/IZAHsDxTc+y7MW33NL37 RX2EW3Hq17yyLNB8vk/TtOSj9gWwTr7tAq6P3imlIF2csBCatWA16FGPtSY9/6vRZh4f sJjQ== X-Forwarded-Encrypted: i=1; AJvYcCVXslDb0Ff8m8Lh1N/aNKLNzwTluoQrnlZgk2NXoreeCI4+VjQm4pr0//LL4tl7ZfgyLiEdOhl2BnCjYA==@vger.kernel.org, AJvYcCWdiGUpvL/EnKqqIJDJXXxQiQxyKVb8xGYXR1Z60ieeI0xQ6OlrM+sSGUZXhZfciOIgAfOuqaGMt6roNaf/@vger.kernel.org X-Gm-Message-State: AOJu0Yx7h8TJFgeQ8BQZBJ3a8PJ89GzWxjWaCYWP+UawCPt4FKiNBgPJ U2GjOZL/tiXajxnacYmBHdZ/Suge1S5fTkj3FpTF+k9TUOmFT5Us X-Gm-Gg: ASbGnctrRPzsfj9SnoJUefVljMvJpm68GdRLsKdZOK5nu9FUtlPMHB57XHb85QJ1Gxa Uur03FZgZuPqQX+eLSAnAxGV2oL3piTr1noVjnMqOP6dniFFoxJyMfUYvqV06SaUeqFGWCHX7Q2 1LSfvqHXHwcHhqBfdnimEO6tQwLb+SSv1H0H3HNlKonkg0oNhYVX9vF60/O9h2u2pl+ZkXVNghF CS/Q5d1j+xIGiCNX2N0QuemexsQ/sgmr5NLjAGOXVsudYdkFM9E9q+yXCgmUpu28U9+Yo69B7Uh qO3bPyAhb/l3pvqIRBnRwLOb+i6RYk5ZZeR21TQ= X-Google-Smtp-Source: AGHT+IFVL3iP9pgwWiJmoT/OXiZ9hnZsoXoepLZ6qsQv3FWWCMriW8iUZMqPnBXlcarItn7xCB1OxQ== X-Received: by 2002:a05:6402:5289:b0:5d3:d8b9:674d with SMTP id 4fb4d7f45d1cf-5d6305d624fmr218478a12.0.1734008090955; Thu, 12 Dec 2024 04:54:50 -0800 (PST) Received: from nuc.fritz.box (p200300f6f7081700fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f708:1700:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d14c74c3d5sm10309638a12.52.2024.12.12.04.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 04:54:50 -0800 (PST) From: Johannes Thumshirn To: Chris Mason , Josef Bacik , David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn , Johannes Thumshirn Subject: [PATCH 2/3] btrfs: cache RAID stripe tree decission in btrfs_io_context Date: Thu, 12 Dec 2024 13:54:27 +0100 Message-ID: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-2-d842b6d8d02b@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-0-d842b6d8d02b@kernel.org> References: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-0-d842b6d8d02b@kernel.org> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1904; i=jth@kernel.org; h=from:subject:message-id; bh=iFdRhfjdP0hGjbCjfsjG8TkQfoY4tauw2S9BRH3uMU0=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaRH3Xm+MbHYLLo98MW3znlNR/9fnyTaOOlLxmzmXXP/5 zOlZ+gId5SyMIhxMciKKbIcD7XdL2F6hH3KoddmMHNYmUCGMHBxCsBEErsZ/mcnr847aloadnir Ss4SZv7G48F50Y8vT36YKVT30joqp5Phr9ypRx+PTt91ufhUo6PLsmOtHD7fg7aempTXm7JyRYD hG0YA X-Developer-Key: i=jth@kernel.org; a=openpgp; fpr=EC389CABC2C4F25D8600D0D00393969D2D760850 From: Johannes Thumshirn Cache the decission if a particular I/O needs to update RAID stripe tree entries in struct btrfs_io_context. Signed-off-by: Johannes Thumshirn --- fs/btrfs/bio.c | 3 +-- fs/btrfs/volumes.c | 1 + fs/btrfs/volumes.h | 2 ++ 3 files changed, 4 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..0a00ee36f66b6d6831c43abda4a791684c11ea02 100644 --- a/fs/btrfs/volumes.h +++ b/fs/btrfs/volumes.h @@ -490,6 +490,8 @@ struct btrfs_io_context { u64 size; /* Raid stripe tree ordered entry. */ struct list_head rst_ordered_entry; + /* This I/O operation uses the RAID stripe tree */ + bool use_rst; /* * The total number of stripes, including the extra duplicated From patchwork Thu Dec 12 12:54:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13905167 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 C47EB2144A6; Thu, 12 Dec 2024 12:54:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734008096; cv=none; b=BeD0itVQd2WmWvqw/LTDvmHnYXsEGnQcXgcOAlZJx+jvrWZFoswth5SbIN0V/K8G+uBeYc65VRwWtUh8uC3Z7PKGjbULZWQg1RE6paJhtgOgTWHSTFf0vrAjHmHL4aebB06f5wO9XzICVrEmW1c23RG+5Il2u3Og1ypi2ejBFNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734008096; c=relaxed/simple; bh=2j55y+TneVx+D6nV4rwWdHfLRaHQY6AlVlT8u10YDvs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=Q1gRi5BZ+RzV+jKrBqwLYDKq6C2rQAcwzXjrN7Pdfl3RZuut/WiWBycSmZQNnHw4DGVFPg8QBFy6tsba5PSSklKTWtDp33oHobScehHCayXcWUG0pHWE5Kjcw46aoTbzowaZF2932Tv9ESuiFmOTiWXKpQ9KOilxBwTyVd1vbCc= 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.50 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-f50.google.com with SMTP id 4fb4d7f45d1cf-5d3f65844deso896448a12.0; Thu, 12 Dec 2024 04:54:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734008092; x=1734612892; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Z0/JgBYDqksM8PvqpUI3FsZWQKGnr3QspWVFYX5vYJ0=; b=TNwqtqL8P0bcbJ3W/hcHq9CnxdMBuY5N/9wpCKzdd5TAZ43kvycBqVpqAcn0jMZ75A 34HncHm6swOH3DTjHW7hwR5wkSOU1gGAvADKLOA8o5r4vLXEo7xcmVXY6PJnNystOYAm FqToMIPYF+xlMdF5RbnQ+ksrY1f2smpq1v5DFLMwKKdKK1T3NKEnMWtKjus9OZKxGkQZ 2vXdmzNx8hhU0xMZM9ra0d+LyoOfojYE7tBr3aOeSxnS2dpT4Uf2f6RZjY5TeF8LMh8t Nn8Posc//6Nhu3RaXzifPzPwAcFvvovxZ0PbwfkgOTNVrtX9N64zQIdVfTJcWfR2Veh3 M1GQ== X-Forwarded-Encrypted: i=1; AJvYcCVKB+GowHhkWdRRHCiGzXwITtEpM76yDowA2qIXFYjI3Y3gScxSL8oQhYu0c6ehDj0KiXcXLxVsgAVt1UA2@vger.kernel.org, AJvYcCWx5II/n32WEI8Lf9g9l4CF4xkZR7gzjXI7bZyxGLhVim2EwPN0Q7Pspeb6q98Bs1sif2AvWTZu2j6anQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yx5nYMxBpLU2MW9O4IRd3yrocAHE2mL2ILlCYM4IZZae5VPOLhn I+FEPWsb1FHzP8csEJmK4MTnN5K/8jqDSa5n7h708I9is8IQ92j1 X-Gm-Gg: ASbGnctkGqmDlXBdzl12EvyEhpVUnAC53OdGqMyLaE+ffjEzkEvV0MZ0YbwGtrbmv6E EgcqWjlI3BEEwt/1LvDPMOzZ1OD4oanRSjBC4Jvof5wYQH0EEg0xOAklj5TVD3KAF7sHrph0b/p awz/NT8FRZG+FiVN1ErwTGf1GT1kHfH5jnbivtyvQu7VPRsk5wJBHKZOZQWJtQCIu5EM/BZEVza PyPZebaMBhEwTmnrOAPnChpH9uskx2rHn5YfwCMw4glAqBXUnksqUSjaJpeHxKcKDGN/cyJ3Oca fbVen9ZOTu6oe3hpgviwXz0Tzs3C2aXIv9FiyF8= X-Google-Smtp-Source: AGHT+IGSeHNoc3AEk5gaJaYGuFkZxb9V2fX+bmLgZuixpkZHrLmG0IJdf3bA9eh+GSlahZ75c1Bbrw== X-Received: by 2002:a05:6402:4588:b0:5d4:34a5:e2f4 with SMTP id 4fb4d7f45d1cf-5d633eaf220mr125358a12.31.1734008091962; Thu, 12 Dec 2024 04:54:51 -0800 (PST) Received: from nuc.fritz.box (p200300f6f7081700fa633ffffe02074c.dip0.t-ipconnect.de. [2003:f6:f708:1700:fa63:3fff:fe02:74c]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5d14c74c3d5sm10309638a12.52.2024.12.12.04.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2024 04:54:51 -0800 (PST) From: Johannes Thumshirn To: Chris Mason , Josef Bacik , David Sterba Cc: Johannes Thumshirn , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org, Johannes Thumshirn , Johannes Thumshirn Subject: [PATCH 3/3] btrfs: pass btrfs_io_geometry to is_single_device_io Date: Thu, 12 Dec 2024 13:54:28 +0100 Message-ID: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-3-d842b6d8d02b@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-0-d842b6d8d02b@kernel.org> References: <20241212-btrfs_need_stripe_tree_update-cleanups-v1-0-d842b6d8d02b@kernel.org> Precedence: bulk X-Mailing-List: linux-btrfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1908; i=jth@kernel.org; h=from:subject:message-id; bh=Zb2mLlr0+jNyUX4pYR5ND5op1LwqKFpwsUju8rkXRmY=; b=owGbwMvMwCV2ad4npfVdsu8YT6slMaRH3Xmusyhj/uzYoumWvxOSTn867nSoLy/Mk22he4V1y s1Hm+aYdJSyMIhxMciKKbIcD7XdL2F6hH3KoddmMHNYmUCGMHBxCsBEVoQxMkwXZjjA8+DQQ/7W 4nkqT/KX8stVrH2+u2q78KsCo6Zj8woY/ll4SISut9/1c+tZlZulv3aK9tdcTtufdeDTVbn2jpw 78zkA 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 --- fs/btrfs/volumes.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 088ba0499e184c93a402a3f92167cccfa33eec58..3636586371f6de2df76ecc67c2dbf2fdf3848995 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,11 @@ 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 +6649,8 @@ 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;