* [PATCH 00/10] Simplify function interfaces
@ 2018-03-27 7:19 Nikolay Borisov
2018-03-27 7:19 ` [PATCH 01/10] btrfs-progs: Drop ext_ref parameter from find_inode_ref Nikolay Borisov
` (11 more replies)
0 siblings, 12 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
A bunch of functions in lowmem mode take an 'ext_ref' parameter only to pass it
down the call chain where it eventually is consumed. Turns out the functions
which actually check the parameter are find_inode_ref and check_inode_item, the
are only passing it down to them. At the same time those functions can get a
reference to fs_info and do the check in them at the appropriate time.
This patchset cleanups the interface of various function by dropping the
ext_ref argument and moving the actual query of the EXTREF feature closer to
where it's being used.
The final patch just changes signature of __btrfs_fs_incompat to better match
the logic of the code and be identical to its kernel counterpart. All in all
this series doesn't introduce any functional changes per-se.
Nikolay Borisov (10):
btrfs-progs: Drop ext_ref parameter from find_inode_ref
btrfs-progs: Drop ext_ref param from check_dir_item
btrfs-progs: Drop ext_ref argument from check_inode_item
btrfs-progs: Drop unused ext_ref parameter from process_one_leaf
btrfs-progs: Remove ext_ref param from check_fs_first_inode
btrfs-progs: Remove ext_ref param from walk_down_tree
btrfs-progs: Drop ext_ref param from check_fs_first_inode
btrfs-progs: Drop ext_ref arument from check_fs_root
btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem
btrfs-progs: Make __btrfs_fs_incompat return bool
check/mode-lowmem.c | 63 +++++++++++++++++++++++------------------------------
ctree.h | 2 +-
2 files changed, 28 insertions(+), 37 deletions(-)
--
2.7.4
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 01/10] btrfs-progs: Drop ext_ref parameter from find_inode_ref
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 02/10] btrfs-progs: Drop ext_ref param from check_dir_item Nikolay Borisov
` (10 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
This is a boolean parameter which signals whether the fs has the
EXTENDED_IREF feature flag toggled or not. Since a reference to fs_info
can be obtained there is no need to pollute the interface.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index dac3201b7d99..a8a2f76549a2 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -921,14 +921,13 @@ static int check_inode_extref(struct btrfs_root *root,
* @namelen: the length of name in the INODE_REF/INODE_EXTREF
* @index_ret: the index in the INODE_REF/INODE_EXTREF,
* value (64)-1 means do not check index
- * @ext_ref: the EXTENDED_IREF feature
*
* Return 0 if no error occurred.
* Return >0 for error bitmap
*/
static int find_inode_ref(struct btrfs_root *root, struct btrfs_key *key,
- char *name, int namelen, u64 *index_ret,
- unsigned int ext_ref)
+ char *name, int namelen, u64 *index_ret)
+
{
struct btrfs_path path;
struct btrfs_inode_ref *ref;
@@ -1001,8 +1000,9 @@ static int find_inode_ref(struct btrfs_root *root, struct btrfs_key *key,
}
extref:
+
/* Skip if not support EXTENDED_IREF feature */
- if (!ext_ref)
+ if (!btrfs_fs_incompat(root->fs_info, EXTENDED_IREF))
goto out;
btrfs_release_path(&path);
@@ -1311,8 +1311,7 @@ static int check_dir_item(struct btrfs_root *root, struct btrfs_key *di_key,
key.objectid = location.objectid;
key.type = BTRFS_INODE_REF_KEY;
key.offset = di_key->objectid;
- tmp_err |= find_inode_ref(root, &key, namebuf, len,
- &index, ext_ref);
+ tmp_err |= find_inode_ref(root, &key, namebuf, len, &index);
/* check relative INDEX/ITEM */
key.objectid = di_key->objectid;
@@ -4241,7 +4240,7 @@ static int check_fs_first_inode(struct btrfs_root *root, unsigned int ext_ref)
/* special index value */
index = 0;
- ret = find_inode_ref(root, &key, "..", strlen(".."), &index, ext_ref);
+ ret = find_inode_ref(root, &key, "..", strlen(".."), &index);
if (ret < 0)
goto out;
err |= ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 02/10] btrfs-progs: Drop ext_ref param from check_dir_item
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
2018-03-27 7:19 ` [PATCH 01/10] btrfs-progs: Drop ext_ref parameter from find_inode_ref Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 03/10] btrfs-progs: Drop ext_ref argument from check_inode_item Nikolay Borisov
` (9 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
This parameter is no longer used in this function, so drop it
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index a8a2f76549a2..2c7b270a3ffa 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -1188,14 +1188,12 @@ static void print_dir_item_err(struct btrfs_root *root, struct btrfs_key *key,
* @key: the key of the INODE_REF/INODE_EXTREF
* @path: the path
* @size: the st_size of the INODE_ITEM
- * @ext_ref: the EXTENDED_IREF feature
*
* Return 0 if no error occurred.
* Return DIR_COUNT_AGAIN if the isize of the inode should be recalculated.
*/
static int check_dir_item(struct btrfs_root *root, struct btrfs_key *di_key,
- struct btrfs_path *path, u64 *size,
- unsigned int ext_ref)
+ struct btrfs_path *path, u64 *size)
{
struct btrfs_dir_item *di;
struct btrfs_inode_item *ii;
@@ -2011,7 +2009,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path,
imode_to_type(mode), key.objectid,
key.offset);
}
- ret = check_dir_item(root, &key, path, &size, ext_ref);
+ ret = check_dir_item(root, &key, path, &size);
err |= ret;
break;
case BTRFS_EXTENT_DATA_KEY:
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 03/10] btrfs-progs: Drop ext_ref argument from check_inode_item
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
2018-03-27 7:19 ` [PATCH 01/10] btrfs-progs: Drop ext_ref parameter from find_inode_ref Nikolay Borisov
2018-03-27 7:19 ` [PATCH 02/10] btrfs-progs: Drop ext_ref param from check_dir_item Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 04/10] btrfs-progs: Drop unused ext_ref parameter from process_one_leaf Nikolay Borisov
` (8 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
We can derive this argument from root->fs_info and also make it local
to the sole switch case it's used.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 2c7b270a3ffa..e26e9bdf3bb3 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -1918,13 +1918,10 @@ static bool has_orphan_item(struct btrfs_root *root, u64 ino)
* 2. check inode ref/extref
* 3. check dir item/index
*
- * @ext_ref: the EXTENDED_IREF feature
- *
* Return 0 if no error occurred.
* Return >0 for error or hit the traversal is done(by error bitmap)
*/
-static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path,
- unsigned int ext_ref)
+static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
{
struct extent_buffer *node;
struct btrfs_inode_item *ii;
@@ -1993,6 +1990,9 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path,
err |= ret;
break;
case BTRFS_INODE_EXTREF_KEY:
+ {
+ bool ext_ref = btrfs_fs_incompat(root->fs_info,
+ EXTENDED_IREF);
if (key.type == BTRFS_INODE_EXTREF_KEY && !ext_ref)
warning("root %llu EXTREF[%llu %llu] isn't supported",
root->objectid, key.objectid,
@@ -2001,6 +2001,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path,
mode);
err |= ret;
break;
+ }
case BTRFS_DIR_ITEM_KEY:
case BTRFS_DIR_INDEX_KEY:
if (!dir) {
@@ -2171,7 +2172,7 @@ static int process_one_leaf(struct btrfs_root *root, struct btrfs_path *path,
path->slots[0] = i;
again:
- err |= check_inode_item(root, path, ext_ref);
+ err |= check_inode_item(root, path);
/* modify cur since check_inode_item may change path */
cur = path->nodes[0];
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 04/10] btrfs-progs: Drop unused ext_ref parameter from process_one_leaf
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (2 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 03/10] btrfs-progs: Drop ext_ref argument from check_inode_item Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 05/10] btrfs-progs: Remove ext_ref param from check_fs_first_inode Nikolay Borisov
` (7 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
It's no longer used in the function so just remove it
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index e26e9bdf3bb3..34519f30a4aa 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -2141,7 +2141,7 @@ static int check_inode_item(struct btrfs_root *root, struct btrfs_path *path)
* Returns 0 No errors found
*/
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)
{
struct extent_buffer *cur = path->nodes[0];
struct btrfs_key key;
@@ -4031,7 +4031,7 @@ static int walk_down_tree(struct btrfs_trans_handle *trans,
ret = 0;
if (!check_all)
ret = process_one_leaf(root, path, nrefs,
- level, ext_ref);
+ level);
else
ret = check_leaf_items(trans, root, path,
nrefs, account_file_data);
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 05/10] btrfs-progs: Remove ext_ref param from check_fs_first_inode
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (3 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 04/10] btrfs-progs: Drop unused ext_ref parameter from process_one_leaf Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 06/10] btrfs-progs: Remove ext_ref param from walk_down_tree Nikolay Borisov
` (6 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
It's no longer use and can be dropped.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 34519f30a4aa..29c55e202f2b 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -4198,7 +4198,7 @@ static int repair_fs_first_inode(struct btrfs_root *root, int err)
* returns >0 means error
* returns <0 means fatal error
*/
-static int check_fs_first_inode(struct btrfs_root *root, unsigned int ext_ref)
+static int check_fs_first_inode(struct btrfs_root *root)
{
struct btrfs_path path;
struct btrfs_key key;
@@ -4290,7 +4290,7 @@ static int check_btrfs_root(struct btrfs_trans_handle *trans,
* the first inode item in the leaf, if inode item (256) is
* missing we will skip it forever.
*/
- ret = check_fs_first_inode(root, ext_ref);
+ ret = check_fs_first_inode(root);
if (ret < 0)
return ret;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 06/10] btrfs-progs: Remove ext_ref param from walk_down_tree
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (4 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 05/10] btrfs-progs: Remove ext_ref param from check_fs_first_inode Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 07/10] btrfs-progs: Drop ext_ref param from check_fs_first_inode Nikolay Borisov
` (5 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
It's no longer used so just remove it.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 29c55e202f2b..76365a214e34 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -3959,8 +3959,7 @@ static int check_leaf_items(struct btrfs_trans_handle *trans,
*/
static int walk_down_tree(struct btrfs_trans_handle *trans,
struct btrfs_root *root, struct btrfs_path *path,
- int *level, struct node_refs *nrefs, int ext_ref,
- int check_all)
+ int *level, struct node_refs *nrefs, int check_all)
{
enum btrfs_tree_block_status status;
u64 bytenr;
@@ -4318,7 +4317,7 @@ static int check_btrfs_root(struct btrfs_trans_handle *trans,
while (1) {
ret = walk_down_tree(trans, root, &path, &level, &nrefs,
- ext_ref, check_all);
+ check_all);
err |= !!ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 07/10] btrfs-progs: Drop ext_ref param from check_fs_first_inode
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (5 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 06/10] btrfs-progs: Remove ext_ref param from walk_down_tree Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 08/10] btrfs-progs: Drop ext_ref arument from check_fs_root Nikolay Borisov
` (4 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
It's no longer used in that function so can be dropped altogether.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index 76365a214e34..daa088c056b6 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -4263,7 +4263,6 @@ static int check_fs_first_inode(struct btrfs_root *root)
* blocks and integrity of fs tree items.
*
* @root: the root of the tree to be checked.
- * @ext_ref feature EXTENDED_IREF is enable or not.
* @account if NOT 0 means check the tree (including tree)'s treeblocks.
* otherwise means check fs tree(s) items relationship and
* @root MUST be a fs tree root.
@@ -4271,8 +4270,7 @@ static int check_fs_first_inode(struct btrfs_root *root)
* Returns not 0 represents error.
*/
static int check_btrfs_root(struct btrfs_trans_handle *trans,
- struct btrfs_root *root, unsigned int ext_ref,
- int check_all)
+ struct btrfs_root *root, int check_all)
{
struct btrfs_path path;
struct node_refs nrefs;
@@ -4352,7 +4350,7 @@ static int check_btrfs_root(struct btrfs_trans_handle *trans,
static int check_fs_root(struct btrfs_root *root, unsigned int ext_ref)
{
reset_cached_block_groups(root->fs_info);
- return check_btrfs_root(NULL, root, ext_ref, 0);
+ return check_btrfs_root(NULL, root, 0);
}
/*
@@ -4556,11 +4554,11 @@ int check_chunks_and_extents_lowmem(struct btrfs_fs_info *fs_info)
}
root1 = root->fs_info->chunk_root;
- ret = check_btrfs_root(trans, root1, 0, 1);
+ ret = check_btrfs_root(trans, root1, 1);
err |= ret;
root1 = root->fs_info->tree_root;
- ret = check_btrfs_root(trans, root1, 0, 1);
+ ret = check_btrfs_root(trans, root1, 1);
err |= ret;
btrfs_init_path(&path);
@@ -4591,7 +4589,7 @@ int check_chunks_and_extents_lowmem(struct btrfs_fs_info *fs_info)
goto next;
}
- ret = check_btrfs_root(trans, cur_root, 0, 1);
+ ret = check_btrfs_root(trans, cur_root, 1);
err |= ret;
if (key.objectid == BTRFS_TREE_RELOC_OBJECTID)
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 08/10] btrfs-progs: Drop ext_ref arument from check_fs_root
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (6 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 07/10] btrfs-progs: Drop ext_ref param from check_fs_first_inode Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 09/10] btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem Nikolay Borisov
` (3 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
It's no longer used so just remove it.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index daa088c056b6..eb6ca6453dc5 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -4342,12 +4342,11 @@ static int check_btrfs_root(struct btrfs_trans_handle *trans,
* Iterate all items in the tree and call check_inode_item() to check.
*
* @root: the root of the tree to be checked.
- * @ext_ref: the EXTENDED_IREF feature
*
* Return 0 if no error found.
* Return <0 for error.
*/
-static int check_fs_root(struct btrfs_root *root, unsigned int ext_ref)
+static int check_fs_root(struct btrfs_root *root)
{
reset_cached_block_groups(root->fs_info);
return check_btrfs_root(NULL, root, 0);
@@ -4503,7 +4502,7 @@ int check_fs_roots_lowmem(struct btrfs_fs_info *fs_info)
goto next;
}
- ret = check_fs_root(cur_root, ext_ref);
+ ret = check_fs_root(cur_root);
err |= ret;
if (key.objectid == BTRFS_TREE_RELOC_OBJECTID)
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 09/10] btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (7 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 08/10] btrfs-progs: Drop ext_ref arument from check_fs_root Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:19 ` [PATCH 10/10] btrfs-progs: Make __btrfs_fs_incompat return bool Nikolay Borisov
` (2 subsequent siblings)
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
All real consumers of that variable have inlined the checks since they
are simple enough. So just remove it.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
check/mode-lowmem.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/check/mode-lowmem.c b/check/mode-lowmem.c
index eb6ca6453dc5..4f463d4f726f 100644
--- a/check/mode-lowmem.c
+++ b/check/mode-lowmem.c
@@ -4458,13 +4458,10 @@ int check_fs_roots_lowmem(struct btrfs_fs_info *fs_info)
struct btrfs_path path;
struct btrfs_key key;
struct extent_buffer *node;
- unsigned int ext_ref;
int slot;
int ret;
int err = 0;
- ext_ref = btrfs_fs_incompat(fs_info, EXTENDED_IREF);
-
btrfs_init_path(&path);
key.objectid = BTRFS_FS_TREE_OBJECTID;
key.offset = 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 10/10] btrfs-progs: Make __btrfs_fs_incompat return bool
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (8 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 09/10] btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem Nikolay Borisov
@ 2018-03-27 7:19 ` Nikolay Borisov
2018-03-27 7:38 ` [PATCH 00/10] Simplify function interfaces Su Yue
2018-05-02 5:50 ` Nikolay Borisov
11 siblings, 0 replies; 14+ messages in thread
From: Nikolay Borisov @ 2018-03-27 7:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: Nikolay Borisov
First this function does the '!!' trick to turn its value into a bool,
yet the return type is int. Second, the kernel counterpart also returns
bool.
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
ctree.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ctree.h b/ctree.h
index fa861ba0b4c3..1fafe7f90837 100644
--- a/ctree.h
+++ b/ctree.h
@@ -2460,7 +2460,7 @@ static inline u32 btrfs_file_extent_inline_len(struct extent_buffer *eb,
#define btrfs_fs_incompat(fs_info, opt) \
__btrfs_fs_incompat((fs_info), BTRFS_FEATURE_INCOMPAT_##opt)
-static inline int __btrfs_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag)
+static inline bool __btrfs_fs_incompat(struct btrfs_fs_info *fs_info, u64 flag)
{
struct btrfs_super_block *disk_super;
disk_super = fs_info->super_copy;
--
2.7.4
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 00/10] Simplify function interfaces
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (9 preceding siblings ...)
2018-03-27 7:19 ` [PATCH 10/10] btrfs-progs: Make __btrfs_fs_incompat return bool Nikolay Borisov
@ 2018-03-27 7:38 ` Su Yue
2018-05-02 5:50 ` Nikolay Borisov
11 siblings, 0 replies; 14+ messages in thread
From: Su Yue @ 2018-03-27 7:38 UTC (permalink / raw)
To: Nikolay Borisov, linux-btrfs
On 03/27/2018 03:19 PM, Nikolay Borisov wrote:
> A bunch of functions in lowmem mode take an 'ext_ref' parameter only to pass it
> down the call chain where it eventually is consumed. Turns out the functions
> which actually check the parameter are find_inode_ref and check_inode_item, the
> are only passing it down to them. At the same time those functions can get a
> reference to fs_info and do the check in them at the appropriate time.
>
> This patchset cleanups the interface of various function by dropping the
> ext_ref argument and moving the actual query of the EXTREF feature closer to
> where it's being used.
>
> The final patch just changes signature of __btrfs_fs_incompat to better match
> the logic of the code and be identical to its kernel counterpart. All in all
> this series doesn't introduce any functional changes per-se.
>
> Nikolay Borisov (10):
> btrfs-progs: Drop ext_ref parameter from find_inode_ref
> btrfs-progs: Drop ext_ref param from check_dir_item
> btrfs-progs: Drop ext_ref argument from check_inode_item
> btrfs-progs: Drop unused ext_ref parameter from process_one_leaf
> btrfs-progs: Remove ext_ref param from check_fs_first_inode
> btrfs-progs: Remove ext_ref param from walk_down_tree
> btrfs-progs: Drop ext_ref param from check_fs_first_inode
> btrfs-progs: Drop ext_ref arument from check_fs_root
> btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem
> btrfs-progs: Make __btrfs_fs_incompat return bool
>
Nice work.
For all,
Reviewed-by: Su Yue <suy.fnst@cn.fujitsu.com>
> check/mode-lowmem.c | 63 +++++++++++++++++++++++------------------------------
> ctree.h | 2 +-
> 2 files changed, 28 insertions(+), 37 deletions(-)
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 00/10] Simplify function interfaces
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
` (10 preceding siblings ...)
2018-03-27 7:38 ` [PATCH 00/10] Simplify function interfaces Su Yue
@ 2018-05-02 5:50 ` Nikolay Borisov
2018-05-09 11:34 ` David Sterba
11 siblings, 1 reply; 14+ messages in thread
From: Nikolay Borisov @ 2018-05-02 5:50 UTC (permalink / raw)
To: linux-btrfs
On 27.03.2018 10:19, Nikolay Borisov wrote:
> A bunch of functions in lowmem mode take an 'ext_ref' parameter only to pass it
> down the call chain where it eventually is consumed. Turns out the functions
> which actually check the parameter are find_inode_ref and check_inode_item, the
> are only passing it down to them. At the same time those functions can get a
> reference to fs_info and do the check in them at the appropriate time.
>
> This patchset cleanups the interface of various function by dropping the
> ext_ref argument and moving the actual query of the EXTREF feature closer to
> where it's being used.
>
> The final patch just changes signature of __btrfs_fs_incompat to better match
> the logic of the code and be identical to its kernel counterpart. All in all
> this series doesn't introduce any functional changes per-se.
>
> Nikolay Borisov (10):
> btrfs-progs: Drop ext_ref parameter from find_inode_ref
> btrfs-progs: Drop ext_ref param from check_dir_item
> btrfs-progs: Drop ext_ref argument from check_inode_item
> btrfs-progs: Drop unused ext_ref parameter from process_one_leaf
> btrfs-progs: Remove ext_ref param from check_fs_first_inode
> btrfs-progs: Remove ext_ref param from walk_down_tree
> btrfs-progs: Drop ext_ref param from check_fs_first_inode
> btrfs-progs: Drop ext_ref arument from check_fs_root
> btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem
> btrfs-progs: Make __btrfs_fs_incompat return bool
>
> check/mode-lowmem.c | 63 +++++++++++++++++++++++------------------------------
> ctree.h | 2 +-
> 2 files changed, 28 insertions(+), 37 deletions(-)
Ping
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 00/10] Simplify function interfaces
2018-05-02 5:50 ` Nikolay Borisov
@ 2018-05-09 11:34 ` David Sterba
0 siblings, 0 replies; 14+ messages in thread
From: David Sterba @ 2018-05-09 11:34 UTC (permalink / raw)
To: Nikolay Borisov; +Cc: linux-btrfs
On Wed, May 02, 2018 at 08:50:54AM +0300, Nikolay Borisov wrote:
> On 27.03.2018 10:19, Nikolay Borisov wrote:
> > A bunch of functions in lowmem mode take an 'ext_ref' parameter only to pass it
> > down the call chain where it eventually is consumed. Turns out the functions
> > which actually check the parameter are find_inode_ref and check_inode_item, the
> > are only passing it down to them. At the same time those functions can get a
> > reference to fs_info and do the check in them at the appropriate time.
> >
> > This patchset cleanups the interface of various function by dropping the
> > ext_ref argument and moving the actual query of the EXTREF feature closer to
> > where it's being used.
> >
> > The final patch just changes signature of __btrfs_fs_incompat to better match
> > the logic of the code and be identical to its kernel counterpart. All in all
> > this series doesn't introduce any functional changes per-se.
> >
> > Nikolay Borisov (10):
> > btrfs-progs: Drop ext_ref parameter from find_inode_ref
> > btrfs-progs: Drop ext_ref param from check_dir_item
> > btrfs-progs: Drop ext_ref argument from check_inode_item
> > btrfs-progs: Drop unused ext_ref parameter from process_one_leaf
> > btrfs-progs: Remove ext_ref param from check_fs_first_inode
> > btrfs-progs: Remove ext_ref param from walk_down_tree
> > btrfs-progs: Drop ext_ref param from check_fs_first_inode
> > btrfs-progs: Drop ext_ref arument from check_fs_root
> > btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem
> > btrfs-progs: Make __btrfs_fs_incompat return bool
> >
> > check/mode-lowmem.c | 63 +++++++++++++++++++++++------------------------------
> > ctree.h | 2 +-
> > 2 files changed, 28 insertions(+), 37 deletions(-)
>
> Ping
Applied. Please add the subsystem prefix, like "btrfs-progs: check: ...".
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2018-05-09 11:37 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-27 7:19 [PATCH 00/10] Simplify function interfaces Nikolay Borisov
2018-03-27 7:19 ` [PATCH 01/10] btrfs-progs: Drop ext_ref parameter from find_inode_ref Nikolay Borisov
2018-03-27 7:19 ` [PATCH 02/10] btrfs-progs: Drop ext_ref param from check_dir_item Nikolay Borisov
2018-03-27 7:19 ` [PATCH 03/10] btrfs-progs: Drop ext_ref argument from check_inode_item Nikolay Borisov
2018-03-27 7:19 ` [PATCH 04/10] btrfs-progs: Drop unused ext_ref parameter from process_one_leaf Nikolay Borisov
2018-03-27 7:19 ` [PATCH 05/10] btrfs-progs: Remove ext_ref param from check_fs_first_inode Nikolay Borisov
2018-03-27 7:19 ` [PATCH 06/10] btrfs-progs: Remove ext_ref param from walk_down_tree Nikolay Borisov
2018-03-27 7:19 ` [PATCH 07/10] btrfs-progs: Drop ext_ref param from check_fs_first_inode Nikolay Borisov
2018-03-27 7:19 ` [PATCH 08/10] btrfs-progs: Drop ext_ref arument from check_fs_root Nikolay Borisov
2018-03-27 7:19 ` [PATCH 09/10] btrfs-progs: Remove ext_ref local variable from check_fs_roots_lowmem Nikolay Borisov
2018-03-27 7:19 ` [PATCH 10/10] btrfs-progs: Make __btrfs_fs_incompat return bool Nikolay Borisov
2018-03-27 7:38 ` [PATCH 00/10] Simplify function interfaces Su Yue
2018-05-02 5:50 ` Nikolay Borisov
2018-05-09 11:34 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).