@@ -3523,25 +3523,6 @@ static noinline_for_stack int scrub_chunk(struct scrub_ctx *sctx,
return ret;
}
-static int finish_extent_writes_for_zoned(struct btrfs_root *root,
- struct btrfs_block_group *cache)
-{
- struct btrfs_fs_info *fs_info = cache->fs_info;
- struct btrfs_trans_handle *trans;
-
- if (!btrfs_is_zoned(fs_info))
- return 0;
-
- btrfs_wait_block_group_reservations(cache);
- btrfs_wait_nocow_writers(cache);
- btrfs_wait_ordered_roots(fs_info, U64_MAX, cache->start, cache->length);
-
- trans = btrfs_join_transaction(root);
- if (IS_ERR(trans))
- return PTR_ERR(trans);
- return btrfs_commit_transaction(trans);
-}
-
static noinline_for_stack
int scrub_enumerate_chunks(struct scrub_ctx *sctx,
struct btrfs_device *scrub_dev, u64 start, u64 end)
@@ -3695,7 +3676,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,
*/
ret = btrfs_inc_block_group_ro(cache, sctx->is_dev_replace);
if (!ret && sctx->is_dev_replace) {
- ret = finish_extent_writes_for_zoned(root, cache);
+ ret = btrfs_finish_extent_writes_for_zoned(root, cache);
if (ret) {
btrfs_dec_block_group_ro(cache);
scrub_pause_off(fs_info);
@@ -2296,3 +2296,22 @@ void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx)
wait_event(sctx->list_wait, atomic_read(&sctx->bios_in_flight) == 0);
}
+
+int btrfs_finish_extent_writes_for_zoned(struct btrfs_root *root,
+ struct btrfs_block_group *cache)
+{
+ struct btrfs_fs_info *fs_info = cache->fs_info;
+ struct btrfs_trans_handle *trans;
+
+ if (!btrfs_is_zoned(fs_info))
+ return 0;
+
+ btrfs_wait_block_group_reservations(cache);
+ btrfs_wait_nocow_writers(cache);
+ btrfs_wait_ordered_roots(fs_info, U64_MAX, cache->start, cache->length);
+
+ trans = btrfs_join_transaction(root);
+ if (IS_ERR(trans))
+ return PTR_ERR(trans);
+ return btrfs_commit_transaction(trans);
+}
@@ -89,6 +89,8 @@ 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);
+int btrfs_finish_extent_writes_for_zoned(struct btrfs_root *root,
+ struct btrfs_block_group *cache);
#else /* CONFIG_BLK_DEV_ZONED */
static inline int btrfs_get_dev_zone(struct btrfs_device *device, u64 pos,
struct blk_zone *zone)
@@ -280,6 +282,12 @@ static inline int btrfs_sync_write_pointer_for_zoned(struct scrub_ctx *sctx,
}
static inline void btrfs_sync_replace_for_zoned(struct scrub_ctx *sctx) { }
+
+static inline int btrfs_finish_extent_writes_for_zoned(struct btrfs_root *root,
+ struct btrfs_block_group *cache)
+{
+ return 0;
+}
#endif
static inline bool btrfs_dev_is_sequential(struct btrfs_device *device, u64 pos)
finish_extent_writes_for_zoned() is only used on zoned filesystems so move it to zoned code. Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- fs/btrfs/scrub.c | 21 +-------------------- fs/btrfs/zoned.c | 19 +++++++++++++++++++ fs/btrfs/zoned.h | 8 ++++++++ 3 files changed, 28 insertions(+), 20 deletions(-)