* [PATCH 0/2] btrfs: RST scrub fixes for prealloc
@ 2024-10-07 11:52 Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 1/2] btrfs: return ENODATA in case RST lookup fails Johannes Thumshirn
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2024-10-07 11:52 UTC (permalink / raw)
To: David Sterba, Chris Mason, Josef Bacik; +Cc: linux-btrfs, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
When scrubbing a non-zoned RAID stripe tree filesystem, the RST specific scrub
code finds false positives becuase preallocated extents are not backed by the
stripe-tree and so the lookup failes.
These patches address the issue by a) changing RST lookup failures from
ENOENT to ENODATA and b) skipping ENODATA on RST mapping errors from the scrub
side.
This aproach was suggested by Josef in
https://lore.kernel.org/linux-btrfs/20240923152705.GB159452@perftesting/
Johannes Thumshirn (2):
btrfs: return ENODATA in case RST lookup fails
btrfs: scrub: skip initial RAID stripe-tree lookup errors
fs/btrfs/raid-stripe-tree.c | 6 +++---
fs/btrfs/scrub.c | 6 ++++--
2 files changed, 7 insertions(+), 5 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] btrfs: return ENODATA in case RST lookup fails
2024-10-07 11:52 [PATCH 0/2] btrfs: RST scrub fixes for prealloc Johannes Thumshirn
@ 2024-10-07 11:52 ` Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors Johannes Thumshirn
2024-10-07 15:02 ` [PATCH 0/2] btrfs: RST scrub fixes for prealloc Josef Bacik
2 siblings, 0 replies; 5+ messages in thread
From: Johannes Thumshirn @ 2024-10-07 11:52 UTC (permalink / raw)
To: David Sterba, Chris Mason, Josef Bacik; +Cc: linux-btrfs, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
In case a lookup in the RAID stripe-tree fails, return ENODATA instead of
ENOENT to better distinguish stripe-tree lookups from other code paths
where we return ENOENT.
Suggested-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
fs/btrfs/raid-stripe-tree.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/raid-stripe-tree.c b/fs/btrfs/raid-stripe-tree.c
index b7787a8e4af2..41970bbdb05f 100644
--- a/fs/btrfs/raid-stripe-tree.c
+++ b/fs/btrfs/raid-stripe-tree.c
@@ -234,7 +234,7 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info,
found_end = found_logical + found_length;
if (found_logical > end) {
- ret = -ENOENT;
+ ret = -ENODATA;
goto out;
}
@@ -280,10 +280,10 @@ int btrfs_get_raid_extent_offset(struct btrfs_fs_info *fs_info,
}
/* If we're here, we haven't found the requested devid in the stripe. */
- ret = -ENOENT;
+ ret = -ENODATA;
out:
if (ret > 0)
- ret = -ENOENT;
+ ret = -ENODATA;
if (ret && ret != -EIO && !stripe->rst_search_commit_root) {
btrfs_debug(fs_info,
"cannot find raid-stripe for logical [%llu, %llu] devid %llu, profile %s",
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors
2024-10-07 11:52 [PATCH 0/2] btrfs: RST scrub fixes for prealloc Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 1/2] btrfs: return ENODATA in case RST lookup fails Johannes Thumshirn
@ 2024-10-07 11:52 ` Johannes Thumshirn
2024-10-08 17:05 ` David Sterba
2024-10-07 15:02 ` [PATCH 0/2] btrfs: RST scrub fixes for prealloc Josef Bacik
2 siblings, 1 reply; 5+ messages in thread
From: Johannes Thumshirn @ 2024-10-07 11:52 UTC (permalink / raw)
To: David Sterba, Chris Mason, Josef Bacik; +Cc: linux-btrfs, Johannes Thumshirn
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Performing the initial extent sector read on a RAID stripe-tree backed
filesystem with pre-allocated extents will cause the RAID stripe-tree
lookup code to return ENODATA, as pre-allocated extents do not have any
on-disk bytes and thus no RAID stripe-tree entries.
But the current scrub read code marks these extens as errors, because the
lookup fails.
If btrfs_map_block() returns -ENODATA, it means that the call to
btrfs_get_raid_extent_offset() returned -ENODATA, because there is no
entry for the corresponding range in the RAID stripe-tree. But as this
range is in the extent-tree it means we've hit a pre-allocated extent. In
this case, don't mark the sector in the stripe's error bitmaps as faulty
and carry on to the next.
Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
---
fs/btrfs/scrub.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index e141132b5c8d..96ac6f9e5eee 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1704,8 +1704,10 @@ static void scrub_submit_extent_sector_read(struct scrub_ctx *sctx,
&stripe_len, &bioc, &io_stripe, &mirror);
btrfs_put_bioc(bioc);
if (err < 0) {
- set_bit(i, &stripe->io_error_bitmap);
- set_bit(i, &stripe->error_bitmap);
+ if (err != -ENODATA) {
+ set_bit(i, &stripe->io_error_bitmap);
+ set_bit(i, &stripe->error_bitmap);
+ }
continue;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] btrfs: RST scrub fixes for prealloc
2024-10-07 11:52 [PATCH 0/2] btrfs: RST scrub fixes for prealloc Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 1/2] btrfs: return ENODATA in case RST lookup fails Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors Johannes Thumshirn
@ 2024-10-07 15:02 ` Josef Bacik
2 siblings, 0 replies; 5+ messages in thread
From: Josef Bacik @ 2024-10-07 15:02 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: David Sterba, Chris Mason, linux-btrfs, Johannes Thumshirn
On Mon, Oct 07, 2024 at 01:52:46PM +0200, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>
> When scrubbing a non-zoned RAID stripe tree filesystem, the RST specific scrub
> code finds false positives becuase preallocated extents are not backed by the
> stripe-tree and so the lookup failes.
>
> These patches address the issue by a) changing RST lookup failures from
> ENOENT to ENODATA and b) skipping ENODATA on RST mapping errors from the scrub
> side.
>
> This aproach was suggested by Josef in
> https://lore.kernel.org/linux-btrfs/20240923152705.GB159452@perftesting/
>
> Johannes Thumshirn (2):
> btrfs: return ENODATA in case RST lookup fails
> btrfs: scrub: skip initial RAID stripe-tree lookup errors
>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Thanks,
Josef
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors
2024-10-07 11:52 ` [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors Johannes Thumshirn
@ 2024-10-08 17:05 ` David Sterba
0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2024-10-08 17:05 UTC (permalink / raw)
To: Johannes Thumshirn
Cc: David Sterba, Chris Mason, Josef Bacik, linux-btrfs,
Johannes Thumshirn
On Mon, Oct 07, 2024 at 01:52:48PM +0200, Johannes Thumshirn wrote:
> From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
>
> Performing the initial extent sector read on a RAID stripe-tree backed
> filesystem with pre-allocated extents will cause the RAID stripe-tree
> lookup code to return ENODATA, as pre-allocated extents do not have any
> on-disk bytes and thus no RAID stripe-tree entries.
>
> But the current scrub read code marks these extens as errors, because the
> lookup fails.
>
> If btrfs_map_block() returns -ENODATA, it means that the call to
> btrfs_get_raid_extent_offset() returned -ENODATA, because there is no
> entry for the corresponding range in the RAID stripe-tree. But as this
> range is in the extent-tree it means we've hit a pre-allocated extent. In
> this case, don't mark the sector in the stripe's error bitmaps as faulty
> and carry on to the next.
I've added summary of this paragraph as a comment to the code, using the
ENODATA for a specific relations in the trees is quite unobvious.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-08 17:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-07 11:52 [PATCH 0/2] btrfs: RST scrub fixes for prealloc Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 1/2] btrfs: return ENODATA in case RST lookup fails Johannes Thumshirn
2024-10-07 11:52 ` [PATCH 2/2] btrfs: scrub: skip initial RAID stripe-tree lookup errors Johannes Thumshirn
2024-10-08 17:05 ` David Sterba
2024-10-07 15:02 ` [PATCH 0/2] btrfs: RST scrub fixes for prealloc Josef Bacik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).