Return variable name unifications
David Sterba
maintainercover Return variable name unifications
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(-)
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 1/22 btrfs: rename err to ret2 in resolve_indirect_refs()
Unify naming of return value to the preferred way, move the variable to the closest scope.
--- fs/btrfs/backref.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/backref.c +5 -5
@@ -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; }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 2/22 btrfs: rename err to ret2 in read_block_for_search()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/ctree.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/ctree.c +7 -7
@@ -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; }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 3/22 btrfs: rename err to ret2 in search_leaf()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/ctree.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
fs/btrfs/ctree.c +7 -8
@@ -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; } }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 4/22 btrfs: rename err to ret2 in btrfs_search_slot()
In reply to David SterbaUnify naming of return value to the preferred way, move the variable to the closest scope.
--- fs/btrfs/ctree.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-)
fs/btrfs/ctree.c +18 -19
@@ -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; }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 5/22 btrfs: rename err to ret2 in btrfs_search_old_slot()
In reply to David SterbaUnify naming of return value to the preferred way, move the variable to the closest scope.
--- fs/btrfs/ctree.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/ctree.c +5 -5
@@ -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; }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 6/22 btrfs: rename err to ret2 in btrfs_setsize()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/inode.c +4 -4
@@ -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); } }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 7/22 btrfs: rename err to ret2 in btrfs_add_link()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
fs/btrfs/inode.c +10 -11
@@ -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 */
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 8/22 btrfs: rename err to ret2 in btrfs_truncate_inode_items()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode-item.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
fs/btrfs/inode-item.c +5 -6
@@ -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; } }
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 9/22 btrfs: rename err to ret in btrfs_try_lock_extent_bits()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/extent-io-tree.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/btrfs/extent-io-tree.c +3 -4
@@ -1882,12 +1882,11 @@ int btrfs_clear_record_extent_bits(struct extent_io_tree *tree, u64 start, u64 ebool 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);
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 10/22 btrfs: rename err to ret in btrfs_lock_extent_bits()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/extent-io-tree.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/extent-io-tree.c +5 -5
@@ -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; }/*
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 11/22 btrfs: rename err to ret in btrfs_alloc_from_bitmap()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/free-space-cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/free-space-cache.c +3 -3
@@ -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 ;
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 12/22 btrfs: rename err to ret in btrfs_init_inode_security()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
fs/btrfs/inode.c +7 -7
@@ -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);
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 13/22 btrfs: rename err to ret in btrfs_setattr()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
fs/btrfs/inode.c +11 -11
@@ -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; }/*
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 14/22 btrfs: rename err to ret in btrfs_link()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
fs/btrfs/inode.c +13 -13
@@ -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,
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 15/22 btrfs: rename err to ret in btrfs_symlink()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-)
fs/btrfs/inode.c +14 -15
@@ -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(
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 16/22 btrfs: rename err to ret in calc_pct_ratio()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/space-info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/btrfs/space-info.c +3 -3
@@ -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:
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 19/22 btrfs: rename err to ret in btrfs_wait_extents()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/transaction.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/transaction.c +5 -5
@@ -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)
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 20/22 btrfs: rename err to ret in btrfs_wait_tree_log_extents()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/transaction.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
fs/btrfs/transaction.c +5 -5
@@ -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; }/*
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 17/22 btrfs: rename err to ret in btrfs_fill_super()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/super.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
fs/btrfs/super.c +12 -12
@@ -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)
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 21/22 btrfs: rename err to ret in btrfs_create_common()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/inode.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/btrfs/inode.c +8 -8
@@ -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,
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 18/22 btrfs: rename err to ret in quota_override_store()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/sysfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/sysfs.c +4 -4
@@ -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 ;
Signature · 1 line
2.47.1
David Sterba
maintainerPATCH 22/22 btrfs: rename err to ret in scrub_submit_extent_sector_read()
In reply to David SterbaUnify naming of return value to the preferred way.
--- fs/btrfs/scrub.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/btrfs/scrub.c +4 -4
@@ -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
Signature · 1 line
2.47.1
Quoted 17 lines · David Sterba
Simple conversions, 'ret' from 'err, or the secondary return value ret2.
David Sterba (22):
btrfs: rename err to ret2 inresolve_indirect_refs()
btrfs: rename err to ret2 inread_block_for_search()
btrfs: rename err to ret2 insearch_leaf()
btrfs: rename err to ret2 inbtrfs_search_slot()
btrfs: rename err to ret2 inbtrfs_search_old_slot()
btrfs: rename err to ret2 inbtrfs_setsize()
btrfs: rename err to ret2 inbtrfs_add_link()
btrfs: rename err to ret2 inbtrfs_truncate_inode_items()
btrfs: rename err to ret inbtrfs_try_lock_extent_bits()
btrfs: rename err to ret inbtrfs_lock_extent_bits()
btrfs: rename err to ret inbtrfs_alloc_from_bitmap()
btrfs: rename err to ret inbtrfs_init_inode_security()
btrfs: rename err to ret inbtrfs_setattr()
btrfs: rename err to ret inbtrfs_link()
Quoted 9 lines
btrfs: rename err to ret in
btrfs_symlink()
btrfs: rename err to ret incalc_pct_ratio()
btrfs: rename err to ret inbtrfs_fill_super()
btrfs: rename err to ret inquota_override_store()
btrfs: rename err to ret inbtrfs_wait_extents()
btrfs: rename err to ret inbtrfs_wait_tree_log_extents()
btrfs: rename err to ret inbtrfs_create_common()
btrfs: rename err to ret inscrub_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.
Quoted 28 lines · anand jain
Quoted 17 lines · David Sterba
Simple conversions, 'ret' from 'err, or the secondary return value ret2.
David Sterba (22):
btrfs: rename err to ret2 inresolve_indirect_refs()
btrfs: rename err to ret2 inread_block_for_search()
btrfs: rename err to ret2 insearch_leaf()
btrfs: rename err to ret2 inbtrfs_search_slot()
btrfs: rename err to ret2 inbtrfs_search_old_slot()
btrfs: rename err to ret2 inbtrfs_setsize()
btrfs: rename err to ret2 inbtrfs_add_link()
btrfs: rename err to ret2 inbtrfs_truncate_inode_items()
btrfs: rename err to ret inbtrfs_try_lock_extent_bits()
btrfs: rename err to ret inbtrfs_lock_extent_bits()
btrfs: rename err to ret inbtrfs_alloc_from_bitmap()
btrfs: rename err to ret inbtrfs_init_inode_security()
btrfs: rename err to ret inbtrfs_setattr()
btrfs: rename err to ret inbtrfs_link()Quoted 9 lines
btrfs: rename err to ret in
btrfs_symlink()
btrfs: rename err to ret incalc_pct_ratio()
btrfs: rename err to ret inbtrfs_fill_super()
btrfs: rename err to ret inquota_override_store()
btrfs: rename err to ret inbtrfs_wait_extents()
btrfs: rename err to ret inbtrfs_wait_tree_log_extents()
btrfs: rename err to ret inbtrfs_create_common()
btrfs: rename err to ret inscrub_submit_extent_sector_read()
Quoted 1 line
Sorry for the late rvb.
Late reviews are also ok, thanks.
Quoted 2 lines
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.