Skip to content

Commit 85e79ec

Browse files
naotakdave
authored andcommitted
btrfs: zoned: enable metadata over-commit for non-ZNS setup
The commit 79417d0 ("btrfs: zoned: disable metadata overcommit for zoned") disabled the metadata over-commit to track active zones properly. However, it also introduced a heavy overhead by allocating new metadata block groups and/or flushing dirty buffers to release the space reservations. Specifically, a workload (write only without any sync operations) worsen its performance from 343.77 MB/sec (v5.19) to 182.89 MB/sec (v6.0). The performance is still bad on current misc-next which is 187.95 MB/sec. And, with this patch applied, it improves back to 326.70 MB/sec (+73.82%). This patch introduces a new fs_info->flag BTRFS_FS_NO_OVERCOMMIT to indicate it needs to disable the metadata over-commit. The flag is enabled when a device with max active zones limit is loaded into a file-system. Fixes: 79417d0 ("btrfs: zoned: disable metadata overcommit for zoned") CC: [email protected] # 6.0+ Reviewed-by: Johannes Thumshirn <[email protected]> Signed-off-by: Naohiro Aota <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 7518140 commit 85e79ec

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

fs/btrfs/fs.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,12 @@ enum {
119119
/* Indicate that we want to commit the transaction. */
120120
BTRFS_FS_NEED_TRANS_COMMIT,
121121

122+
/*
123+
* Indicate metadata over-commit is disabled. This is set when active
124+
* zone tracking is needed.
125+
*/
126+
BTRFS_FS_NO_OVERCOMMIT,
127+
122128
#if BITS_PER_LONG == 32
123129
/* Indicate if we have error/warn message printed on 32bit systems */
124130
BTRFS_FS_32BIT_ERROR,

fs/btrfs/space-info.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,8 @@ int btrfs_can_overcommit(struct btrfs_fs_info *fs_info,
407407
return 0;
408408

409409
used = btrfs_space_info_used(space_info, true);
410-
if (btrfs_is_zoned(fs_info) && (space_info->flags & BTRFS_BLOCK_GROUP_METADATA))
410+
if (test_bit(BTRFS_FS_NO_OVERCOMMIT, &fs_info->flags) &&
411+
(space_info->flags & BTRFS_BLOCK_GROUP_METADATA))
411412
avail = 0;
412413
else
413414
avail = calc_available_free_space(fs_info, space_info, flush);

fs/btrfs/zoned.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,8 @@ int btrfs_get_dev_zone_info(struct btrfs_device *device, bool populate_cache)
539539
}
540540
atomic_set(&zone_info->active_zones_left,
541541
max_active_zones - nactive);
542+
/* Overcommit does not work well with active zone tacking. */
543+
set_bit(BTRFS_FS_NO_OVERCOMMIT, &fs_info->flags);
542544
}
543545

544546
/* Validate superblock log */

0 commit comments

Comments
 (0)