btrfs: cleanup patches
cover btrfs: cleanup patches
From: Jeff Mahoney <[email protected]>
Hi all -
Here's another around of cleanup patches. The first 7 cleanup API blemishes with unused arguments and/or root -> fs_info conversion. The last converts the pr_debug in btrfs_abort_transaction to use btrfs_debug.
-Jeff
Jeff Mahoney (8):
btrfs: pass fs_info to (more) routines that are only called with
extent_root
btrfs: flush_space always takes fs_info->fs_root
btrfs: convert btrfs_inc_block_group_ro to accept fs_info
btrfs: free-space-cache, clean up unnecessary root arguments
btrfs: btrfs_wait_cache_io_root doesn't use path argument
btrfs: btrfs_truncate_free_space_cache always allocates path
btrfs: drop unused extent_op arg from btrfs_add_delayed_data_ref
btrfs: use btrfs_debug instead of pr_debug in transaction abort
fs/btrfs/ctree.h | 5 +- fs/btrfs/delayed-ref.c | 6 +- fs/btrfs/delayed-ref.h | 3 +- fs/btrfs/extent-tree.c | 144 ++++++++++++++++++++++---------------------- fs/btrfs/free-space-cache.c | 49 ++++++--------- fs/btrfs/free-space-cache.h | 7 +-- fs/btrfs/inode-map.c | 2 +- fs/btrfs/relocation.c | 7 +-- fs/btrfs/scrub.c | 2 +- 9 files changed, 107 insertions(+), 118 deletions(-)
Signature · 1 line
2.7.1
PATCH 1/8 btrfs: pass fs_info to (more) routines that are only called with extent_root
From: Jeff Mahoney <[email protected]>
Outside of interactions with qgroups, the roots passed in extent-tree.c are usually passed to ensure that we don't do refcounts on log trees or to get the allocation profile for an allocation request. Otherwise, it operates on the extent root. This patch converts some more routines in extent-tree.c that are always called with the extent root to accept an fs_info instead.
--- fs/btrfs/extent-tree.c | 103 +++++++++++++++++++++++++------------------------ 1 file changed, 53 insertions(+), 50 deletions(-)
fs/btrfs/extent-tree.c +53 -50
@@ -1035,10 +1035,11 @@ int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans,#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 static int convert_extent_item_v0 (struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,u64 owner,u32 extra_size) { +struct btrfs_root *root = fs_info->extent_root;struct btrfs_extent_item *item;struct btrfs_extent_item_v0 *ei0;struct btrfs_extent_ref_v0 *ref0;
@@ -1092,7 +1093,7 @@ static int convert_extent_item_v0(struct btrfs_trans_handle *trans,return ret;BUG_ON (ret);/* Corruption */ -btrfs_extend_item (root->fs_info, path, new_size); +btrfs_extend_item (fs_info, path, new_size); leaf = path->nodes[0 ]; item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item);
@@ -1151,12 +1152,13 @@ static int match_extent_data_ref(struct extent_buffer *leaf, } static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,u64 bytenr,u64 parent,u64 root_objectid,u64 owner,u64 offset) { +struct btrfs_root *root = fs_info->extent_root;struct btrfs_key key;struct btrfs_extent_data_ref *ref;struct extent_buffer *leaf;
@@ -1238,12 +1240,13 @@ static noinline int lookup_extent_data_ref(struct btrfs_trans_handle *trans, } static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,u64 bytenr,u64 parent,u64 root_objectid,u64 owner,u64 offset,int refs_to_add) { +struct btrfs_root *root = fs_info->extent_root;struct btrfs_key key;struct extent_buffer *leaf;u32 size;
@@ -1317,7 +1320,7 @@ static noinline int insert_extent_data_ref(struct btrfs_trans_handle *trans, } static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,int refs_to_drop,int *last_ref) {
@@ -1354,7 +1357,7 @@ static noinline int remove_extent_data_ref(struct btrfs_trans_handle *trans, num_refs -= refs_to_drop;if (num_refs ==0 ) { - ret =btrfs_del_item (trans, root, path); + ret =btrfs_del_item (trans, fs_info->extent_root, path); *last_ref =1 ; }else {if (key.type ==BTRFS_EXTENT_DATA_REF_KEY )
@@ -1416,11 +1419,12 @@ static noinline u32 extent_data_ref_count(struct btrfs_path *path, } static noinline int lookup_tree_block_ref(struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,u64 bytenr,u64 parent,u64 root_objectid) { +struct btrfs_root *root = fs_info->extent_root;struct btrfs_key key;int ret;
@@ -1449,7 +1453,7 @@ static noinline int lookup_tree_block_ref(struct btrfs_trans_handle *trans, } static noinline int insert_tree_block_ref(struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,u64 bytenr,u64 parent,u64 root_objectid)
@@ -1466,7 +1470,8 @@ static noinline int insert_tree_block_ref(struct btrfs_trans_handle *trans, key.offset = root_objectid; } - ret =btrfs_insert_empty_item (trans, root, path, &key,0 ); + ret =btrfs_insert_empty_item (trans, fs_info->extent_root, + path, &key,0 );btrfs_release_path (path);return ret; }
@@ -1524,14 +1529,14 @@ static int find_next_key(struct btrfs_path *path, int level,*/ static noinline_for_stack int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,struct btrfs_extent_inline_ref **ref_ret,u64 bytenr,u64 num_bytes,u64 parent,u64 root_objectid,u64 owner,u64 offset,int insert) { -struct btrfs_fs_info *fs_info = root->fs_info; +struct btrfs_root *root = fs_info->extent_root;struct btrfs_key key;struct extent_buffer *leaf;struct btrfs_extent_item *ei;
@@ -1614,7 +1619,7 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans, err = -ENOENT ; goto out; } - ret =convert_extent_item_v0 (trans, root, path, owner, + ret =convert_extent_item_v0 (trans, fs_info, path, owner, extra_size);if (ret <0 ) { err = ret;
@@ -1716,7 +1721,7 @@ int lookup_inline_extent_backref(struct btrfs_trans_handle *trans,* helper to add new inline back ref */ static noinline_for_stack -void setup_inline_extent_backref(struct btrfs_root *root, +void setup_inline_extent_backref(struct btrfs_fs_info *fs_info, struct btrfs_path *path, struct btrfs_extent_inline_ref *iref, u64 parent, u64 root_objectid,
@@ -1739,7 +1744,7 @@ void setup_inline_extent_backref(struct btrfs_root *root, type =extent_ref_type (parent, owner); size =btrfs_extent_inline_ref_size (type); -btrfs_extend_item (root->fs_info, path, size); +btrfs_extend_item (fs_info, path, size); ei = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_extent_item); refs =btrfs_extent_refs (leaf, ei);
@@ -1777,7 +1782,7 @@ void setup_inline_extent_backref(struct btrfs_root *root, } static int lookup_extent_backref(struct btrfs_trans_handle *trans, - struct btrfs_root *root, + struct btrfs_fs_info *fs_info, struct btrfs_path *path, struct btrfs_extent_inline_ref **ref_ret, u64 bytenr, u64 num_bytes, u64 parent,
@@ -1785,7 +1790,7 @@ static int lookup_extent_backref(struct btrfs_trans_handle *trans, {int ret; - ret =lookup_inline_extent_backref (trans, root, path, ref_ret, + ret =lookup_inline_extent_backref (trans, fs_info, path, ref_ret, bytenr, num_bytes, parent, root_objectid, owner, offset,0 );if (ret != -ENOENT )
@@ -1795,11 +1800,12 @@ static int lookup_extent_backref(struct btrfs_trans_handle *trans, *ref_ret =NULL ;if (owner <BTRFS_FIRST_FREE_OBJECTID ) { - ret =lookup_tree_block_ref (trans, root, path, bytenr, parent, - root_objectid); + ret =lookup_tree_block_ref (trans, fs_info, path, bytenr, + parent, root_objectid); }else { - ret =lookup_extent_data_ref (trans, root, path, bytenr, parent, - root_objectid, owner, offset); + ret =lookup_extent_data_ref (trans, fs_info, path, bytenr, + parent, root_objectid, owner, + offset); }return ret; }
@@ -1808,7 +1814,7 @@ static int lookup_extent_backref(struct btrfs_trans_handle *trans,* helper to update/remove inline back ref */ static noinline_for_stack -void update_inline_extent_backref(struct btrfs_root *root, +void update_inline_extent_backref(struct btrfs_fs_info *fs_info, struct btrfs_path *path, struct btrfs_extent_inline_ref *iref, int refs_to_mod,
@@ -1866,14 +1872,14 @@ void update_inline_extent_backref(struct btrfs_root *root,memmove_extent_buffer (leaf, ptr, ptr + size, end - ptr - size); item_size -= size; -btrfs_truncate_item (root->fs_info, path, item_size,1 ); +btrfs_truncate_item (fs_info, path, item_size,1 ); }btrfs_mark_buffer_dirty (leaf); } static noinline_for_stack int insert_inline_extent_backref(struct btrfs_trans_handle *trans, - struct btrfs_root *root, + struct btrfs_fs_info *fs_info, struct btrfs_path *path, u64 bytenr, u64 num_bytes, u64 parent, u64 root_objectid, u64 owner,
@@ -1883,15 +1889,15 @@ int insert_inline_extent_backref(struct btrfs_trans_handle *trans,struct btrfs_extent_inline_ref *iref;int ret; - ret =lookup_inline_extent_backref (trans, root, path, &iref, + ret =lookup_inline_extent_backref (trans, fs_info, path, &iref, bytenr, num_bytes, parent, root_objectid, owner, offset,1 );if (ret ==0 ) {BUG_ON (owner <BTRFS_FIRST_FREE_OBJECTID ); -update_inline_extent_backref (root, path, iref, +update_inline_extent_backref (fs_info, path, iref, refs_to_add, extent_op,NULL ); }else if (ret == -ENOENT ) { -setup_inline_extent_backref (root, path, iref, parent, +setup_inline_extent_backref (fs_info, path, iref, parent, root_objectid, owner, offset, refs_to_add, extent_op); ret =0 ;
@@ -1900,7 +1906,7 @@ int insert_inline_extent_backref(struct btrfs_trans_handle *trans, }static int insert_extent_backref (struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,u64 bytenr,u64 parent,u64 root_objectid,u64 owner,u64 offset,int refs_to_add)
@@ -1908,10 +1914,10 @@ static int insert_extent_backref(struct btrfs_trans_handle *trans,int ret;if (owner <BTRFS_FIRST_FREE_OBJECTID ) {BUG_ON (refs_to_add !=1 ); - ret =insert_tree_block_ref (trans, root, path, bytenr, + ret =insert_tree_block_ref (trans, fs_info, path, bytenr, parent, root_objectid); }else { - ret =insert_extent_data_ref (trans, root, path, bytenr, + ret =insert_extent_data_ref (trans, fs_info, path, bytenr, parent, root_objectid, owner, offset, refs_to_add); }
@@ -1919,7 +1925,7 @@ static int insert_extent_backref(struct btrfs_trans_handle *trans, }static int remove_extent_backref (struct btrfs_trans_handle *trans, -struct btrfs_root *root, +struct btrfs_fs_info *fs_info,struct btrfs_path *path,struct btrfs_extent_inline_ref *iref,int refs_to_drop,int is_data,int *last_ref)
@@ -1928,14 +1934,14 @@ static int remove_extent_backref(struct btrfs_trans_handle *trans,BUG_ON (!is_data && refs_to_drop !=1 );if (iref) { -update_inline_extent_backref (root, path, iref, +update_inline_extent_backref (fs_info, path, iref, -refs_to_drop,NULL , last_ref); }else if (is_data) { - ret =remove_extent_data_ref (trans, root, path, refs_to_drop, + ret =remove_extent_data_ref (trans, fs_info, path, refs_to_drop, last_ref); }else { *last_ref =1 ; - ret =btrfs_del_item (trans, root, path); + ret =btrfs_del_item (trans, fs_info->extent_root, path); }return ret; }
@@ -2117,9 +2123,9 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, path->reada =READA_FORWARD ; path->leave_spinning =1 ;/* this will setup the path even if it fails to insert the back ref */ - ret =insert_inline_extent_backref (trans, fs_info->extent_root, path, - bytenr, num_bytes, parent, - root_objectid, owner, offset, + ret =insert_inline_extent_backref (trans, fs_info, path, bytenr, + num_bytes, parent, root_objectid, + owner, offset, refs_to_add, extent_op);if ((ret <0 && ret != -EAGAIN ) || !ret) goto out;
@@ -2143,9 +2149,8 @@ static int __btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, path->reada =READA_FORWARD ; path->leave_spinning =1 ;/* now insert the actual backref */ - ret =insert_extent_backref (trans, fs_info->extent_root, - path, bytenr, parent, root_objectid, - owner, offset, refs_to_add); + ret =insert_extent_backref (trans, fs_info, path, bytenr, parent, + root_objectid, owner, offset, refs_to_add);if (ret)btrfs_abort_transaction (trans, ret); out:
@@ -2290,8 +2295,7 @@ static int run_delayed_extent_op(struct btrfs_trans_handle *trans, item_size =btrfs_item_size_nr (leaf, path->slots[0 ]);#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 if (item_size <sizeof (*ei)) { - ret =convert_extent_item_v0 (trans, fs_info->extent_root, - path, (u64)-1 ,0 ); + ret =convert_extent_item_v0 (trans, fs_info, path, (u64)-1 ,0 );if (ret <0 ) { err = ret; goto out;
@@ -6845,7 +6849,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,if (is_data) skinny_metadata =0 ; - ret =lookup_extent_backref (trans, extent_root, path, &iref, + ret =lookup_extent_backref (trans, info, path, &iref, bytenr, num_bytes, parent, root_objectid, owner_objectid, owner_offset);
@@ -6877,8 +6881,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,#endif if (!found_extent) {BUG_ON (iref); - ret =remove_extent_backref (trans, extent_root, path, -NULL , refs_to_drop, + ret =remove_extent_backref (trans, info, path,NULL , + refs_to_drop, is_data, &last_ref);if (ret) {btrfs_abort_transaction (trans, ret);
@@ -6953,8 +6957,8 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,#ifdef BTRFS_COMPAT_EXTENT_TREE_V0 if (item_size <sizeof (*ei)) {BUG_ON (found_extent || extent_slot != path->slots[0 ]); - ret =convert_extent_item_v0 (trans, extent_root, path, - owner_objectid,0 ); + ret =convert_extent_item_v0 (trans, info, path, owner_objectid, +0 );if (ret <0 ) {btrfs_abort_transaction (trans, ret); goto out;
@@ -7021,7 +7025,7 @@ static int __btrfs_free_extent(struct btrfs_trans_handle *trans,btrfs_mark_buffer_dirty (leaf); }if (found_extent) { - ret =remove_extent_backref (trans, extent_root, path, + ret =remove_extent_backref (trans, info, path, iref, refs_to_drop, is_data, &last_ref);if (ret) {
@@ -7419,12 +7423,11 @@ btrfs_release_block_group(struct btrfs_block_group_cache *cache,* If there is no suitable free space, we will record the max size of * the free space extent currently. */ -static noinline int find_free_extent(struct btrfs_root *orig_root, +static noinline int find_free_extent(struct btrfs_fs_info *fs_info,u64 ram_bytes,u64 num_bytes,u64 empty_size,u64 hint_byte,struct btrfs_key *ins,u64 flags,int delalloc) { -struct btrfs_fs_info *fs_info = orig_root->fs_info;int ret =0 ;struct btrfs_root *root = fs_info->extent_root;struct btrfs_free_cluster *last_ptr =NULL ;
@@ -7951,7 +7954,7 @@ int btrfs_reserve_extent(struct btrfs_root *root, u64 ram_bytes, flags =btrfs_get_alloc_profile (root, is_data); again:WARN_ON (num_bytes < fs_info->sectorsize); - ret =find_free_extent (root, ram_bytes, num_bytes, empty_size, + ret =find_free_extent (fs_info, ram_bytes, num_bytes, empty_size, hint_byte, ins, flags, delalloc);if (!ret && !is_data) {btrfs_dec_block_group_reservations (fs_info, ins->objectid);
Signature · 1 line
2.7.1
PATCH 2/8 btrfs: flush_space always takes fs_info->fs_root
In reply to [email protected]From: Jeff Mahoney <[email protected]>
We don't need to pass a root to flush_space since it always uses the fs_root.
--- fs/btrfs/extent-tree.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
fs/btrfs/extent-tree.c +10 -10
@@ -4791,11 +4791,10 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,* get us somewhere and then commit the transaction if it does. Otherwise it * will return -ENOSPC. */ -static int may_commit_transaction (struct btrfs_root *root, +static int may_commit_transaction (struct btrfs_fs_info *fs_info,struct btrfs_space_info *space_info,u64 bytes,int force) { -struct btrfs_fs_info *fs_info = root->fs_info;struct btrfs_block_rsv *delayed_rsv = &fs_info->delayed_block_rsv;struct btrfs_trans_handle *trans;
@@ -4827,7 +4826,7 @@ static int may_commit_transaction(struct btrfs_root *root,spin_unlock (&delayed_rsv->lock); commit: - trans =btrfs_join_transaction (root); + trans =btrfs_join_transaction (fs_info->fs_root);if (IS_ERR (trans))return -ENOSPC ;
@@ -4841,11 +4840,11 @@ struct reserve_ticket {wait_queue_head_t wait; }; -static int flush_space (struct btrfs_root *root, +static int flush_space (struct btrfs_fs_info *fs_info,struct btrfs_space_info *space_info,u64 num_bytes,u64 orig_bytes,int state) { -struct btrfs_fs_info *fs_info = root->fs_info; +struct btrfs_root *root = fs_info->fs_root;struct btrfs_trans_handle *trans;int nr;int ret =0 ;
@@ -4885,7 +4884,8 @@ static int flush_space(struct btrfs_root *root, ret =0 ;break ;case COMMIT_TRANS : - ret =may_commit_transaction (root, space_info, orig_bytes,0 ); + ret =may_commit_transaction (fs_info, space_info, + orig_bytes,0 );break ;default : ret = -ENOSPC ;
@@ -4997,8 +4997,8 @@ static void btrfs_async_reclaim_metadata_space(struct work_struct *work)struct reserve_ticket *ticket;int ret; - ret =flush_space (fs_info->fs_root, space_info, to_reclaim, - to_reclaim, flush_state); + ret =flush_space (fs_info, space_info, to_reclaim, to_reclaim, + flush_state);spin_lock (&space_info->lock);if (list_empty (&space_info->tickets)) { space_info->flush =0 ;
@@ -5053,8 +5053,8 @@ static void priority_reclaim_metadata_space(struct btrfs_fs_info *fs_info,spin_unlock (&space_info->lock); do { - flush_space(fs_info->fs_root, space_info, to_reclaim, - to_reclaim, flush_state); + flush_space(fs_info, space_info, to_reclaim, to_reclaim, + flush_state); flush_state++; spin_lock(&space_info->lock); if (ticket->bytes == 0) {
Signature · 1 line
2.7.1
PATCH 3/8 btrfs: convert btrfs_inc_block_group_ro to accept fs_info
In reply to [email protected]From: Jeff Mahoney <[email protected]>
btrfs_inc_block_group_ro is either passed the extent root or the dev root, but it doesn't do anything with the dev tree. Let's convert to passing an fs_info and using the extent root.
--- fs/btrfs/ctree.h | 2 +- fs/btrfs/extent-tree.c | 5 ++--- fs/btrfs/relocation.c | 2 +- fs/btrfs/scrub.c | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-)
fs/btrfs/ctree.h +1 -1
@@ -2724,7 +2724,7 @@ int btrfs_cond_migrate_bytes(struct btrfs_fs_info *fs_info,void btrfs_block_rsv_release (struct btrfs_fs_info *fs_info,struct btrfs_block_rsv *block_rsv,u64 num_bytes); -int btrfs_inc_block_group_ro (struct btrfs_root *root, +int btrfs_inc_block_group_ro (struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *cache);void btrfs_dec_block_group_ro (struct btrfs_block_group_cache *cache);void btrfs_put_block_group_cache (struct btrfs_fs_info *info);
fs/btrfs/extent-tree.c +2 -3
@@ -9363,17 +9363,16 @@ static int inc_block_group_ro(struct btrfs_block_group_cache *cache, int force)return ret; } -int btrfs_inc_block_group_ro (struct btrfs_root *root, +int btrfs_inc_block_group_ro (struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *cache) { -struct btrfs_fs_info *fs_info = root->fs_info;struct btrfs_trans_handle *trans;u64 alloc_flags;int ret; again: - trans =btrfs_join_transaction (root); + trans =btrfs_join_transaction (fs_info->extent_root);if (IS_ERR (trans))return PTR_ERR (trans);
fs/btrfs/relocation.c +1 -1
@@ -4334,7 +4334,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) rc->block_group =btrfs_lookup_block_group (fs_info, group_start);BUG_ON (!rc->block_group); - ret =btrfs_inc_block_group_ro (extent_root, rc->block_group); + ret =btrfs_inc_block_group_ro (fs_info, rc->block_group);if (ret) { err = ret; goto out;
fs/btrfs/scrub.c +1 -1
@@ -3584,7 +3584,7 @@ int scrub_enumerate_chunks(struct scrub_ctx *sctx,* -> btrfs_scrub_pause() */ scrub_pause_on (fs_info); - ret =btrfs_inc_block_group_ro (root, cache); + ret =btrfs_inc_block_group_ro (fs_info, cache);if (!ret && is_dev_replace) {/* * If we are doing a device replace wait for any tasks
Signature · 1 line
2.7.1
PATCH 4/8 btrfs: free-space-cache, clean up unnecessary root arguments
In reply to [email protected]From: Jeff Mahoney <[email protected]>
The free space cache APIs accept a root but always use the tree root.
Also, btrfs_truncate_free_space_cache accepts a root AND an inode but the inode always points to the root anyway, so let's just pass the inode.
--- fs/btrfs/extent-tree.c | 9 +++++---- fs/btrfs/free-space-cache.c | 25 +++++++++++-------------- fs/btrfs/free-space-cache.h | 7 +++---- fs/btrfs/inode-map.c | 2 +- fs/btrfs/relocation.c | 5 ++--- 5 files changed, 22 insertions(+), 26 deletions(-)
fs/btrfs/extent-tree.c +5 -4
@@ -3372,7 +3372,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,if (trans->aborted)return 0 ; again: - inode =lookup_free_space_inode (root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);if (IS_ERR (inode) &&PTR_ERR (inode) != -ENOENT ) { ret =PTR_ERR (inode);btrfs_release_path (path);
@@ -3386,7 +3386,8 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,if (block_group->ro) goto out_free; - ret =create_free_space_inode (root, trans, block_group, path); + ret =create_free_space_inode (fs_info, trans, block_group, + path);if (ret) goto out_free; goto again;
@@ -3428,7 +3429,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,if (ret) goto out_put; - ret =btrfs_truncate_free_space_cache (root, trans,NULL , inode); + ret =btrfs_truncate_free_space_cache (trans,NULL , inode);if (ret) goto out_put; }
@@ -10319,7 +10320,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,* get the inode first so any iput calls done for the io_list * aren't the final iput (no unlinks allowed now) */ - inode =lookup_free_space_inode (tree_root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);mutex_lock (&trans->transaction->cache_write_mutex);/*
fs/btrfs/free-space-cache.c +11 -14
@@ -94,12 +94,11 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,return inode; } -struct inode *lookup_free_space_inode (struct btrfs_root *root, +struct inode *lookup_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *block_group,struct btrfs_path *path) {struct inode *inode =NULL ; -struct btrfs_fs_info *fs_info = root->fs_info;u32 flags =BTRFS_INODE_NODATASUM |BTRFS_INODE_NODATACOW ;spin_lock (&block_group->lock);
@@ -109,7 +108,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,if (inode)return inode; - inode =__lookup_free_space_inode (root, path, + inode =__lookup_free_space_inode (fs_info->tree_root, path, block_group->key.objectid);if (IS_ERR (inode))return inode;
@@ -192,7 +191,7 @@ static int __create_free_space_inode(struct btrfs_root *root,return 0 ; } -int create_free_space_inode (struct btrfs_root *root, +int create_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct btrfs_path *path)
@@ -200,11 +199,11 @@ int create_free_space_inode(struct btrfs_root *root,int ret;u64 ino; - ret =btrfs_find_free_objectid (root, &ino); + ret =btrfs_find_free_objectid (fs_info->tree_root, &ino);if (ret <0 )return ret; -return __create_free_space_inode (root, trans, path, ino, +return __create_free_space_inode (fs_info->tree_root, trans, path, ino, block_group->key.objectid); }
@@ -227,11 +226,11 @@ int btrfs_check_trunc_cache_free_space(struct btrfs_fs_info *fs_info,return ret; } -int btrfs_truncate_free_space_cache (struct btrfs_root *root, -struct btrfs_trans_handle *trans, +int btrfs_truncate_free_space_cache (struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct inode *inode) { +struct btrfs_root *root =BTRFS_I (inode)->root;int ret =0 ;struct btrfs_path *path =btrfs_alloc_path ();bool locked = false;
@@ -828,7 +827,6 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, struct btrfs_block_group_cache *block_group) {struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; -struct btrfs_root *root = fs_info->tree_root;struct inode *inode;struct btrfs_path *path;int ret =0 ;
@@ -852,7 +850,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, path->search_commit_root =1 ; path->skip_locking =1 ; - inode =lookup_free_space_inode (root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);if (IS_ERR (inode)) {btrfs_free_path (path);return 0 ;
@@ -1378,7 +1376,6 @@ int btrfs_write_out_cache(struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *block_group, struct btrfs_path *path) { - struct btrfs_root *root = fs_info->tree_root; struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;struct inode *inode;int ret =0 ;
@@ -1390,12 +1387,12 @@ int btrfs_write_out_cache(struct btrfs_fs_info *fs_info, }spin_unlock (&block_group->lock); - inode =lookup_free_space_inode (root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);if (IS_ERR (inode))return 0 ; - ret =__btrfs_write_out_cache (root, inode, ctl, block_group, - &block_group->io_ctl, trans, + ret =__btrfs_write_out_cache (fs_info->tree_root, inode, ctl, + block_group, &block_group->io_ctl, trans, path, block_group->key.objectid);if (ret) {#ifdef DEBUG
fs/btrfs/free-space-cache.h +3 -4
@@ -51,18 +51,17 @@ struct btrfs_free_space_op {struct btrfs_io_ctl ; -struct inode *lookup_free_space_inode (struct btrfs_root *root, +struct inode *lookup_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *block_group,struct btrfs_path *path); -int create_free_space_inode (struct btrfs_root *root, +int create_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct btrfs_path *path);int btrfs_check_trunc_cache_free_space (struct btrfs_fs_info *fs_info,struct btrfs_block_rsv *rsv); -int btrfs_truncate_free_space_cache (struct btrfs_root *root, -struct btrfs_trans_handle *trans, +int btrfs_truncate_free_space_cache (struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct inode *inode); int load_free_space_cache(struct btrfs_fs_info *fs_info,
fs/btrfs/inode-map.c +1 -1
@@ -467,7 +467,7 @@ int btrfs_save_ino_cache(struct btrfs_root *root, }if (i_size_read (inode) >0 ) { - ret =btrfs_truncate_free_space_cache (root, trans,NULL , inode); + ret =btrfs_truncate_free_space_cache (trans,NULL , inode);if (ret) {if (ret != -ENOSPC )btrfs_abort_transaction (trans, ret);
fs/btrfs/relocation.c +2 -3
@@ -3543,7 +3543,7 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info, goto out; } - ret =btrfs_truncate_free_space_cache (root, trans, block_group, inode); + ret =btrfs_truncate_free_space_cache (trans, block_group, inode);btrfs_end_transaction (trans);btrfs_btree_balance_dirty (fs_info);
@@ -4347,8 +4347,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) goto out; } - inode =lookup_free_space_inode (fs_info->tree_root, rc->block_group, - path); + inode =lookup_free_space_inode (fs_info, rc->block_group, path);btrfs_free_path (path);if (!IS_ERR (inode))
Signature · 1 line
2.7.1
Re: [PATCH 4/8] btrfs: free-space-cache, clean up unnecessary root arguments
Quoted 6 lines · On 2/15/17 4:28 PM, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
The free space cache APIs accept a root but always use the tree root.
Also,
btrfs_truncate_free_space_cacheaccepts a root AND an inode but the inode always points to the root anyway, so let's just pass the inode.
This one has minor conflicts with Dave's patchset that removes path and objectid.
-Jeff
Quoted 218 lines
Signed-off-by Jeff Mahoney <[email protected]>--- fs/btrfs/extent-tree.c | 9 +++++---- fs/btrfs/free-space-cache.c | 25 +++++++++++-------------- fs/btrfs/free-space-cache.h | 7 +++---- fs/btrfs/inode-map.c | 2 +- fs/btrfs/relocation.c | 5 ++--- 5 files changed, 22 insertions(+), 26 deletions(-)fs/btrfs/extent-tree.c +5
-4@@ -3372,7 +3372,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,if (trans->aborted)return 0 ; again: - inode =lookup_free_space_inode (root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);if (IS_ERR (inode) &&PTR_ERR (inode) != -ENOENT ) { ret =PTR_ERR (inode);btrfs_release_path (path);@@ -3386,7 +3386,8 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,if (block_group->ro) goto out_free; - ret =create_free_space_inode (root, trans, block_group, path); + ret =create_free_space_inode (fs_info, trans, block_group, + path);if (ret) goto out_free; goto again;@@ -3428,7 +3429,7 @@ static int cache_save_setup(struct btrfs_block_group_cache *block_group,if (ret) goto out_put; - ret =btrfs_truncate_free_space_cache (root, trans,NULL , inode); + ret =btrfs_truncate_free_space_cache (trans,NULL , inode);if (ret) goto out_put; }@@ -10319,7 +10320,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans,* get the inode first so any iput calls done for the io_list * aren't the final iput (no unlinks allowed now) */ - inode =lookup_free_space_inode (tree_root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);mutex_lock (&trans->transaction->cache_write_mutex);/* fs/btrfs/free-space-cache.c +11
-14@@ -94,12 +94,11 @@ static struct inode *__lookup_free_space_inode(struct btrfs_root *root,return inode; } -struct inode *lookup_free_space_inode (struct btrfs_root *root, +struct inode *lookup_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *block_group,struct btrfs_path *path) {struct inode *inode =NULL ; -struct btrfs_fs_info *fs_info = root->fs_info;u32 flags =BTRFS_INODE_NODATASUM |BTRFS_INODE_NODATACOW ;spin_lock (&block_group->lock);@@ -109,7 +108,7 @@ struct inode *lookup_free_space_inode(struct btrfs_root *root,if (inode)return inode; - inode =__lookup_free_space_inode (root, path, + inode =__lookup_free_space_inode (fs_info->tree_root, path, block_group->key.objectid);if (IS_ERR (inode))return inode;@@ -192,7 +191,7 @@ static int __create_free_space_inode(struct btrfs_root *root,return 0 ; } -int create_free_space_inode (struct btrfs_root *root, +int create_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct btrfs_path *path)@@ -200,11 +199,11 @@ int create_free_space_inode(struct btrfs_root *root,int ret;u64 ino; - ret =btrfs_find_free_objectid (root, &ino); + ret =btrfs_find_free_objectid (fs_info->tree_root, &ino);if (ret <0 )return ret; -return __create_free_space_inode (root, trans, path, ino, +return __create_free_space_inode (fs_info->tree_root, trans, path, ino, block_group->key.objectid); }@@ -227,11 +226,11 @@ int btrfs_check_trunc_cache_free_space(struct btrfs_fs_info *fs_info,return ret; } -int btrfs_truncate_free_space_cache (struct btrfs_root *root, -struct btrfs_trans_handle *trans, +int btrfs_truncate_free_space_cache (struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct inode *inode) { +struct btrfs_root *root =BTRFS_I (inode)->root;int ret =0 ;struct btrfs_path *path =btrfs_alloc_path ();bool locked = false;@@ -828,7 +827,6 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, struct btrfs_block_group_cache *block_group) {struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl; -struct btrfs_root *root = fs_info->tree_root;struct inode *inode;struct btrfs_path *path;int ret =0 ;@@ -852,7 +850,7 @@ int load_free_space_cache(struct btrfs_fs_info *fs_info, path->search_commit_root =1 ; path->skip_locking =1 ; - inode =lookup_free_space_inode (root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);if (IS_ERR (inode)) {btrfs_free_path (path);return 0 ;@@ -1378,7 +1376,6 @@ int btrfs_write_out_cache(struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *block_group, struct btrfs_path *path) { - struct btrfs_root *root = fs_info->tree_root; struct btrfs_free_space_ctl *ctl = block_group->free_space_ctl;struct inode *inode;int ret =0 ;@@ -1390,12 +1387,12 @@ int btrfs_write_out_cache(struct btrfs_fs_info *fs_info, }spin_unlock (&block_group->lock); - inode =lookup_free_space_inode (root, block_group, path); + inode =lookup_free_space_inode (fs_info, block_group, path);if (IS_ERR (inode))return 0 ; - ret =__btrfs_write_out_cache (root, inode, ctl, block_group, - &block_group->io_ctl, trans, + ret =__btrfs_write_out_cache (fs_info->tree_root, inode, ctl, + block_group, &block_group->io_ctl, trans, path, block_group->key.objectid);if (ret) {#ifdef DEBUG fs/btrfs/free-space-cache.h +3
-4@@ -51,18 +51,17 @@ struct btrfs_free_space_op {struct btrfs_io_ctl ; -struct inode *lookup_free_space_inode (struct btrfs_root *root, +struct inode *lookup_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_block_group_cache *block_group,struct btrfs_path *path); -int create_free_space_inode (struct btrfs_root *root, +int create_free_space_inode (struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct btrfs_path *path);int btrfs_check_trunc_cache_free_space (struct btrfs_fs_info *fs_info,struct btrfs_block_rsv *rsv); -int btrfs_truncate_free_space_cache (struct btrfs_root *root, -struct btrfs_trans_handle *trans, +int btrfs_truncate_free_space_cache (struct btrfs_trans_handle *trans,struct btrfs_block_group_cache *block_group,struct inode *inode); int load_free_space_cache(struct btrfs_fs_info *fs_info,fs/btrfs/inode-map.c +1
-1@@ -467,7 +467,7 @@ int btrfs_save_ino_cache(struct btrfs_root *root, }if (i_size_read (inode) >0 ) { - ret =btrfs_truncate_free_space_cache (root, trans,NULL , inode); + ret =btrfs_truncate_free_space_cache (trans,NULL , inode);if (ret) {if (ret != -ENOSPC )btrfs_abort_transaction (trans, ret);fs/btrfs/relocation.c +2
-3@@ -3543,7 +3543,7 @@ static int delete_block_group_cache(struct btrfs_fs_info *fs_info, goto out; } - ret =btrfs_truncate_free_space_cache (root, trans, block_group, inode); + ret =btrfs_truncate_free_space_cache (trans, block_group, inode);btrfs_end_transaction (trans);btrfs_btree_balance_dirty (fs_info);@@ -4347,8 +4347,7 @@ int btrfs_relocate_block_group(struct btrfs_fs_info *fs_info, u64 group_start) goto out; } - inode =lookup_free_space_inode (fs_info->tree_root, rc->block_group, - path); + inode =lookup_free_space_inode (fs_info, rc->block_group, path);btrfs_free_path (path);if (!IS_ERR (inode))
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 5/8 btrfs: btrfs_wait_cache_io_root doesn't use path argument
In reply to [email protected]From: Jeff Mahoney <[email protected]>
--- fs/btrfs/free-space-cache.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
fs/btrfs/free-space-cache.c +3 -8
@@ -42,10 +42,6 @@ static int link_free_space(struct btrfs_free_space_ctl *ctl, struct btrfs_free_space *info);static void unlink_free_space (struct btrfs_free_space_ctl *ctl,struct btrfs_free_space *info); -static int btrfs_wait_cache_io_root (struct btrfs_root *root, -struct btrfs_trans_handle *trans, -struct btrfs_io_ctl *io_ctl, -struct btrfs_path *path); static struct inode *__lookup_free_space_inode(struct btrfs_root *root, struct btrfs_path *path,
@@ -1234,8 +1230,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,struct btrfs_free_space_ctl *ctl, struct btrfs_block_group_cache *block_group, struct btrfs_io_ctl *io_ctl, - struct btrfs_trans_handle *trans, - struct btrfs_path *path, u64 offset) + struct btrfs_trans_handle *trans, u64 offset) { struct btrfs_fs_info *fs_info = root->fs_info;struct extent_state *cached_state =NULL ;
@@ -1393,7 +1388,7 @@ int btrfs_write_out_cache(struct btrfs_fs_info *fs_info, ret =__btrfs_write_out_cache (fs_info->tree_root, inode, ctl, block_group, &block_group->io_ctl, trans, - path, block_group->key.objectid); + block_group->key.objectid);if (ret) {#ifdef DEBUG btrfs_err(fs_info,
@@ -3541,7 +3536,7 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root,memset (&io_ctl,0 ,sizeof (io_ctl)); ret =__btrfs_write_out_cache (root, inode, ctl,NULL , &io_ctl, - trans, path,0 ); + trans,0 );if (!ret) {/* * At this point writepages() didn't error out, so our metadata
Signature · 1 line
2.7.1
Re: [PATCH 5/8] btrfs: btrfs_wait_cache_io_root doesn't use path argument
Quoted 3 lines · On 2/15/17 4:28 PM, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
Signed-off-by Jeff Mahoney <[email protected]>
This one is obsoleted by Dave's patch:
[PATCH 28/29] btrfs: remove unused parameters from __btrfs_write_out_cache
-Jeff
Quoted 48 lines
--- fs/btrfs/free-space-cache.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)fs/btrfs/free-space-cache.c +3
-8@@ -42,10 +42,6 @@ static int link_free_space(struct btrfs_free_space_ctl *ctl, struct btrfs_free_space *info);static void unlink_free_space (struct btrfs_free_space_ctl *ctl,struct btrfs_free_space *info); -static int btrfs_wait_cache_io_root (struct btrfs_root *root, -struct btrfs_trans_handle *trans, -struct btrfs_io_ctl *io_ctl, -struct btrfs_path *path); static struct inode *__lookup_free_space_inode(struct btrfs_root *root, struct btrfs_path *path,@@ -1234,8 +1230,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,struct btrfs_free_space_ctl *ctl, struct btrfs_block_group_cache *block_group, struct btrfs_io_ctl *io_ctl, - struct btrfs_trans_handle *trans, - struct btrfs_path *path, u64 offset) + struct btrfs_trans_handle *trans, u64 offset) { struct btrfs_fs_info *fs_info = root->fs_info;struct extent_state *cached_state =NULL ;@@ -1393,7 +1388,7 @@ int btrfs_write_out_cache(struct btrfs_fs_info *fs_info, ret =__btrfs_write_out_cache (fs_info->tree_root, inode, ctl, block_group, &block_group->io_ctl, trans, - path, block_group->key.objectid); + block_group->key.objectid);if (ret) {#ifdef DEBUG btrfs_err(fs_info,@@ -3541,7 +3536,7 @@ int btrfs_write_out_ino_cache(struct btrfs_root *root,memset (&io_ctl,0 ,sizeof (io_ctl)); ret =__btrfs_write_out_cache (root, inode, ctl,NULL , &io_ctl, - trans, path,0 ); + trans,0 );if (!ret) {/* * At this point writepages() didn't error out, so our metadata
Signature · 2 lines
Jeff Mahoney SUSE Labs
PATCH 6/8 btrfs: btrfs_truncate_free_space_cache always allocates path
In reply to [email protected]From: Jeff Mahoney <[email protected]>
btrfs_truncate_free_space_cache always allocates a btrfs_path structure but only uses it when the caller passes a block group. Let's move the allocation and free into the conditional.
--- fs/btrfs/free-space-cache.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
fs/btrfs/free-space-cache.c +6 -7
@@ -228,15 +228,14 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans, {struct btrfs_root *root =BTRFS_I (inode)->root;int ret =0 ; -struct btrfs_path *path =btrfs_alloc_path ();bool locked = false; -if (!path) { - ret = -ENOMEM ; - goto fail; - } -if (block_group) { +struct btrfs_path *path =btrfs_alloc_path (); +if (!path) { + ret = -ENOMEM ; + goto fail; + } locked = true;mutex_lock (&trans->transaction->cache_write_mutex);if (!list_empty (&block_group->io_list)) {
@@ -253,8 +252,8 @@ int btrfs_truncate_free_space_cache(struct btrfs_trans_handle *trans,spin_lock (&block_group->lock); block_group->disk_cache_state =BTRFS_DC_CLEAR ;spin_unlock (&block_group->lock); +btrfs_free_path (path); } -btrfs_free_path (path);btrfs_i_size_write (inode,0 );truncate_pagecache (inode,0 );
Signature · 1 line
2.7.1
PATCH 7/8 btrfs: drop unused extent_op arg from btrfs_add_delayed_data_ref
In reply to [email protected]From: Jeff Mahoney <[email protected]>
btrfs_add_delayed_data_ref is always called with a NULL extent_op, so let's drop the argument.
--- fs/btrfs/delayed-ref.c | 6 ++---- fs/btrfs/delayed-ref.h | 3 +-- fs/btrfs/extent-tree.c | 7 +++---- 3 files changed, 6 insertions(+), 10 deletions(-)
fs/btrfs/delayed-ref.c +2 -4
@@ -829,15 +829,13 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans, u64 bytenr, u64 num_bytes, u64 parent, u64 ref_root, - u64 owner, u64 offset, u64 reserved, int action, - struct btrfs_delayed_extent_op *extent_op) + u64 owner, u64 offset, u64 reserved, int action) { struct btrfs_delayed_data_ref *ref;struct btrfs_delayed_ref_head *head_ref;struct btrfs_delayed_ref_root *delayed_refs;struct btrfs_qgroup_extent_record *record =NULL ; -BUG_ON (extent_op && !extent_op->is_data); ref =kmem_cache_alloc (btrfs_delayed_data_ref_cachep,GFP_NOFS );if (!ref)return -ENOMEM ;
@@ -859,7 +857,7 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info, } } - head_ref->extent_op = extent_op; + head_ref->extent_op =NULL ; delayed_refs = &trans->transaction->delayed_refs;spin_lock (&delayed_refs->lock);
fs/btrfs/delayed-ref.h +1 -2
@@ -250,8 +250,7 @@ int btrfs_add_delayed_data_ref(struct btrfs_fs_info *fs_info,struct btrfs_trans_handle *trans, u64 bytenr, u64 num_bytes, u64 parent, u64 ref_root, - u64 owner, u64 offset, u64 reserved, int action, - struct btrfs_delayed_extent_op *extent_op); + u64 owner, u64 offset, u64 reserved, int action); int btrfs_add_delayed_extent_op(struct btrfs_fs_info *fs_info, struct btrfs_trans_handle *trans, u64 bytenr, u64 num_bytes,
fs/btrfs/extent-tree.c +3 -4
@@ -2095,7 +2095,7 @@ int btrfs_inc_extent_ref(struct btrfs_trans_handle *trans, ret =btrfs_add_delayed_data_ref (fs_info, trans, bytenr, num_bytes, parent, root_objectid, owner, offset,0 , -BTRFS_ADD_DELAYED_REF ,NULL ); +BTRFS_ADD_DELAYED_REF ); }return ret; }
@@ -7249,7 +7249,7 @@ int btrfs_free_extent(struct btrfs_trans_handle *trans, num_bytes, parent, root_objectid, owner, offset,0 , - BTRFS_DROP_DELAYED_REF, NULL); + BTRFS_DROP_DELAYED_REF); }return ret; }
@@ -8198,8 +8198,7 @@ int btrfs_alloc_reserved_file_extent(struct btrfs_trans_handle *trans, ret =btrfs_add_delayed_data_ref (fs_info, trans, ins->objectid, ins->offset,0 , root_objectid, owner, offset, - ram_bytes,BTRFS_ADD_DELAYED_EXTENT , -NULL ); + ram_bytes,BTRFS_ADD_DELAYED_EXTENT );return ret; }
Signature · 1 line
2.7.1
PATCH 8/8 btrfs: use btrfs_debug instead of pr_debug in transaction abort
In reply to [email protected]From: Jeff Mahoney <[email protected]>
Commit e5d6b12fe14 (Btrfs: don't WARN() in btrfs_transaction_abort() for IO errors) added a pr_debug call to be printed when a transaction is aborted with -EIO instead of WARN. btrfs_debug prints which file system the message is associated with so let's use that instead.
--- fs/btrfs/ctree.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/ctree.h +2 -1
@@ -3447,7 +3447,8 @@ do { \"BTRFS: Transaction aborted (error %d)\n" , \ (errno)); \ }else { \ -pr_debug ("BTRFS: Transaction aborted (error %d)\n" , \ +btrfs_debug ((trans)->fs_info, \ +"Transaction aborted (error %d)\n" , \ (errno)); \ } \ } \
Signature · 1 line
2.7.1
Quoted 10 lines · On Wed, Feb 15, 2017 at 04:28:26PM -0500, [email protected] wrote:
From: Jeff Mahoney <[email protected]>
Hi all -
Here's another around of cleanup patches. The first 7 cleanup API blemishes with unused arguments and/or root ->
fs_infoconversion. The last converts thepr_debuginbtrfs_abort_transactionto usebtrfs_debug.-Jeff
Quoted 10 lines
Jeff Mahoney (8):
btrfs: passfs_infoto (more) routines that are only called with
extent_root
btrfs:flush_spacealways takesfs_info->fs_root
btrfs: convertbtrfs_inc_block_group_roto acceptfs_info
btrfs: free-space-cache, clean up unnecessary root arguments
btrfs:btrfs_wait_cache_io_rootdoesn't use path argument
btrfs:btrfs_truncate_free_space_cachealways allocates path
btrfs: drop unusedextent_oparg frombtrfs_add_delayed_data_ref
btrfs: usebtrfs_debuginstead ofpr_debugin transaction abort
Thanks, added to 4.11 queue, with some minor fixups.