diff options
author | Anand Jain <anand.jain@oracle.com> | 2019-08-07 04:21:20 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 08:59:06 -0400 |
commit | ae4b9b4c7d546b1cabf9e5da67432cfbc7cd7148 (patch) | |
tree | 879570716443fcd50288a88472e6d522b2ac4636 /fs/btrfs/volumes.c | |
parent | 4e411a7d044168520d936264c9fe40847cf031eb (diff) |
btrfs: opencode reset of all device stats
__btrfs_reset_dev_stats() is a small helper function to reset devices stat
values, and is used only once, instead just open code it.
Signed-off-by: Anand Jain <anand.jain@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/volumes.c')
-rw-r--r-- | fs/btrfs/volumes.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index a9920bce7bcd..8031b47cb380 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -191,7 +191,6 @@ out_overflow:; | |||
191 | 191 | ||
192 | static int init_first_rw_device(struct btrfs_trans_handle *trans); | 192 | static int init_first_rw_device(struct btrfs_trans_handle *trans); |
193 | static int btrfs_relocate_sys_chunks(struct btrfs_fs_info *fs_info); | 193 | static int btrfs_relocate_sys_chunks(struct btrfs_fs_info *fs_info); |
194 | static void __btrfs_reset_dev_stats(struct btrfs_device *dev); | ||
195 | static void btrfs_dev_stat_print_on_error(struct btrfs_device *dev); | 194 | static void btrfs_dev_stat_print_on_error(struct btrfs_device *dev); |
196 | static void btrfs_dev_stat_print_on_load(struct btrfs_device *device); | 195 | static void btrfs_dev_stat_print_on_load(struct btrfs_device *device); |
197 | static int __btrfs_map_block(struct btrfs_fs_info *fs_info, | 196 | static int __btrfs_map_block(struct btrfs_fs_info *fs_info, |
@@ -7298,14 +7297,6 @@ void btrfs_init_devices_late(struct btrfs_fs_info *fs_info) | |||
7298 | } | 7297 | } |
7299 | } | 7298 | } |
7300 | 7299 | ||
7301 | static void __btrfs_reset_dev_stats(struct btrfs_device *dev) | ||
7302 | { | ||
7303 | int i; | ||
7304 | |||
7305 | for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) | ||
7306 | btrfs_dev_stat_set(dev, i, 0); | ||
7307 | } | ||
7308 | |||
7309 | int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) | 7300 | int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) |
7310 | { | 7301 | { |
7311 | struct btrfs_key key; | 7302 | struct btrfs_key key; |
@@ -7335,7 +7326,8 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) | |||
7335 | key.offset = device->devid; | 7326 | key.offset = device->devid; |
7336 | ret = btrfs_search_slot(NULL, dev_root, &key, path, 0, 0); | 7327 | ret = btrfs_search_slot(NULL, dev_root, &key, path, 0, 0); |
7337 | if (ret) { | 7328 | if (ret) { |
7338 | __btrfs_reset_dev_stats(device); | 7329 | for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) |
7330 | btrfs_dev_stat_set(device, i, 0); | ||
7339 | device->dev_stats_valid = 1; | 7331 | device->dev_stats_valid = 1; |
7340 | btrfs_release_path(path); | 7332 | btrfs_release_path(path); |
7341 | continue; | 7333 | continue; |