diff options
author | Qu Wenruo <quwenruo@cn.fujitsu.com> | 2017-01-24 11:03:05 +0800 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2017-03-08 13:00:45 +0100 |
commit | a2203246ae483d09114329d5d1f898efb23d6168 (patch) | |
tree | 40cea3c2a1293e7f23559c5183cf92c22312321b /ctree.c | |
parent | 95f515f2d12fb1c1b5a01e03d9f709570b762eeb (diff) |
btrfs-progs: Introduce kernel sizes to cleanup large intermediate number
Large numbers like (1024 * 1024 * 1024) may cost reader/reviewer to
waste one second to convert to 1G.
Introduce kernel include/linux/sizes.h to replace any intermediate
number larger than 4096 (not including 4096) to SZ_*.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'ctree.c')
-rw-r--r-- | ctree.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -21,6 +21,7 @@ #include "print-tree.h" #include "repair.h" #include "internal.h" +#include "sizes.h" static int split_node(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, int level); @@ -368,7 +369,7 @@ int btrfs_cow_block(struct btrfs_trans_handle *trans, return 0; } - search_start = buf->start & ~((u64)(1024 * 1024 * 1024) - 1); + search_start = buf->start & ~((u64)SZ_1G - 1); ret = __btrfs_cow_block(trans, root, buf, parent, parent_slot, cow_ret, search_start, 0); return ret; @@ -1026,9 +1027,9 @@ void reada_for_search(struct btrfs_root *root, struct btrfs_path *path, nread += blocksize; } nscan++; - if (path->reada < 2 && (nread > (256 * 1024) || nscan > 32)) + if (path->reada < 2 && (nread > SZ_256K || nscan > 32)) break; - if(nread > (1024 * 1024) || nscan > 128) + if(nread > SZ_1M || nscan > 128) break; if (search < lowest_read) |