btrfs-progs: check/lowmem: Cleanup unnecessary _v2 suffixes

There used to be some functions with _v2 suffix to distinguish them from
original mode that had similar functions.

However now when the lowmem mode is moved to own check/lowmem.[ch],
cleanup the _v2 suffixes, and for functions that really need to be
distinguished from original mode (exported functions), change the _v2
suffix to _lowmem.

Signed-off-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
Qu Wenruo 2018-01-19 13:26:49 +08:00 committed by David Sterba
parent b8d706e58e
commit 3a939bc7f3
3 changed files with 27 additions and 27 deletions

View File

@ -28,8 +28,8 @@
#include "check/common.h" #include "check/common.h"
#include "check/lowmem.h" #include "check/lowmem.h"
static int calc_extent_flag_v2(struct btrfs_root *root, struct extent_buffer *eb, static int calc_extent_flag(struct btrfs_root *root, struct extent_buffer *eb,
u64 *flags_ret) u64 *flags_ret)
{ {
struct btrfs_root *extent_root = root->fs_info->extent_root; struct btrfs_root *extent_root = root->fs_info->extent_root;
struct btrfs_root_item *ri = &root->root_item; struct btrfs_root_item *ri = &root->root_item;
@ -225,7 +225,7 @@ static int update_nodes_refs(struct btrfs_root *root, u64 bytenr,
} }
if (check_all && eb) { if (check_all && eb) {
calc_extent_flag_v2(root, eb, &flags); calc_extent_flag(root, eb, &flags);
if (flags & BTRFS_BLOCK_FLAG_FULL_BACKREF) if (flags & BTRFS_BLOCK_FLAG_FULL_BACKREF)
nrefs->full_backref[level] = 1; nrefs->full_backref[level] = 1;
} }
@ -2081,8 +2081,8 @@ out:
* Returns <0 Fatal error, must exit the whole check * Returns <0 Fatal error, must exit the whole check
* Returns 0 No errors found * Returns 0 No errors found
*/ */
static int process_one_leaf_v2(struct btrfs_root *root, struct btrfs_path *path, static int process_one_leaf(struct btrfs_root *root, struct btrfs_path *path,
struct node_refs *nrefs, int *level, int ext_ref) struct node_refs *nrefs, int *level, int ext_ref)
{ {
struct extent_buffer *cur = path->nodes[0]; struct extent_buffer *cur = path->nodes[0];
struct btrfs_key key; struct btrfs_key key;
@ -3895,10 +3895,10 @@ out:
* Returns <0 Fatal error, must exit the whole check * Returns <0 Fatal error, must exit the whole check
* Returns 0 No errors found * Returns 0 No errors found
*/ */
static int walk_down_tree_v2(struct btrfs_trans_handle *trans, static int walk_down_tree(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *path, struct btrfs_root *root, struct btrfs_path *path,
int *level, struct node_refs *nrefs, int ext_ref, int *level, struct node_refs *nrefs, int ext_ref,
int check_all) int check_all)
{ {
enum btrfs_tree_block_status status; enum btrfs_tree_block_status status;
u64 bytenr; u64 bytenr;
@ -3968,8 +3968,8 @@ static int walk_down_tree_v2(struct btrfs_trans_handle *trans,
ret = 0; ret = 0;
if (!check_all) if (!check_all)
ret = process_one_leaf_v2(root, path, nrefs, ret = process_one_leaf(root, path, nrefs,
level, ext_ref); level, ext_ref);
else else
ret = check_leaf_items(trans, root, path, ret = check_leaf_items(trans, root, path,
nrefs, account_file_data); nrefs, account_file_data);
@ -3993,7 +3993,7 @@ static int walk_down_tree_v2(struct btrfs_trans_handle *trans,
if (ret < 0) if (ret < 0)
break; break;
/* /*
* check all trees in check_chunks_and_extent_v2 * check all trees in check_chunks_and_extent
* check shared node once in check_fs_roots * check shared node once in check_fs_roots
*/ */
if (!check_all && !nrefs->need_check[*level - 1]) { if (!check_all && !nrefs->need_check[*level - 1]) {
@ -4046,8 +4046,8 @@ static int walk_down_tree_v2(struct btrfs_trans_handle *trans,
return err; return err;
} }
static int walk_up_tree_v2(struct btrfs_root *root, struct btrfs_path *path, static int walk_up_tree(struct btrfs_root *root, struct btrfs_path *path,
int *level) int *level)
{ {
int i; int i;
struct extent_buffer *leaf; struct extent_buffer *leaf;
@ -4200,7 +4200,7 @@ out:
} }
/* /*
* This function calls walk_down_tree_v2 and walk_up_tree_v2 to check tree * This function calls walk_down_tree and walk_up_tree to check tree
* blocks and integrity of fs tree items. * blocks and integrity of fs tree items.
* *
* @root: the root of the tree to be checked. * @root: the root of the tree to be checked.
@ -4257,8 +4257,8 @@ static int check_btrfs_root(struct btrfs_trans_handle *trans,
} }
while (1) { while (1) {
ret = walk_down_tree_v2(trans, root, &path, &level, &nrefs, ret = walk_down_tree(trans, root, &path, &level, &nrefs,
ext_ref, check_all); ext_ref, check_all);
err |= !!ret; err |= !!ret;
@ -4268,7 +4268,7 @@ static int check_btrfs_root(struct btrfs_trans_handle *trans,
break; break;
} }
ret = walk_up_tree_v2(root, &path, &level); ret = walk_up_tree(root, &path, &level);
if (ret != 0) { if (ret != 0) {
/* Normal exit, reset ret to err */ /* Normal exit, reset ret to err */
ret = err; ret = err;
@ -4290,7 +4290,7 @@ out:
* Return 0 if no error found. * Return 0 if no error found.
* Return <0 for error. * Return <0 for error.
*/ */
static int check_fs_root_v2(struct btrfs_root *root, unsigned int ext_ref) static int check_fs_root(struct btrfs_root *root, unsigned int ext_ref)
{ {
reset_cached_block_groups(root->fs_info); reset_cached_block_groups(root->fs_info);
return check_btrfs_root(NULL, root, ext_ref, 0); return check_btrfs_root(NULL, root, ext_ref, 0);
@ -4390,12 +4390,12 @@ out:
/* /*
* Check all fs/file tree in low_memory mode. * Check all fs/file tree in low_memory mode.
* *
* 1. for fs tree root item, call check_fs_root_v2() * 1. for fs tree root item, call check_fs_root()
* 2. for fs tree root ref/backref, call check_root_ref() * 2. for fs tree root ref/backref, call check_root_ref()
* *
* Return 0 if no error occurred. * Return 0 if no error occurred.
*/ */
int check_fs_roots_v2(struct btrfs_fs_info *fs_info) int check_fs_roots_lowmem(struct btrfs_fs_info *fs_info)
{ {
struct btrfs_root *tree_root = fs_info->tree_root; struct btrfs_root *tree_root = fs_info->tree_root;
struct btrfs_root *cur_root = NULL; struct btrfs_root *cur_root = NULL;
@ -4446,7 +4446,7 @@ int check_fs_roots_v2(struct btrfs_fs_info *fs_info)
goto next; goto next;
} }
ret = check_fs_root_v2(cur_root, ext_ref); ret = check_fs_root(cur_root, ext_ref);
err |= ret; err |= ret;
if (key.objectid == BTRFS_TREE_RELOC_OBJECTID) if (key.objectid == BTRFS_TREE_RELOC_OBJECTID)
@ -4474,7 +4474,7 @@ out:
/* /*
* Low memory usage version check_chunks_and_extents. * Low memory usage version check_chunks_and_extents.
*/ */
int check_chunks_and_extents_v2(struct btrfs_fs_info *fs_info) int check_chunks_and_extents_lowmem(struct btrfs_fs_info *fs_info)
{ {
struct btrfs_trans_handle *trans = NULL; struct btrfs_trans_handle *trans = NULL;
struct btrfs_path path; struct btrfs_path path;

View File

@ -61,7 +61,7 @@
#define ACCOUNTING_MISMATCH (1 << 7) /* Used space accounting error */ #define ACCOUNTING_MISMATCH (1 << 7) /* Used space accounting error */
#define CHUNK_TYPE_MISMATCH (1 << 8) #define CHUNK_TYPE_MISMATCH (1 << 8)
int check_fs_roots_v2(struct btrfs_fs_info *fs_info); int check_fs_roots_lowmem(struct btrfs_fs_info *fs_info);
int check_chunks_and_extents_v2(struct btrfs_fs_info *fs_info); int check_chunks_and_extents_lowmem(struct btrfs_fs_info *fs_info);
#endif #endif

View File

@ -3465,7 +3465,7 @@ static int do_check_fs_roots(struct btrfs_fs_info *fs_info,
if (!ctx.progress_enabled) if (!ctx.progress_enabled)
fprintf(stderr, "checking fs roots\n"); fprintf(stderr, "checking fs roots\n");
if (check_mode == CHECK_MODE_LOWMEM) if (check_mode == CHECK_MODE_LOWMEM)
ret = check_fs_roots_v2(fs_info); ret = check_fs_roots_lowmem(fs_info);
else else
ret = check_fs_roots(fs_info, root_cache); ret = check_fs_roots(fs_info, root_cache);
@ -8257,7 +8257,7 @@ static int do_check_chunks_and_extents(struct btrfs_fs_info *fs_info)
if (!ctx.progress_enabled) if (!ctx.progress_enabled)
fprintf(stderr, "checking extents\n"); fprintf(stderr, "checking extents\n");
if (check_mode == CHECK_MODE_LOWMEM) if (check_mode == CHECK_MODE_LOWMEM)
ret = check_chunks_and_extents_v2(fs_info); ret = check_chunks_and_extents_lowmem(fs_info);
else else
ret = check_chunks_and_extents(fs_info); ret = check_chunks_and_extents(fs_info);