diff options
author | David Sterba <dsterba@suse.com> | 2019-08-21 14:05:32 -0400 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-09-09 08:59:16 -0400 |
commit | 1dc990dfd31096176788312d39e1275645901fcb (patch) | |
tree | c10b49ad1ef8bab34777a59c358b1a560c347d97 | |
parent | 67b61aefcef3842a360e6c603860a785fd971c7a (diff) |
btrfs: move dev_stats helpers to volumes.c
The other dev stats functions are already there and the helpers are not
used by anything else.
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/ctree.h | 24 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 23 |
2 files changed, 23 insertions, 24 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0b6eca746fd4..ba34f7b435a2 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h | |||
@@ -2258,30 +2258,6 @@ static inline u32 btrfs_file_extent_inline_item_len( | |||
2258 | return btrfs_item_size(eb, e) - BTRFS_FILE_EXTENT_INLINE_DATA_START; | 2258 | return btrfs_item_size(eb, e) - BTRFS_FILE_EXTENT_INLINE_DATA_START; |
2259 | } | 2259 | } |
2260 | 2260 | ||
2261 | /* btrfs_dev_stats_item */ | ||
2262 | static inline u64 btrfs_dev_stats_value(const struct extent_buffer *eb, | ||
2263 | const struct btrfs_dev_stats_item *ptr, | ||
2264 | int index) | ||
2265 | { | ||
2266 | u64 val; | ||
2267 | |||
2268 | read_extent_buffer(eb, &val, | ||
2269 | offsetof(struct btrfs_dev_stats_item, values) + | ||
2270 | ((unsigned long)ptr) + (index * sizeof(u64)), | ||
2271 | sizeof(val)); | ||
2272 | return val; | ||
2273 | } | ||
2274 | |||
2275 | static inline void btrfs_set_dev_stats_value(struct extent_buffer *eb, | ||
2276 | struct btrfs_dev_stats_item *ptr, | ||
2277 | int index, u64 val) | ||
2278 | { | ||
2279 | write_extent_buffer(eb, &val, | ||
2280 | offsetof(struct btrfs_dev_stats_item, values) + | ||
2281 | ((unsigned long)ptr) + (index * sizeof(u64)), | ||
2282 | sizeof(val)); | ||
2283 | } | ||
2284 | |||
2285 | /* btrfs_qgroup_status_item */ | 2261 | /* btrfs_qgroup_status_item */ |
2286 | BTRFS_SETGET_FUNCS(qgroup_status_generation, struct btrfs_qgroup_status_item, | 2262 | BTRFS_SETGET_FUNCS(qgroup_status_generation, struct btrfs_qgroup_status_item, |
2287 | generation, 64); | 2263 | generation, 64); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 02976c174f32..a324480bc88b 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -7285,6 +7285,29 @@ void btrfs_init_devices_late(struct btrfs_fs_info *fs_info) | |||
7285 | } | 7285 | } |
7286 | } | 7286 | } |
7287 | 7287 | ||
7288 | static u64 btrfs_dev_stats_value(const struct extent_buffer *eb, | ||
7289 | const struct btrfs_dev_stats_item *ptr, | ||
7290 | int index) | ||
7291 | { | ||
7292 | u64 val; | ||
7293 | |||
7294 | read_extent_buffer(eb, &val, | ||
7295 | offsetof(struct btrfs_dev_stats_item, values) + | ||
7296 | ((unsigned long)ptr) + (index * sizeof(u64)), | ||
7297 | sizeof(val)); | ||
7298 | return val; | ||
7299 | } | ||
7300 | |||
7301 | static void btrfs_set_dev_stats_value(struct extent_buffer *eb, | ||
7302 | struct btrfs_dev_stats_item *ptr, | ||
7303 | int index, u64 val) | ||
7304 | { | ||
7305 | write_extent_buffer(eb, &val, | ||
7306 | offsetof(struct btrfs_dev_stats_item, values) + | ||
7307 | ((unsigned long)ptr) + (index * sizeof(u64)), | ||
7308 | sizeof(val)); | ||
7309 | } | ||
7310 | |||
7288 | int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) | 7311 | int btrfs_init_dev_stats(struct btrfs_fs_info *fs_info) |
7289 | { | 7312 | { |
7290 | struct btrfs_key key; | 7313 | struct btrfs_key key; |