Commit 4e411a7d authored by Anand Jain's avatar Anand Jain Committed by David Sterba

btrfs: reset device stat using btrfs_dev_stat_set

btrfs_dev_stat_reset() is an overdo in terms of wrapping. So this patch
open codes btrfs_dev_stat_reset().
Signed-off-by: default avatarAnand Jain <anand.jain@oracle.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 73798c46
...@@ -7303,7 +7303,7 @@ static void __btrfs_reset_dev_stats(struct btrfs_device *dev) ...@@ -7303,7 +7303,7 @@ static void __btrfs_reset_dev_stats(struct btrfs_device *dev)
int i; int i;
for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++)
btrfs_dev_stat_reset(dev, i); btrfs_dev_stat_set(dev, i, 0);
} }
int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
...@@ -7353,7 +7353,7 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) ...@@ -7353,7 +7353,7 @@ int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info)
btrfs_dev_stat_set(device, i, btrfs_dev_stat_set(device, i,
btrfs_dev_stats_value(eb, ptr, i)); btrfs_dev_stats_value(eb, ptr, i));
else else
btrfs_dev_stat_reset(device, i); btrfs_dev_stat_set(device, i, 0);
} }
device->dev_stats_valid = 1; device->dev_stats_valid = 1;
...@@ -7536,7 +7536,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info, ...@@ -7536,7 +7536,7 @@ int btrfs_get_dev_stats(struct btrfs_fs_info *fs_info,
stats->values[i] = stats->values[i] =
btrfs_dev_stat_read_and_reset(dev, i); btrfs_dev_stat_read_and_reset(dev, i);
else else
btrfs_dev_stat_reset(dev, i); btrfs_dev_stat_set(dev, i, 0);
} }
} else { } else {
for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++) for (i = 0; i < BTRFS_DEV_STAT_VALUES_MAX; i++)
......
...@@ -547,12 +547,6 @@ static inline void btrfs_dev_stat_set(struct btrfs_device *dev, ...@@ -547,12 +547,6 @@ static inline void btrfs_dev_stat_set(struct btrfs_device *dev,
atomic_inc(&dev->dev_stats_ccnt); atomic_inc(&dev->dev_stats_ccnt);
} }
static inline void btrfs_dev_stat_reset(struct btrfs_device *dev,
int index)
{
btrfs_dev_stat_set(dev, index, 0);
}
/* /*
* Convert block group flags (BTRFS_BLOCK_GROUP_*) to btrfs_raid_types, which * Convert block group flags (BTRFS_BLOCK_GROUP_*) to btrfs_raid_types, which
* can be used as index to access btrfs_raid_array[]. * can be used as index to access btrfs_raid_array[].
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment