Message ID | b3b607429c224b37bf77571a3759a0c5b15c71bc.1663196746.git.josef@toxicpanda.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: clean up zoned device helpers | expand |
On Wed, Sep 14, 2022 at 07:07:50PM -0400, Josef Bacik wrote: > This checks if device->zone_info == NULL or if the bytenr falls in a > sequential range, however btrfs_dev_is_sequential already does the NULL > zone_info check, so we can replace this helper with just > !btrfs_dev_is_sequential. > > Signed-off-by: Josef Bacik <josef@toxicpanda.com> > --- > fs/btrfs/scrub.c | 12 +----------- > 1 file changed, 1 insertion(+), 11 deletions(-) > > diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c > index 66f09202ba96..9d130e13c6b9 100644 > --- a/fs/btrfs/scrub.c > +++ b/fs/btrfs/scrub.c > @@ -4140,16 +4140,6 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, > return ret; > } > > -static inline bool btrfs_check_super_location(struct btrfs_device *device, u64 pos) > -{ > - /* > - * On a non-zoned device, any address is OK. On a zoned device, > - * non-SEQUENTIAL WRITE REQUIRED zones are capable. > - */ > - return device->zone_info == NULL || > - !btrfs_dev_is_sequential(device->zone_info, pos); > -} > - > static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, > struct btrfs_device *scrub_dev) > { > @@ -4173,7 +4163,7 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, > if (bytenr + BTRFS_SUPER_INFO_SIZE > > scrub_dev->commit_total_bytes) > break; > - if (!btrfs_check_super_location(scrub_dev, bytenr)) > + if (!btrfs_dev_is_sequential(scrub_dev->zone_info, bytenr)) This condition is inverted. We need to skip a sequential zone as we cannot overwrite superblock in the zone anyway. > continue; > > ret = scrub_sectors(sctx, bytenr, BTRFS_SUPER_INFO_SIZE, bytenr, > -- > 2.26.3 >
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index 66f09202ba96..9d130e13c6b9 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -4140,16 +4140,6 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx, return ret; } -static inline bool btrfs_check_super_location(struct btrfs_device *device, u64 pos) -{ - /* - * On a non-zoned device, any address is OK. On a zoned device, - * non-SEQUENTIAL WRITE REQUIRED zones are capable. - */ - return device->zone_info == NULL || - !btrfs_dev_is_sequential(device->zone_info, pos); -} - static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, struct btrfs_device *scrub_dev) { @@ -4173,7 +4163,7 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx, if (bytenr + BTRFS_SUPER_INFO_SIZE > scrub_dev->commit_total_bytes) break; - if (!btrfs_check_super_location(scrub_dev, bytenr)) + if (!btrfs_dev_is_sequential(scrub_dev->zone_info, bytenr)) continue; ret = scrub_sectors(sctx, bytenr, BTRFS_SUPER_INFO_SIZE, bytenr,
This checks if device->zone_info == NULL or if the bytenr falls in a sequential range, however btrfs_dev_is_sequential already does the NULL zone_info check, so we can replace this helper with just !btrfs_dev_is_sequential. Signed-off-by: Josef Bacik <josef@toxicpanda.com> --- fs/btrfs/scrub.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)