@@ -3056,20 +3056,6 @@ static noinline_for_stack int scrub_raid56_parity(struct scrub_ctx *sctx,
return ret < 0 ? ret : 0;
}
-static void sync_replace_for_zoned(struct scrub_ctx *sctx)
-{
- if (!btrfs_is_zoned(sctx->fs_info))
- return;
-
- sctx->flush_all_writes = true;
- btrfs_scrub_submit(sctx);
- mutex_lock(&sctx->wr_lock);
- btrfs_scrub_wr_submit(sctx);
- mutex_unlock(&sctx->wr_lock);
-
- wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0);
-}
-
static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
struct map_lookup *map,
struct btrfs_device *scrub_dev,
@@ -3402,7 +3388,7 @@ static noinline_for_stack int scrub_stripe(struct scrub_ctx *sctx,
goto out;
if (sctx->is_dev_replace)
- sync_replace_for_zoned(sctx);
+ btrfs_sync_replace_for_zoned(sctx);
if (extent_logical + extent_len <
key.objectid + bytes) {
@@ -2282,3 +2282,17 @@ int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical,
return ret;
}
+
+void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx)
+{
+ if (!btrfs_is_zoned(sctx->fs_info))
+ return;
+
+ sctx->flush_all_writes = true;
+ btrfs_scrub_submit(sctx);
+ mutex_lock(&sctx->wr_lock);
+ btrfs_scrub_wr_submit(sctx);
+ mutex_unlock(&sctx->wr_lock);
+
+ wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0);
+}
@@ -88,6 +88,7 @@ bool btrfs_is_block_group_to_copy(struct btrfs_fs_info *fs_info, u64 logical);
int btrfs_fill_writer_pointer_gap(struct scrub_ctx *sctx, u64 physical);
int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx, u64 logical,
u64 physical, u64 physical_end);
+void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx);
#else /* CONFIG_BLK_DEV_ZONED */
static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos,
struct blk_zone *zone)
@@ -277,6 +278,8 @@ static inline int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx,
{
return 0;
}
+
+static inline void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx) { }
#endif
static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos)
sync_replace_for_zoned( is only used on a zoned filesystem, so move it to zoned code. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- fs/btrfs/scrub.c | 16 +--------------- fs/btrfs/zoned.c | 14 ++++++++++++++ fs/btrfs/zoned.h | 3 +++ 3 files changed, 18 insertions(+), 15 deletions(-)