* [PATCH 00/22] Return variable name unifications
@ 2025-05-30 16:16 David Sterba
2025-05-30 16:17 ` [PATCH 01/22] btrfs: rename err to ret2 in resolve_indirect_refs() David Sterba
` (22 more replies)
0 siblings, 23 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:16 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Simple conversions, 'ret' from 'err, or the secondary return value ret2.
David Sterba (22):
btrfs: rename err to ret2 in resolve_indirect_refs()
btrfs: rename err to ret2 in read_block_for_search()
btrfs: rename err to ret2 in search_leaf()
btrfs: rename err to ret2 in btrfs_search_slot()
btrfs: rename err to ret2 in btrfs_search_old_slot()
btrfs: rename err to ret2 in btrfs_setsize()
btrfs: rename err to ret2 in btrfs_add_link()
btrfs: rename err to ret2 in btrfs_truncate_inode_items()
btrfs: rename err to ret in btrfs_try_lock_extent_bits()
btrfs: rename err to ret in btrfs_lock_extent_bits()
btrfs: rename err to ret in btrfs_alloc_from_bitmap()
btrfs: rename err to ret in btrfs_init_inode_security()
btrfs: rename err to ret in btrfs_setattr()
btrfs: rename err to ret in btrfs_link()
btrfs: rename err to ret in btrfs_symlink()
btrfs: rename err to ret in calc_pct_ratio()
btrfs: rename err to ret in btrfs_fill_super()
btrfs: rename err to ret in quota_override_store()
btrfs: rename err to ret in btrfs_wait_extents()
btrfs: rename err to ret in btrfs_wait_tree_log_extents()
btrfs: rename err to ret in btrfs_create_common()
btrfs: rename err to ret in scrub_submit_extent_sector_read()
fs/btrfs/backref.c | 10 +--
fs/btrfs/ctree.c | 76 ++++++++++----------
fs/btrfs/extent-io-tree.c | 17 +++--
fs/btrfs/free-space-cache.c | 6 +-
fs/btrfs/inode-item.c | 11 ++-
fs/btrfs/inode.c | 136 ++++++++++++++++++------------------
fs/btrfs/scrub.c | 8 +--
fs/btrfs/space-info.c | 6 +-
fs/btrfs/super.c | 24 +++----
fs/btrfs/sysfs.c | 8 +--
fs/btrfs/transaction.c | 20 +++---
11 files changed, 158 insertions(+), 164 deletions(-)
--
2.47.1
^ permalink raw reply [flat|nested] 25+ messages in thread
* [PATCH 01/22] btrfs: rename err to ret2 in resolve_indirect_refs()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 02/22] btrfs: rename err to ret2 in read_block_for_search() David Sterba
` (21 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way, move the variable to
the closest scope.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/backref.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c
index a4e0e2c3ea7d..bebef4bd0c65 100644
--- a/fs/btrfs/backref.c
+++ b/fs/btrfs/backref.c
@@ -733,7 +733,6 @@ static int resolve_indirect_refs(struct btrfs_backref_walk_ctx *ctx,
struct preftrees *preftrees,
struct share_check *sc)
{
- int err;
int ret = 0;
struct ulist *parents;
struct ulist_node *node;
@@ -752,6 +751,7 @@ static int resolve_indirect_refs(struct btrfs_backref_walk_ctx *ctx,
*/
while ((rnode = rb_first_cached(&preftrees->indirect.root))) {
struct prelim_ref *ref;
+ int ret2;
ref = rb_entry(rnode, struct prelim_ref, rbnode);
if (WARN(ref->parent,
@@ -773,18 +773,18 @@ static int resolve_indirect_refs(struct btrfs_backref_walk_ctx *ctx,
ret = BACKREF_FOUND_SHARED;
goto out;
}
- err = resolve_indirect_ref(ctx, path, preftrees, ref, parents);
+ ret2 = resolve_indirect_ref(ctx, path, preftrees, ref, parents);
/*
* we can only tolerate ENOENT,otherwise,we should catch error
* and return directly.
*/
- if (err == -ENOENT) {
+ if (ret2 == -ENOENT) {
prelim_ref_insert(ctx->fs_info, &preftrees->direct, ref,
NULL);
continue;
- } else if (err) {
+ } else if (ret2) {
free_pref(ref);
- ret = err;
+ ret = ret2;
goto out;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 02/22] btrfs: rename err to ret2 in read_block_for_search()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
2025-05-30 16:17 ` [PATCH 01/22] btrfs: rename err to ret2 in resolve_indirect_refs() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 03/22] btrfs: rename err to ret2 in search_leaf() David Sterba
` (20 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/ctree.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index a5ee6ce312cf..06dc7731c54a 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1457,8 +1457,8 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
u64 blocknr;
struct extent_buffer *tmp = NULL;
int ret = 0;
+ int ret2;
int parent_level;
- int err;
bool read_tmp = false;
bool tmp_locked = false;
bool path_released = false;
@@ -1516,9 +1516,9 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
}
/* Now we're allowed to do a blocking uptodate check. */
- err = btrfs_read_extent_buffer(tmp, &check);
- if (err) {
- ret = err;
+ ret2 = btrfs_read_extent_buffer(tmp, &check);
+ if (ret2) {
+ ret = ret2;
goto out;
}
@@ -1559,9 +1559,9 @@ read_block_for_search(struct btrfs_root *root, struct btrfs_path *p,
}
/* Now we're allowed to do a blocking uptodate check. */
- err = btrfs_read_extent_buffer(tmp, &check);
- if (err) {
- ret = err;
+ ret2 = btrfs_read_extent_buffer(tmp, &check);
+ if (ret2) {
+ ret = ret2;
goto out;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 03/22] btrfs: rename err to ret2 in search_leaf()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
2025-05-30 16:17 ` [PATCH 01/22] btrfs: rename err to ret2 in resolve_indirect_refs() David Sterba
2025-05-30 16:17 ` [PATCH 02/22] btrfs: rename err to ret2 in read_block_for_search() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 04/22] btrfs: rename err to ret2 in btrfs_search_slot() David Sterba
` (19 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/ctree.c | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 06dc7731c54a..0f0a69c8259d 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1939,15 +1939,14 @@ static int search_leaf(struct btrfs_trans_handle *trans,
ASSERT(leaf_free_space >= 0);
if (leaf_free_space < ins_len) {
- int err;
+ int ret2;
- err = split_leaf(trans, root, key, path, ins_len,
- (ret == 0));
- ASSERT(err <= 0);
- if (WARN_ON(err > 0))
- err = -EUCLEAN;
- if (err)
- ret = err;
+ ret2 = split_leaf(trans, root, key, path, ins_len, (ret == 0));
+ ASSERT(ret2 <= 0);
+ if (WARN_ON(ret2 > 0))
+ ret2 = -EUCLEAN;
+ if (ret2)
+ ret = ret2;
}
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 04/22] btrfs: rename err to ret2 in btrfs_search_slot()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (2 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 03/22] btrfs: rename err to ret2 in search_leaf() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 05/22] btrfs: rename err to ret2 in btrfs_search_old_slot() David Sterba
` (18 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way, move the variable to
the closest scope.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/ctree.c | 37 ++++++++++++++++++-------------------
1 file changed, 18 insertions(+), 19 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 0f0a69c8259d..ce4e9055153a 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -1992,7 +1992,6 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
struct extent_buffer *b;
int slot;
int ret;
- int err;
int level;
int lowest_unlock = 1;
/* everything at write_lock_level or lower must be write locked */
@@ -2063,6 +2062,7 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
while (b) {
int dec = 0;
+ int ret2;
level = btrfs_header_level(b);
@@ -2091,16 +2091,15 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
}
if (last_level)
- err = btrfs_cow_block(trans, root, b, NULL, 0,
- &b,
- BTRFS_NESTING_COW);
+ ret2 = btrfs_cow_block(trans, root, b, NULL, 0,
+ &b, BTRFS_NESTING_COW);
else
- err = btrfs_cow_block(trans, root, b,
- p->nodes[level + 1],
- p->slots[level + 1], &b,
- BTRFS_NESTING_COW);
- if (err) {
- ret = err;
+ ret2 = btrfs_cow_block(trans, root, b,
+ p->nodes[level + 1],
+ p->slots[level + 1], &b,
+ BTRFS_NESTING_COW);
+ if (ret2) {
+ ret = ret2;
goto done;
}
}
@@ -2148,12 +2147,12 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
slot--;
}
p->slots[level] = slot;
- err = setup_nodes_for_search(trans, root, p, b, level, ins_len,
- &write_lock_level);
- if (err == -EAGAIN)
+ ret2 = setup_nodes_for_search(trans, root, p, b, level, ins_len,
+ &write_lock_level);
+ if (ret2 == -EAGAIN)
goto again;
- if (err) {
- ret = err;
+ if (ret2) {
+ ret = ret2;
goto done;
}
b = p->nodes[level];
@@ -2179,11 +2178,11 @@ int btrfs_search_slot(struct btrfs_trans_handle *trans, struct btrfs_root *root,
goto done;
}
- err = read_block_for_search(root, p, &b, slot, key);
- if (err == -EAGAIN && !p->nowait)
+ ret2 = read_block_for_search(root, p, &b, slot, key);
+ if (ret2 == -EAGAIN && !p->nowait)
goto again;
- if (err) {
- ret = err;
+ if (ret2) {
+ ret = ret2;
goto done;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 05/22] btrfs: rename err to ret2 in btrfs_search_old_slot()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (3 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 04/22] btrfs: rename err to ret2 in btrfs_search_slot() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 06/22] btrfs: rename err to ret2 in btrfs_setsize() David Sterba
` (17 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way, move the variable to
the closest scope.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/ctree.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index ce4e9055153a..cd5797a465da 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2245,7 +2245,6 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
struct extent_buffer *b;
int slot;
int ret;
- int err;
int level;
int lowest_unlock = 1;
u8 lowest_level = 0;
@@ -2270,6 +2269,7 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
while (b) {
int dec = 0;
+ int ret2;
level = btrfs_header_level(b);
p->nodes[level] = b;
@@ -2305,11 +2305,11 @@ int btrfs_search_old_slot(struct btrfs_root *root, const struct btrfs_key *key,
goto done;
}
- err = read_block_for_search(root, p, &b, slot, key);
- if (err == -EAGAIN && !p->nowait)
+ ret2 = read_block_for_search(root, p, &b, slot, key);
+ if (ret2 == -EAGAIN && !p->nowait)
goto again;
- if (err) {
- ret = err;
+ if (ret2) {
+ ret = ret2;
goto done;
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 06/22] btrfs: rename err to ret2 in btrfs_setsize()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (4 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 05/22] btrfs: rename err to ret2 in btrfs_search_old_slot() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 07/22] btrfs: rename err to ret2 in btrfs_add_link() David Sterba
` (16 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 7074f975c033..2af381f2f5ed 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5256,7 +5256,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
ret = btrfs_truncate(BTRFS_I(inode), newsize == oldsize);
if (ret && inode->i_nlink) {
- int err;
+ int ret2;
/*
* Truncate failed, so fix up the in-memory size. We
@@ -5264,9 +5264,9 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
* wait for disk_i_size to be stable and then update the
* in-memory size to match.
*/
- err = btrfs_wait_ordered_range(BTRFS_I(inode), 0, (u64)-1);
- if (err)
- return err;
+ ret2 = btrfs_wait_ordered_range(BTRFS_I(inode), 0, (u64)-1);
+ if (ret2)
+ return ret2;
i_size_write(inode, BTRFS_I(inode)->disk_i_size);
}
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 07/22] btrfs: rename err to ret2 in btrfs_add_link()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (5 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 06/22] btrfs: rename err to ret2 in btrfs_setsize() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 08/22] btrfs: rename err to ret2 in btrfs_truncate_inode_items() David Sterba
` (15 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 2af381f2f5ed..36a11a832528 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6707,20 +6707,19 @@ int btrfs_add_link(struct btrfs_trans_handle *trans,
fail_dir_item:
if (unlikely(ino == BTRFS_FIRST_FREE_OBJECTID)) {
u64 local_index;
- int err;
- err = btrfs_del_root_ref(trans, key.objectid,
- btrfs_root_id(root), parent_ino,
- &local_index, name);
- if (err)
- btrfs_abort_transaction(trans, err);
+ int ret2;
+
+ ret2 = btrfs_del_root_ref(trans, key.objectid, btrfs_root_id(root),
+ parent_ino, &local_index, name);
+ if (ret2)
+ btrfs_abort_transaction(trans, ret2);
} else if (add_backref) {
u64 local_index;
- int err;
+ int ret2;
- err = btrfs_del_inode_ref(trans, root, name, ino, parent_ino,
- &local_index);
- if (err)
- btrfs_abort_transaction(trans, err);
+ ret2 = btrfs_del_inode_ref(trans, root, name, ino, parent_ino, &local_index);
+ if (ret2)
+ btrfs_abort_transaction(trans, ret2);
}
/* Return the original error code */
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 08/22] btrfs: rename err to ret2 in btrfs_truncate_inode_items()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (6 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 07/22] btrfs: rename err to ret2 in btrfs_add_link() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 09/22] btrfs: rename err to ret in btrfs_try_lock_extent_bits() David Sterba
` (14 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode-item.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/fs/btrfs/inode-item.c b/fs/btrfs/inode-item.c
index a61c3540d67b..c62624e643a1 100644
--- a/fs/btrfs/inode-item.c
+++ b/fs/btrfs/inode-item.c
@@ -720,13 +720,12 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans,
}
out:
if (ret >= 0 && pending_del_nr) {
- int err;
+ int ret2;
- err = btrfs_del_items(trans, root, path, pending_del_slot,
- pending_del_nr);
- if (err) {
- btrfs_abort_transaction(trans, err);
- ret = err;
+ ret2 = btrfs_del_items(trans, root, path, pending_del_slot, pending_del_nr);
+ if (ret2) {
+ btrfs_abort_transaction(trans, ret2);
+ ret = ret2;
}
}
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 09/22] btrfs: rename err to ret in btrfs_try_lock_extent_bits()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (7 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 08/22] btrfs: rename err to ret2 in btrfs_truncate_inode_items() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:17 ` [PATCH 10/22] btrfs: rename err to ret in btrfs_lock_extent_bits() David Sterba
` (13 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/extent-io-tree.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
index b1b96eb5f64e..0f4c0b234573 100644
--- a/fs/btrfs/extent-io-tree.c
+++ b/fs/btrfs/extent-io-tree.c
@@ -1882,12 +1882,11 @@ int btrfs_clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 e
bool btrfs_try_lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end,
u32 bits, struct extent_state **cached)
{
- int err;
+ int ret;
u64 failed_start;
- err = set_extent_bit(tree, start, end, bits, &failed_start, NULL,
- cached, NULL);
- if (err == -EEXIST) {
+ ret = set_extent_bit(tree, start, end, bits, &failed_start, NULL, cached, NULL);
+ if (ret == -EEXIST) {
if (failed_start > start)
btrfs_clear_extent_bit(tree, start, failed_start - 1,
bits, cached);
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 10/22] btrfs: rename err to ret in btrfs_lock_extent_bits()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (8 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 09/22] btrfs: rename err to ret in btrfs_try_lock_extent_bits() David Sterba
@ 2025-05-30 16:17 ` David Sterba
2025-05-30 16:18 ` [PATCH 11/22] btrfs: rename err to ret in btrfs_alloc_from_bitmap() David Sterba
` (12 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:17 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/extent-io-tree.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/extent-io-tree.c b/fs/btrfs/extent-io-tree.c
index 0f4c0b234573..84da01996336 100644
--- a/fs/btrfs/extent-io-tree.c
+++ b/fs/btrfs/extent-io-tree.c
@@ -1903,21 +1903,21 @@ int btrfs_lock_extent_bits(struct extent_io_tree *tree, u64 start, u64 end, u32
struct extent_state **cached_state)
{
struct extent_state *failed_state = NULL;
- int err;
+ int ret;
u64 failed_start;
- err = set_extent_bit(tree, start, end, bits, &failed_start,
+ ret = set_extent_bit(tree, start, end, bits, &failed_start,
&failed_state, cached_state, NULL);
- while (err == -EEXIST) {
+ while (ret == -EEXIST) {
if (failed_start != start)
btrfs_clear_extent_bit(tree, start, failed_start - 1,
bits, cached_state);
wait_extent_bit(tree, failed_start, end, bits, &failed_state);
- err = set_extent_bit(tree, start, end, bits, &failed_start,
+ ret = set_extent_bit(tree, start, end, bits, &failed_start,
&failed_state, cached_state, NULL);
}
- return err;
+ return ret;
}
/*
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 11/22] btrfs: rename err to ret in btrfs_alloc_from_bitmap()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (9 preceding siblings ...)
2025-05-30 16:17 ` [PATCH 10/22] btrfs: rename err to ret in btrfs_lock_extent_bits() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 12/22] btrfs: rename err to ret in btrfs_init_inode_security() David Sterba
` (11 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/free-space-cache.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index 4b34ea1f01c2..efd21a28570c 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -3192,7 +3192,7 @@ static u64 btrfs_alloc_from_bitmap(struct btrfs_block_group *block_group,
u64 *max_extent_size)
{
struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;
- int err;
+ int ret2;
u64 search_start = cluster->window_start;
u64 search_bytes = bytes;
u64 ret = 0;
@@ -3200,8 +3200,8 @@ static u64 btrfs_alloc_from_bitmap(struct btrfs_block_group *block_group,
search_start = min_start;
search_bytes = bytes;
- err = search_bitmap(ctl, entry, &search_start, &search_bytes, true);
- if (err) {
+ ret2 = search_bitmap(ctl, entry, &search_start, &search_bytes, true);
+ if (ret2) {
*max_extent_size = max(get_max_extent_size(entry),
*max_extent_size);
return 0;
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 12/22] btrfs: rename err to ret in btrfs_init_inode_security()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (10 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 11/22] btrfs: rename err to ret in btrfs_alloc_from_bitmap() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 13/22] btrfs: rename err to ret in btrfs_setattr() David Sterba
` (10 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 36a11a832528..0a2357f979f3 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -423,18 +423,18 @@ static int btrfs_dirty_inode(struct btrfs_inode *inode);
static int btrfs_init_inode_security(struct btrfs_trans_handle *trans,
struct btrfs_new_inode_args *args)
{
- int err;
+ int ret;
if (args->default_acl) {
- err = __btrfs_set_acl(trans, args->inode, args->default_acl,
+ ret = __btrfs_set_acl(trans, args->inode, args->default_acl,
ACL_TYPE_DEFAULT);
- if (err)
- return err;
+ if (ret)
+ return ret;
}
if (args->acl) {
- err = __btrfs_set_acl(trans, args->inode, args->acl, ACL_TYPE_ACCESS);
- if (err)
- return err;
+ ret = __btrfs_set_acl(trans, args->inode, args->acl, ACL_TYPE_ACCESS);
+ if (ret)
+ return ret;
}
if (!args->default_acl && !args->acl)
cache_no_acl(args->inode);
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 13/22] btrfs: rename err to ret in btrfs_setattr()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (11 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 12/22] btrfs: rename err to ret in btrfs_init_inode_security() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 14/22] btrfs: rename err to ret in btrfs_link() David Sterba
` (9 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 0a2357f979f3..9d200f4246ba 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5279,31 +5279,31 @@ static int btrfs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
{
struct inode *inode = d_inode(dentry);
struct btrfs_root *root = BTRFS_I(inode)->root;
- int err;
+ int ret;
if (btrfs_root_readonly(root))
return -EROFS;
- err = setattr_prepare(idmap, dentry, attr);
- if (err)
- return err;
+ ret = setattr_prepare(idmap, dentry, attr);
+ if (ret)
+ return ret;
if (S_ISREG(inode->i_mode) && (attr->ia_valid & ATTR_SIZE)) {
- err = btrfs_setsize(inode, attr);
- if (err)
- return err;
+ ret = btrfs_setsize(inode, attr);
+ if (ret)
+ return ret;
}
if (attr->ia_valid) {
setattr_copy(idmap, inode, attr);
inode_inc_iversion(inode);
- err = btrfs_dirty_inode(BTRFS_I(inode));
+ ret = btrfs_dirty_inode(BTRFS_I(inode));
- if (!err && attr->ia_valid & ATTR_MODE)
- err = posix_acl_chmod(idmap, dentry, inode->i_mode);
+ if (!ret && attr->ia_valid & ATTR_MODE)
+ ret = posix_acl_chmod(idmap, dentry, inode->i_mode);
}
- return err;
+ return ret;
}
/*
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 14/22] btrfs: rename err to ret in btrfs_link()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (12 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 13/22] btrfs: rename err to ret in btrfs_setattr() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 15/22] btrfs: rename err to ret in btrfs_symlink() David Sterba
` (8 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 9d200f4246ba..fd76c551ae57 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6802,7 +6802,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
struct btrfs_fs_info *fs_info = inode_to_fs_info(inode);
struct fscrypt_name fname;
u64 index;
- int err;
+ int ret;
int drop_inode = 0;
/* do not allow sys_link's with other subvols of the same device */
@@ -6812,12 +6812,12 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
if (inode->i_nlink >= BTRFS_LINK_MAX)
return -EMLINK;
- err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &fname);
- if (err)
+ ret = fscrypt_setup_filename(dir, &dentry->d_name, 0, &fname);
+ if (ret)
goto fail;
- err = btrfs_set_inode_index(BTRFS_I(dir), &index);
- if (err)
+ ret = btrfs_set_inode_index(BTRFS_I(dir), &index);
+ if (ret)
goto fail;
/*
@@ -6828,7 +6828,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
*/
trans = btrfs_start_transaction(root, inode->i_nlink ? 5 : 6);
if (IS_ERR(trans)) {
- err = PTR_ERR(trans);
+ ret = PTR_ERR(trans);
trans = NULL;
goto fail;
}
@@ -6841,24 +6841,24 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
ihold(inode);
set_bit(BTRFS_INODE_COPY_EVERYTHING, &BTRFS_I(inode)->runtime_flags);
- err = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
+ ret = btrfs_add_link(trans, BTRFS_I(dir), BTRFS_I(inode),
&fname.disk_name, 1, index);
- if (err) {
+ if (ret) {
drop_inode = 1;
} else {
struct dentry *parent = dentry->d_parent;
- err = btrfs_update_inode(trans, BTRFS_I(inode));
- if (err)
+ ret = btrfs_update_inode(trans, BTRFS_I(inode));
+ if (ret)
goto fail;
if (inode->i_nlink == 1) {
/*
* If new hard link count is 1, it's a file created
* with open(2) O_TMPFILE flag.
*/
- err = btrfs_orphan_del(trans, BTRFS_I(inode));
- if (err)
+ ret = btrfs_orphan_del(trans, BTRFS_I(inode));
+ if (ret)
goto fail;
}
d_instantiate(dentry, inode);
@@ -6874,7 +6874,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
iput(inode);
}
btrfs_btree_balance_dirty(fs_info);
- return err;
+ return ret;
}
static struct dentry *btrfs_mkdir(struct mnt_idmap *idmap, struct inode *dir,
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 15/22] btrfs: rename err to ret in btrfs_symlink()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (13 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 14/22] btrfs: rename err to ret in btrfs_link() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 16/22] btrfs: rename err to ret in calc_pct_ratio() David Sterba
` (7 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 29 ++++++++++++++---------------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index fd76c551ae57..a91ee8155376 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8779,7 +8779,7 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
.dentry = dentry,
};
unsigned int trans_num_items;
- int err;
+ int ret;
int name_len;
int datasize;
unsigned long ptr;
@@ -8806,26 +8806,26 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
inode_set_bytes(inode, name_len);
new_inode_args.inode = inode;
- err = btrfs_new_inode_prepare(&new_inode_args, &trans_num_items);
- if (err)
+ ret = btrfs_new_inode_prepare(&new_inode_args, &trans_num_items);
+ if (ret)
goto out_inode;
/* 1 additional item for the inline extent */
trans_num_items++;
trans = btrfs_start_transaction(root, trans_num_items);
if (IS_ERR(trans)) {
- err = PTR_ERR(trans);
+ ret = PTR_ERR(trans);
goto out_new_inode_args;
}
- err = btrfs_create_new_inode(trans, &new_inode_args);
- if (err)
+ ret = btrfs_create_new_inode(trans, &new_inode_args);
+ if (ret)
goto out;
path = btrfs_alloc_path();
if (!path) {
- err = -ENOMEM;
- btrfs_abort_transaction(trans, err);
+ ret = -ENOMEM;
+ btrfs_abort_transaction(trans, ret);
discard_new_inode(inode);
inode = NULL;
goto out;
@@ -8834,10 +8834,9 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
key.type = BTRFS_EXTENT_DATA_KEY;
key.offset = 0;
datasize = btrfs_file_extent_calc_inline_size(name_len);
- err = btrfs_insert_empty_item(trans, root, path, &key,
- datasize);
- if (err) {
- btrfs_abort_transaction(trans, err);
+ ret = btrfs_insert_empty_item(trans, root, path, &key, datasize);
+ if (ret) {
+ btrfs_abort_transaction(trans, ret);
btrfs_free_path(path);
discard_new_inode(inode);
inode = NULL;
@@ -8859,16 +8858,16 @@ static int btrfs_symlink(struct mnt_idmap *idmap, struct inode *dir,
btrfs_free_path(path);
d_instantiate_new(dentry, inode);
- err = 0;
+ ret = 0;
out:
btrfs_end_transaction(trans);
btrfs_btree_balance_dirty(fs_info);
out_new_inode_args:
btrfs_new_inode_args_destroy(&new_inode_args);
out_inode:
- if (err)
+ if (ret)
iput(inode);
- return err;
+ return ret;
}
static struct btrfs_trans_handle *insert_prealloc_file_extent(
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 16/22] btrfs: rename err to ret in calc_pct_ratio()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (14 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 15/22] btrfs: rename err to ret in btrfs_symlink() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 17/22] btrfs: rename err to ret in btrfs_fill_super() David Sterba
` (6 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/space-info.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/btrfs/space-info.c b/fs/btrfs/space-info.c
index 23685d6e8cbc..517916004f21 100644
--- a/fs/btrfs/space-info.c
+++ b/fs/btrfs/space-info.c
@@ -1973,13 +1973,13 @@ u64 btrfs_account_ro_block_groups_free_space(struct btrfs_space_info *sinfo)
static u64 calc_pct_ratio(u64 x, u64 y)
{
- int err;
+ int ret;
if (!y)
return 0;
again:
- err = check_mul_overflow(100, x, &x);
- if (err)
+ ret = check_mul_overflow(100, x, &x);
+ if (ret)
goto lose_precision;
return div64_u64(x, y);
lose_precision:
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 17/22] btrfs: rename err to ret in btrfs_fill_super()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (15 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 16/22] btrfs: rename err to ret in calc_pct_ratio() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 18/22] btrfs: rename err to ret in quota_override_store() David Sterba
` (5 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/super.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index a0c65adce1ab..c2b6d9449551 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -945,7 +945,7 @@ static int btrfs_fill_super(struct super_block *sb,
{
struct btrfs_inode *inode;
struct btrfs_fs_info *fs_info = btrfs_sb(sb);
- int err;
+ int ret;
sb->s_maxbytes = MAX_LFS_FILESIZE;
sb->s_magic = BTRFS_SUPER_MAGIC;
@@ -959,28 +959,28 @@ static int btrfs_fill_super(struct super_block *sb,
sb->s_time_gran = 1;
sb->s_iflags |= SB_I_CGROUPWB | SB_I_ALLOW_HSM;
- err = super_setup_bdi(sb);
- if (err) {
+ ret = super_setup_bdi(sb);
+ if (ret) {
btrfs_err(fs_info, "super_setup_bdi failed");
- return err;
+ return ret;
}
- err = open_ctree(sb, fs_devices);
- if (err) {
- btrfs_err(fs_info, "open_ctree failed: %d", err);
- return err;
+ ret = open_ctree(sb, fs_devices);
+ if (ret) {
+ btrfs_err(fs_info, "open_ctree failed: %d", ret);
+ return ret;
}
inode = btrfs_iget(BTRFS_FIRST_FREE_OBJECTID, fs_info->fs_root);
if (IS_ERR(inode)) {
- err = PTR_ERR(inode);
- btrfs_handle_fs_error(fs_info, err, NULL);
+ ret = PTR_ERR(inode);
+ btrfs_handle_fs_error(fs_info, ret, NULL);
goto fail_close;
}
sb->s_root = d_make_root(&inode->vfs_inode);
if (!sb->s_root) {
- err = -ENOMEM;
+ ret = -ENOMEM;
goto fail_close;
}
@@ -989,7 +989,7 @@ static int btrfs_fill_super(struct super_block *sb,
fail_close:
close_ctree(fs_info);
- return err;
+ return ret;
}
int btrfs_sync_fs(struct super_block *sb, int wait)
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 18/22] btrfs: rename err to ret in quota_override_store()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (16 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 17/22] btrfs: rename err to ret in btrfs_fill_super() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 19/22] btrfs: rename err to ret in btrfs_wait_extents() David Sterba
` (4 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 04715201c643..b860470cffc4 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -1210,7 +1210,7 @@ static ssize_t quota_override_store(struct kobject *kobj,
{
struct btrfs_fs_info *fs_info = to_fs_info(kobj);
unsigned long knob;
- int err;
+ int ret;
if (!fs_info)
return -EPERM;
@@ -1218,9 +1218,9 @@ static ssize_t quota_override_store(struct kobject *kobj,
if (!capable(CAP_SYS_RESOURCE))
return -EPERM;
- err = kstrtoul(buf, 10, &knob);
- if (err)
- return err;
+ ret = kstrtoul(buf, 10, &knob);
+ if (ret)
+ return ret;
if (knob > 1)
return -EINVAL;
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 19/22] btrfs: rename err to ret in btrfs_wait_extents()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (17 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 18/22] btrfs: rename err to ret in quota_override_store() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:18 ` [PATCH 20/22] btrfs: rename err to ret in btrfs_wait_tree_log_extents() David Sterba
` (3 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/transaction.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index b518a6c3517b..3ca57bb8dc64 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1211,15 +1211,15 @@ static int btrfs_wait_extents(struct btrfs_fs_info *fs_info,
struct extent_io_tree *dirty_pages)
{
bool errors = false;
- int err;
+ int ret;
- err = __btrfs_wait_marked_extents(fs_info, dirty_pages);
+ ret = __btrfs_wait_marked_extents(fs_info, dirty_pages);
if (test_and_clear_bit(BTRFS_FS_BTREE_ERR, &fs_info->flags))
errors = true;
- if (errors && !err)
- err = -EIO;
- return err;
+ if (errors && !ret)
+ ret = -EIO;
+ return ret;
}
int btrfs_wait_tree_log_extents(struct btrfs_root *log_root, int mark)
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 20/22] btrfs: rename err to ret in btrfs_wait_tree_log_extents()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (18 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 19/22] btrfs: rename err to ret in btrfs_wait_extents() David Sterba
@ 2025-05-30 16:18 ` David Sterba
2025-05-30 16:19 ` [PATCH 21/22] btrfs: rename err to ret in btrfs_create_common() David Sterba
` (2 subsequent siblings)
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:18 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/transaction.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 3ca57bb8dc64..825d135ef6c7 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1227,11 +1227,11 @@ int btrfs_wait_tree_log_extents(struct btrfs_root *log_root, int mark)
struct btrfs_fs_info *fs_info = log_root->fs_info;
struct extent_io_tree *dirty_pages = &log_root->dirty_log_pages;
bool errors = false;
- int err;
+ int ret;
ASSERT(btrfs_root_id(log_root) == BTRFS_TREE_LOG_OBJECTID);
- err = __btrfs_wait_marked_extents(fs_info, dirty_pages);
+ ret = __btrfs_wait_marked_extents(fs_info, dirty_pages);
if ((mark & EXTENT_DIRTY) &&
test_and_clear_bit(BTRFS_FS_LOG1_ERR, &fs_info->flags))
errors = true;
@@ -1240,9 +1240,9 @@ int btrfs_wait_tree_log_extents(struct btrfs_root *log_root, int mark)
test_and_clear_bit(BTRFS_FS_LOG2_ERR, &fs_info->flags))
errors = true;
- if (errors && !err)
- err = -EIO;
- return err;
+ if (errors && !ret)
+ ret = -EIO;
+ return ret;
}
/*
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 21/22] btrfs: rename err to ret in btrfs_create_common()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (19 preceding siblings ...)
2025-05-30 16:18 ` [PATCH 20/22] btrfs: rename err to ret in btrfs_wait_tree_log_extents() David Sterba
@ 2025-05-30 16:19 ` David Sterba
2025-05-30 16:19 ` [PATCH 22/22] btrfs: rename err to ret in scrub_submit_extent_sector_read() David Sterba
2025-06-06 11:35 ` [PATCH 00/22] Return variable name unifications anand jain
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/inode.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index a91ee8155376..e989649b5050 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -6738,20 +6738,20 @@ static int btrfs_create_common(struct inode *dir, struct dentry *dentry,
};
unsigned int trans_num_items;
struct btrfs_trans_handle *trans;
- int err;
+ int ret;
- err = btrfs_new_inode_prepare(&new_inode_args, &trans_num_items);
- if (err)
+ ret = btrfs_new_inode_prepare(&new_inode_args, &trans_num_items);
+ if (ret)
goto out_inode;
trans = btrfs_start_transaction(root, trans_num_items);
if (IS_ERR(trans)) {
- err = PTR_ERR(trans);
+ ret = PTR_ERR(trans);
goto out_new_inode_args;
}
- err = btrfs_create_new_inode(trans, &new_inode_args);
- if (!err)
+ ret = btrfs_create_new_inode(trans, &new_inode_args);
+ if (!ret)
d_instantiate_new(dentry, inode);
btrfs_end_transaction(trans);
@@ -6759,9 +6759,9 @@ static int btrfs_create_common(struct inode *dir, struct dentry *dentry,
out_new_inode_args:
btrfs_new_inode_args_destroy(&new_inode_args);
out_inode:
- if (err)
+ if (ret)
iput(inode);
- return err;
+ return ret;
}
static int btrfs_mknod(struct mnt_idmap *idmap, struct inode *dir,
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH 22/22] btrfs: rename err to ret in scrub_submit_extent_sector_read()
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (20 preceding siblings ...)
2025-05-30 16:19 ` [PATCH 21/22] btrfs: rename err to ret in btrfs_create_common() David Sterba
@ 2025-05-30 16:19 ` David Sterba
2025-06-06 11:35 ` [PATCH 00/22] Return variable name unifications anand jain
22 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-05-30 16:19 UTC (permalink / raw)
To: linux-btrfs; +Cc: David Sterba
Unify naming of return value to the preferred way.
Signed-off-by: David Sterba <dsterba@suse.com>
---
fs/btrfs/scrub.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 7cd5e76a783c..e8fa27754563 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1806,7 +1806,7 @@ static void scrub_submit_extent_sector_read(struct scrub_stripe *stripe)
struct btrfs_io_context *bioc = NULL;
const u64 logical = stripe->logical +
(i << fs_info->sectorsize_bits);
- int err;
+ int ret;
io_stripe.rst_search_commit_root = true;
stripe_len = (nr_sectors - i) << fs_info->sectorsize_bits;
@@ -1814,11 +1814,11 @@ static void scrub_submit_extent_sector_read(struct scrub_stripe *stripe)
* For RST cases, we need to manually split the bbio to
* follow the RST boundary.
*/
- err = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical,
+ ret = btrfs_map_block(fs_info, BTRFS_MAP_READ, logical,
&stripe_len, &bioc, &io_stripe, &mirror);
btrfs_put_bioc(bioc);
- if (err < 0) {
- if (err != -ENODATA) {
+ if (ret < 0) {
+ if (ret != -ENODATA) {
/*
* Earlier btrfs_get_raid_extent_offset()
* returned -ENODATA, which means there's
--
2.47.1
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [PATCH 00/22] Return variable name unifications
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
` (21 preceding siblings ...)
2025-05-30 16:19 ` [PATCH 22/22] btrfs: rename err to ret in scrub_submit_extent_sector_read() David Sterba
@ 2025-06-06 11:35 ` anand jain
2025-06-06 16:37 ` David Sterba
22 siblings, 1 reply; 25+ messages in thread
From: anand jain @ 2025-06-06 11:35 UTC (permalink / raw)
To: David Sterba, linux-btrfs
On 31/5/25 12:16 am, David Sterba wrote:
> Simple conversions, 'ret' from 'err, or the secondary return value ret2.
>
> David Sterba (22):
> btrfs: rename err to ret2 in resolve_indirect_refs()
> btrfs: rename err to ret2 in read_block_for_search()
> btrfs: rename err to ret2 in search_leaf()
> btrfs: rename err to ret2 in btrfs_search_slot()
> btrfs: rename err to ret2 in btrfs_search_old_slot()
> btrfs: rename err to ret2 in btrfs_setsize()
> btrfs: rename err to ret2 in btrfs_add_link()
> btrfs: rename err to ret2 in btrfs_truncate_inode_items()
> btrfs: rename err to ret in btrfs_try_lock_extent_bits()
> btrfs: rename err to ret in btrfs_lock_extent_bits()
> btrfs: rename err to ret in btrfs_alloc_from_bitmap()
> btrfs: rename err to ret in btrfs_init_inode_security()
> btrfs: rename err to ret in btrfs_setattr()
> btrfs: rename err to ret in btrfs_link()
> btrfs: rename err to ret in btrfs_symlink()
> btrfs: rename err to ret in calc_pct_ratio()
> btrfs: rename err to ret in btrfs_fill_super()
> btrfs: rename err to ret in quota_override_store()
> btrfs: rename err to ret in btrfs_wait_extents()
> btrfs: rename err to ret in btrfs_wait_tree_log_extents()
> btrfs: rename err to ret in btrfs_create_common()
> btrfs: rename err to ret in scrub_submit_extent_sector_read()
>
Sorry for the late rvb.
I vaguely remember sending patches for similar changes.
Anyway, no need to dig into that, the current patchset looks good.
Reviewed-by: Anand Jain <anand.jain@oracle.com>
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH 00/22] Return variable name unifications
2025-06-06 11:35 ` [PATCH 00/22] Return variable name unifications anand jain
@ 2025-06-06 16:37 ` David Sterba
0 siblings, 0 replies; 25+ messages in thread
From: David Sterba @ 2025-06-06 16:37 UTC (permalink / raw)
To: anand jain; +Cc: David Sterba, linux-btrfs
On Fri, Jun 06, 2025 at 07:35:31PM +0800, anand jain wrote:
> On 31/5/25 12:16 am, David Sterba wrote:
> > Simple conversions, 'ret' from 'err, or the secondary return value ret2.
> >
> > David Sterba (22):
> > btrfs: rename err to ret2 in resolve_indirect_refs()
> > btrfs: rename err to ret2 in read_block_for_search()
> > btrfs: rename err to ret2 in search_leaf()
> > btrfs: rename err to ret2 in btrfs_search_slot()
> > btrfs: rename err to ret2 in btrfs_search_old_slot()
> > btrfs: rename err to ret2 in btrfs_setsize()
> > btrfs: rename err to ret2 in btrfs_add_link()
> > btrfs: rename err to ret2 in btrfs_truncate_inode_items()
> > btrfs: rename err to ret in btrfs_try_lock_extent_bits()
> > btrfs: rename err to ret in btrfs_lock_extent_bits()
> > btrfs: rename err to ret in btrfs_alloc_from_bitmap()
> > btrfs: rename err to ret in btrfs_init_inode_security()
> > btrfs: rename err to ret in btrfs_setattr()
> > btrfs: rename err to ret in btrfs_link()
> > btrfs: rename err to ret in btrfs_symlink()
> > btrfs: rename err to ret in calc_pct_ratio()
> > btrfs: rename err to ret in btrfs_fill_super()
> > btrfs: rename err to ret in quota_override_store()
> > btrfs: rename err to ret in btrfs_wait_extents()
> > btrfs: rename err to ret in btrfs_wait_tree_log_extents()
> > btrfs: rename err to ret in btrfs_create_common()
> > btrfs: rename err to ret in scrub_submit_extent_sector_read()
> >
>
> Sorry for the late rvb.
Late reviews are also ok, thanks.
> I vaguely remember sending patches for similar changes.
> Anyway, no need to dig into that, the current patchset looks good.
Yes, we've started some cleanups or coding style unifications so we
should finish them. I do it myself eventually unless the original
authors do it.
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2025-06-06 16:37 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-30 16:16 [PATCH 00/22] Return variable name unifications David Sterba
2025-05-30 16:17 ` [PATCH 01/22] btrfs: rename err to ret2 in resolve_indirect_refs() David Sterba
2025-05-30 16:17 ` [PATCH 02/22] btrfs: rename err to ret2 in read_block_for_search() David Sterba
2025-05-30 16:17 ` [PATCH 03/22] btrfs: rename err to ret2 in search_leaf() David Sterba
2025-05-30 16:17 ` [PATCH 04/22] btrfs: rename err to ret2 in btrfs_search_slot() David Sterba
2025-05-30 16:17 ` [PATCH 05/22] btrfs: rename err to ret2 in btrfs_search_old_slot() David Sterba
2025-05-30 16:17 ` [PATCH 06/22] btrfs: rename err to ret2 in btrfs_setsize() David Sterba
2025-05-30 16:17 ` [PATCH 07/22] btrfs: rename err to ret2 in btrfs_add_link() David Sterba
2025-05-30 16:17 ` [PATCH 08/22] btrfs: rename err to ret2 in btrfs_truncate_inode_items() David Sterba
2025-05-30 16:17 ` [PATCH 09/22] btrfs: rename err to ret in btrfs_try_lock_extent_bits() David Sterba
2025-05-30 16:17 ` [PATCH 10/22] btrfs: rename err to ret in btrfs_lock_extent_bits() David Sterba
2025-05-30 16:18 ` [PATCH 11/22] btrfs: rename err to ret in btrfs_alloc_from_bitmap() David Sterba
2025-05-30 16:18 ` [PATCH 12/22] btrfs: rename err to ret in btrfs_init_inode_security() David Sterba
2025-05-30 16:18 ` [PATCH 13/22] btrfs: rename err to ret in btrfs_setattr() David Sterba
2025-05-30 16:18 ` [PATCH 14/22] btrfs: rename err to ret in btrfs_link() David Sterba
2025-05-30 16:18 ` [PATCH 15/22] btrfs: rename err to ret in btrfs_symlink() David Sterba
2025-05-30 16:18 ` [PATCH 16/22] btrfs: rename err to ret in calc_pct_ratio() David Sterba
2025-05-30 16:18 ` [PATCH 17/22] btrfs: rename err to ret in btrfs_fill_super() David Sterba
2025-05-30 16:18 ` [PATCH 18/22] btrfs: rename err to ret in quota_override_store() David Sterba
2025-05-30 16:18 ` [PATCH 19/22] btrfs: rename err to ret in btrfs_wait_extents() David Sterba
2025-05-30 16:18 ` [PATCH 20/22] btrfs: rename err to ret in btrfs_wait_tree_log_extents() David Sterba
2025-05-30 16:19 ` [PATCH 21/22] btrfs: rename err to ret in btrfs_create_common() David Sterba
2025-05-30 16:19 ` [PATCH 22/22] btrfs: rename err to ret in scrub_submit_extent_sector_read() David Sterba
2025-06-06 11:35 ` [PATCH 00/22] Return variable name unifications anand jain
2025-06-06 16:37 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox