Btrfs: make tree_mod_alloc return the struct its allocating
PATCH 1/1 Btrfs: make tree_mod_alloc return the struct its allocating
Lets try and be consistent with every other alloc() type function.
Signed-off-by Josef Bacik <[email protected]>
--- fs/btrfs/ctree.c | 26 +++++++++++++++----------- 1 files changed, 15 insertions(+), 11 deletions(-)
fs/btrfs/ctree.c +15 -11
@@ -544,8 +544,8 @@ static inline int tree_mod_dont_log(struct btrfs_fs_info *fs_info,* Returns <0 on error. * Returns >0 (the added sequence number) on success. */ -static inline int tree_mod_alloc (struct btrfs_fs_info *fs_info,gfp_t flags, -struct tree_mod_elem **tm_ret) +static inline struct tree_mod_elem * +tree_mod_alloc (struct btrfs_fs_info *fs_info,gfp_t flags) {struct tree_mod_elem *tm;
@@ -555,13 +555,13 @@ static inline int tree_mod_alloc(struct btrfs_fs_info *fs_info, gfp_t flags,*/ tm = *tm_ret =kzalloc (sizeof (*tm),GFP_ATOMIC );if (!tm) -return -ENOMEM ; +return NULL ;spin_lock (&fs_info->tree_mod_seq_lock); tm->seq =btrfs_inc_tree_mod_seq_minor (fs_info);spin_unlock (&fs_info->tree_mod_seq_lock); -return tm->seq; +return tm; } static inline int
@@ -572,9 +572,9 @@ __tree_mod_log_insert_key(struct btrfs_fs_info *fs_info,int ret;struct tree_mod_elem *tm; - ret =tree_mod_alloc (fs_info, flags, &tm); -if (ret <0 ) -return ret; + tm =tree_mod_alloc (fs_info, flags); +if (!tm) +return -ENOMEM ; tm->index = eb->start >>PAGE_CACHE_SHIFT ;if (op !=MOD_LOG_KEY_ADD ) {
@@ -642,9 +642,11 @@ tree_mod_log_insert_move(struct btrfs_fs_info *fs_info,BUG_ON (ret <0 ); } - ret =tree_mod_alloc (fs_info, flags, &tm); -if (ret <0 ) + tm =tree_mod_alloc (fs_info, flags); +if (!tm) { + ret = -ENOMEM ; goto out; + } tm->index = eb->start >>PAGE_CACHE_SHIFT ; tm->slot = src_slot;
@@ -691,9 +693,11 @@ tree_mod_log_insert_root(struct btrfs_fs_info *fs_info,if (log_removal)__tree_mod_log_free_eb (fs_info, old_root); - ret =tree_mod_alloc (fs_info, flags, &tm); -if (ret <0 ) + tm =tree_mod_alloc (fs_info, flags); +if (!tm) { + ret = -ENOMEM ; goto out; + } tm->index = new_root->start >>PAGE_CACHE_SHIFT ; tm->old_root.logical = old_root->start;
Signature · 1 line
1.7.7.6
Quoted 3 lines · Josef Bacik
Lets try and be consistent with every other
alloc()type function.Signed-off-by Josef Bacik <[email protected]>
Ignore this, I didn't compile it and I should have, and I'm just going to delete this function anyway. Thanks,
Josef