aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2016-09-09 21:39:03 -0400
committerDavid Sterba <dsterba@suse.com>2016-12-06 10:07:00 -0500
commit3a45bb207ee2c5548ebf6f5fcc7d249e141f15e8 (patch)
treea1739986199aebac91eca65c5eed7cbe7ad4fded /fs/btrfs/inode.c
parentbf89d38febaadd5b1da60fed54929cbde65fedf9 (diff)
btrfs: remove root parameter from transaction commit/end routines
Now we only use the root parameter to print the root objectid in a tracepoint. We can use the root parameter from the transaction handle for that. It's also used to join the transaction with async commits, so we remove the comment that it's just for checking. Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 5fa8aeb23e94..dbcec1ced85a 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -326,7 +326,7 @@ out:
326 */ 326 */
327 btrfs_qgroup_free_data(inode, 0, PAGE_SIZE); 327 btrfs_qgroup_free_data(inode, 0, PAGE_SIZE);
328 btrfs_free_path(path); 328 btrfs_free_path(path);
329 btrfs_end_transaction(trans, root); 329 btrfs_end_transaction(trans);
330 return ret; 330 return ret;
331} 331}
332 332
@@ -1534,7 +1534,7 @@ out_check:
1534 } 1534 }
1535 1535
1536error: 1536error:
1537 err = btrfs_end_transaction(trans, root); 1537 err = btrfs_end_transaction(trans);
1538 if (!ret) 1538 if (!ret)
1539 ret = err; 1539 ret = err;
1540 1540
@@ -2665,7 +2665,7 @@ again:
2665out_free_path: 2665out_free_path:
2666 btrfs_release_path(path); 2666 btrfs_release_path(path);
2667 path->leave_spinning = 0; 2667 path->leave_spinning = 0;
2668 btrfs_end_transaction(trans, root); 2668 btrfs_end_transaction(trans);
2669out_unlock: 2669out_unlock:
2670 unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end, 2670 unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, lock_end,
2671 &cached, GFP_NOFS); 2671 &cached, GFP_NOFS);
@@ -3011,7 +3011,7 @@ out:
3011 if (root != fs_info->tree_root) 3011 if (root != fs_info->tree_root)
3012 btrfs_delalloc_release_metadata(inode, ordered_extent->len); 3012 btrfs_delalloc_release_metadata(inode, ordered_extent->len);
3013 if (trans) 3013 if (trans)
3014 btrfs_end_transaction(trans, root); 3014 btrfs_end_transaction(trans);
3015 3015
3016 if (ret || truncated) { 3016 if (ret || truncated) {
3017 u64 start, end; 3017 u64 start, end;
@@ -3519,7 +3519,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
3519 found_key.objectid); 3519 found_key.objectid);
3520 ret = btrfs_del_orphan_item(trans, root, 3520 ret = btrfs_del_orphan_item(trans, root,
3521 found_key.objectid); 3521 found_key.objectid);
3522 btrfs_end_transaction(trans, root); 3522 btrfs_end_transaction(trans);
3523 if (ret) 3523 if (ret)
3524 goto out; 3524 goto out;
3525 continue; 3525 continue;
@@ -3549,7 +3549,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
3549 goto out; 3549 goto out;
3550 } 3550 }
3551 ret = btrfs_orphan_add(trans, inode); 3551 ret = btrfs_orphan_add(trans, inode);
3552 btrfs_end_transaction(trans, root); 3552 btrfs_end_transaction(trans);
3553 if (ret) { 3553 if (ret) {
3554 iput(inode); 3554 iput(inode);
3555 goto out; 3555 goto out;
@@ -3580,7 +3580,7 @@ int btrfs_orphan_cleanup(struct btrfs_root *root)
3580 test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)) { 3580 test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state)) {
3581 trans = btrfs_join_transaction(root); 3581 trans = btrfs_join_transaction(root);
3582 if (!IS_ERR(trans)) 3582 if (!IS_ERR(trans))
3583 btrfs_end_transaction(trans, root); 3583 btrfs_end_transaction(trans);
3584 } 3584 }
3585 3585
3586 if (nr_unlink) 3586 if (nr_unlink)
@@ -4156,7 +4156,7 @@ static int btrfs_unlink(struct inode *dir, struct dentry *dentry)
4156 } 4156 }
4157 4157
4158out: 4158out:
4159 btrfs_end_transaction(trans, root); 4159 btrfs_end_transaction(trans);
4160 btrfs_btree_balance_dirty(root->fs_info); 4160 btrfs_btree_balance_dirty(root->fs_info);
4161 return ret; 4161 return ret;
4162} 4162}
@@ -4293,7 +4293,7 @@ static int btrfs_rmdir(struct inode *dir, struct dentry *dentry)
4293 BTRFS_I(dir)->last_unlink_trans = last_unlink_trans; 4293 BTRFS_I(dir)->last_unlink_trans = last_unlink_trans;
4294 } 4294 }
4295out: 4295out:
4296 btrfs_end_transaction(trans, root); 4296 btrfs_end_transaction(trans);
4297 btrfs_btree_balance_dirty(root->fs_info); 4297 btrfs_btree_balance_dirty(root->fs_info);
4298 4298
4299 return err; 4299 return err;
@@ -4453,7 +4453,7 @@ search_again:
4453 * bytes_deleted is > 0, it will be huge by the time we get here 4453 * bytes_deleted is > 0, it will be huge by the time we get here
4454 */ 4454 */
4455 if (be_nice && bytes_deleted > SZ_32M) { 4455 if (be_nice && bytes_deleted > SZ_32M) {
4456 if (btrfs_should_end_transaction(trans, root)) { 4456 if (btrfs_should_end_transaction(trans)) {
4457 err = -EAGAIN; 4457 err = -EAGAIN;
4458 goto error; 4458 goto error;
4459 } 4459 }
@@ -4858,7 +4858,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
4858 ret = btrfs_drop_extents(trans, root, inode, offset, offset + len, 1); 4858 ret = btrfs_drop_extents(trans, root, inode, offset, offset + len, 1);
4859 if (ret) { 4859 if (ret) {
4860 btrfs_abort_transaction(trans, ret); 4860 btrfs_abort_transaction(trans, ret);
4861 btrfs_end_transaction(trans, root); 4861 btrfs_end_transaction(trans);
4862 return ret; 4862 return ret;
4863 } 4863 }
4864 4864
@@ -4868,7 +4868,7 @@ static int maybe_insert_hole(struct btrfs_root *root, struct inode *inode,
4868 btrfs_abort_transaction(trans, ret); 4868 btrfs_abort_transaction(trans, ret);
4869 else 4869 else
4870 btrfs_update_inode(trans, root, inode); 4870 btrfs_update_inode(trans, root, inode);
4871 btrfs_end_transaction(trans, root); 4871 btrfs_end_transaction(trans);
4872 return ret; 4872 return ret;
4873} 4873}
4874 4874
@@ -5032,7 +5032,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
5032 pagecache_isize_extended(inode, oldsize, newsize); 5032 pagecache_isize_extended(inode, oldsize, newsize);
5033 ret = btrfs_update_inode(trans, root, inode); 5033 ret = btrfs_update_inode(trans, root, inode);
5034 btrfs_end_write_no_snapshoting(root); 5034 btrfs_end_write_no_snapshoting(root);
5035 btrfs_end_transaction(trans, root); 5035 btrfs_end_transaction(trans);
5036 } else { 5036 } else {
5037 5037
5038 /* 5038 /*
@@ -5063,7 +5063,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
5063 * will be consistent. 5063 * will be consistent.
5064 */ 5064 */
5065 ret = btrfs_orphan_add(trans, inode); 5065 ret = btrfs_orphan_add(trans, inode);
5066 btrfs_end_transaction(trans, root); 5066 btrfs_end_transaction(trans);
5067 if (ret) 5067 if (ret)
5068 return ret; 5068 return ret;
5069 5069
@@ -5094,7 +5094,7 @@ static int btrfs_setsize(struct inode *inode, struct iattr *attr)
5094 err = btrfs_orphan_del(trans, inode); 5094 err = btrfs_orphan_del(trans, inode);
5095 if (err) 5095 if (err)
5096 btrfs_abort_transaction(trans, err); 5096 btrfs_abort_transaction(trans, err);
5097 btrfs_end_transaction(trans, root); 5097 btrfs_end_transaction(trans);
5098 } 5098 }
5099 } 5099 }
5100 5100
@@ -5355,7 +5355,7 @@ void btrfs_evict_inode(struct inode *inode)
5355 * again. 5355 * again.
5356 */ 5356 */
5357 if (ret) { 5357 if (ret) {
5358 ret = btrfs_commit_transaction(trans, root); 5358 ret = btrfs_commit_transaction(trans);
5359 if (ret) { 5359 if (ret) {
5360 btrfs_orphan_del(NULL, inode); 5360 btrfs_orphan_del(NULL, inode);
5361 btrfs_free_block_rsv(fs_info, rsv); 5361 btrfs_free_block_rsv(fs_info, rsv);
@@ -5373,7 +5373,7 @@ void btrfs_evict_inode(struct inode *inode)
5373 break; 5373 break;
5374 5374
5375 trans->block_rsv = &fs_info->trans_block_rsv; 5375 trans->block_rsv = &fs_info->trans_block_rsv;
5376 btrfs_end_transaction(trans, root); 5376 btrfs_end_transaction(trans);
5377 trans = NULL; 5377 trans = NULL;
5378 btrfs_btree_balance_dirty(fs_info); 5378 btrfs_btree_balance_dirty(fs_info);
5379 } 5379 }
@@ -5396,7 +5396,7 @@ void btrfs_evict_inode(struct inode *inode)
5396 root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID)) 5396 root->root_key.objectid == BTRFS_TREE_RELOC_OBJECTID))
5397 btrfs_return_ino(root, btrfs_ino(inode)); 5397 btrfs_return_ino(root, btrfs_ino(inode));
5398 5398
5399 btrfs_end_transaction(trans, root); 5399 btrfs_end_transaction(trans);
5400 btrfs_btree_balance_dirty(fs_info); 5400 btrfs_btree_balance_dirty(fs_info);
5401no_delete: 5401no_delete:
5402 btrfs_remove_delayed_node(inode); 5402 btrfs_remove_delayed_node(inode);
@@ -5975,7 +5975,7 @@ int btrfs_write_inode(struct inode *inode, struct writeback_control *wbc)
5975 trans = btrfs_join_transaction(root); 5975 trans = btrfs_join_transaction(root);
5976 if (IS_ERR(trans)) 5976 if (IS_ERR(trans))
5977 return PTR_ERR(trans); 5977 return PTR_ERR(trans);
5978 ret = btrfs_commit_transaction(trans, root); 5978 ret = btrfs_commit_transaction(trans);
5979 } 5979 }
5980 return ret; 5980 return ret;
5981} 5981}
@@ -6003,14 +6003,14 @@ static int btrfs_dirty_inode(struct inode *inode)
6003 ret = btrfs_update_inode(trans, root, inode); 6003 ret = btrfs_update_inode(trans, root, inode);
6004 if (ret && ret == -ENOSPC) { 6004 if (ret && ret == -ENOSPC) {
6005 /* whoops, lets try again with the full transaction */ 6005 /* whoops, lets try again with the full transaction */
6006 btrfs_end_transaction(trans, root); 6006 btrfs_end_transaction(trans);
6007 trans = btrfs_start_transaction(root, 1); 6007 trans = btrfs_start_transaction(root, 1);
6008 if (IS_ERR(trans)) 6008 if (IS_ERR(trans))
6009 return PTR_ERR(trans); 6009 return PTR_ERR(trans);
6010 6010
6011 ret = btrfs_update_inode(trans, root, inode); 6011 ret = btrfs_update_inode(trans, root, inode);
6012 } 6012 }
6013 btrfs_end_transaction(trans, root); 6013 btrfs_end_transaction(trans);
6014 if (BTRFS_I(inode)->delayed_node) 6014 if (BTRFS_I(inode)->delayed_node)
6015 btrfs_balance_delayed_items(fs_info); 6015 btrfs_balance_delayed_items(fs_info);
6016 6016
@@ -6448,7 +6448,7 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
6448 } 6448 }
6449 6449
6450out_unlock: 6450out_unlock:
6451 btrfs_end_transaction(trans, root); 6451 btrfs_end_transaction(trans);
6452 btrfs_balance_delayed_items(fs_info); 6452 btrfs_balance_delayed_items(fs_info);
6453 btrfs_btree_balance_dirty(fs_info); 6453 btrfs_btree_balance_dirty(fs_info);
6454 if (drop_inode) { 6454 if (drop_inode) {
@@ -6524,7 +6524,7 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
6524 d_instantiate(dentry, inode); 6524 d_instantiate(dentry, inode);
6525 6525
6526out_unlock: 6526out_unlock:
6527 btrfs_end_transaction(trans, root); 6527 btrfs_end_transaction(trans);
6528 if (err && drop_inode_on_err) { 6528 if (err && drop_inode_on_err) {
6529 inode_dec_link_count(inode); 6529 inode_dec_link_count(inode);
6530 iput(inode); 6530 iput(inode);
@@ -6606,7 +6606,7 @@ static int btrfs_link(struct dentry *old_dentry, struct inode *dir,
6606 btrfs_balance_delayed_items(fs_info); 6606 btrfs_balance_delayed_items(fs_info);
6607fail: 6607fail:
6608 if (trans) 6608 if (trans)
6609 btrfs_end_transaction(trans, root); 6609 btrfs_end_transaction(trans);
6610 if (drop_inode) { 6610 if (drop_inode) {
6611 inode_dec_link_count(inode); 6611 inode_dec_link_count(inode);
6612 iput(inode); 6612 iput(inode);
@@ -6675,7 +6675,7 @@ static int btrfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
6675 drop_on_err = 0; 6675 drop_on_err = 0;
6676 6676
6677out_fail: 6677out_fail:
6678 btrfs_end_transaction(trans, root); 6678 btrfs_end_transaction(trans);
6679 if (drop_on_err) { 6679 if (drop_on_err) {
6680 inode_dec_link_count(inode); 6680 inode_dec_link_count(inode);
6681 iput(inode); 6681 iput(inode);
@@ -7063,7 +7063,7 @@ out:
7063 7063
7064 btrfs_free_path(path); 7064 btrfs_free_path(path);
7065 if (trans) { 7065 if (trans) {
7066 ret = btrfs_end_transaction(trans, root); 7066 ret = btrfs_end_transaction(trans);
7067 if (!err) 7067 if (!err)
7068 err = ret; 7068 err = ret;
7069 } 7069 }
@@ -7386,7 +7386,7 @@ noinline int can_nocow_extent(struct inode *inode, u64 offset, u64 *len,
7386 7386
7387 ret = btrfs_cross_ref_exist(trans, root, btrfs_ino(inode), 7387 ret = btrfs_cross_ref_exist(trans, root, btrfs_ino(inode),
7388 key.offset - backref_offset, disk_bytenr); 7388 key.offset - backref_offset, disk_bytenr);
7389 btrfs_end_transaction(trans, root); 7389 btrfs_end_transaction(trans);
7390 if (ret) { 7390 if (ret) {
7391 ret = 0; 7391 ret = 0;
7392 goto out; 7392 goto out;
@@ -9200,7 +9200,7 @@ static int btrfs_truncate(struct inode *inode)
9200 break; 9200 break;
9201 } 9201 }
9202 9202
9203 btrfs_end_transaction(trans, root); 9203 btrfs_end_transaction(trans);
9204 btrfs_btree_balance_dirty(fs_info); 9204 btrfs_btree_balance_dirty(fs_info);
9205 9205
9206 trans = btrfs_start_transaction(root, 2); 9206 trans = btrfs_start_transaction(root, 2);
@@ -9229,7 +9229,7 @@ static int btrfs_truncate(struct inode *inode)
9229 if (ret && !err) 9229 if (ret && !err)
9230 err = ret; 9230 err = ret;
9231 9231
9232 ret = btrfs_end_transaction(trans, root); 9232 ret = btrfs_end_transaction(trans);
9233 btrfs_btree_balance_dirty(fs_info); 9233 btrfs_btree_balance_dirty(fs_info);
9234 } 9234 }
9235out: 9235out:
@@ -9697,7 +9697,7 @@ out_fail:
9697 dest_log_pinned = false; 9697 dest_log_pinned = false;
9698 } 9698 }
9699 } 9699 }
9700 ret = btrfs_end_transaction(trans, root); 9700 ret = btrfs_end_transaction(trans);
9701out_notrans: 9701out_notrans:
9702 if (new_ino == BTRFS_FIRST_FREE_OBJECTID) 9702 if (new_ino == BTRFS_FIRST_FREE_OBJECTID)
9703 up_read(&fs_info->subvol_sem); 9703 up_read(&fs_info->subvol_sem);
@@ -9967,7 +9967,7 @@ out_fail:
9967 btrfs_end_log_trans(root); 9967 btrfs_end_log_trans(root);
9968 log_pinned = false; 9968 log_pinned = false;
9969 } 9969 }
9970 btrfs_end_transaction(trans, root); 9970 btrfs_end_transaction(trans);
9971out_notrans: 9971out_notrans:
9972 if (old_ino == BTRFS_FIRST_FREE_OBJECTID) 9972 if (old_ino == BTRFS_FIRST_FREE_OBJECTID)
9973 up_read(&fs_info->subvol_sem); 9973 up_read(&fs_info->subvol_sem);
@@ -10300,7 +10300,7 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
10300 d_instantiate(dentry, inode); 10300 d_instantiate(dentry, inode);
10301 10301
10302out_unlock: 10302out_unlock:
10303 btrfs_end_transaction(trans, root); 10303 btrfs_end_transaction(trans);
10304 if (drop_inode) { 10304 if (drop_inode) {
10305 inode_dec_link_count(inode); 10305 inode_dec_link_count(inode);
10306 iput(inode); 10306 iput(inode);
@@ -10356,7 +10356,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
10356 min_size, 0, *alloc_hint, &ins, 1, 0); 10356 min_size, 0, *alloc_hint, &ins, 1, 0);
10357 if (ret) { 10357 if (ret) {
10358 if (own_trans) 10358 if (own_trans)
10359 btrfs_end_transaction(trans, root); 10359 btrfs_end_transaction(trans);
10360 break; 10360 break;
10361 } 10361 }
10362 btrfs_dec_block_group_reservations(fs_info, ins.objectid); 10362 btrfs_dec_block_group_reservations(fs_info, ins.objectid);
@@ -10372,7 +10372,7 @@ static int __btrfs_prealloc_file_range(struct inode *inode, int mode,
10372 ins.offset, 0); 10372 ins.offset, 0);
10373 btrfs_abort_transaction(trans, ret); 10373 btrfs_abort_transaction(trans, ret);
10374 if (own_trans) 10374 if (own_trans)
10375 btrfs_end_transaction(trans, root); 10375 btrfs_end_transaction(trans);
10376 break; 10376 break;
10377 } 10377 }
10378 10378
@@ -10432,12 +10432,12 @@ next:
10432 if (ret) { 10432 if (ret) {
10433 btrfs_abort_transaction(trans, ret); 10433 btrfs_abort_transaction(trans, ret);
10434 if (own_trans) 10434 if (own_trans)
10435 btrfs_end_transaction(trans, root); 10435 btrfs_end_transaction(trans);
10436 break; 10436 break;
10437 } 10437 }
10438 10438
10439 if (own_trans) 10439 if (own_trans)
10440 btrfs_end_transaction(trans, root); 10440 btrfs_end_transaction(trans);
10441 } 10441 }
10442 if (cur_offset < end) 10442 if (cur_offset < end)
10443 btrfs_free_reserved_data_space(inode, cur_offset, 10443 btrfs_free_reserved_data_space(inode, cur_offset,
@@ -10542,7 +10542,7 @@ static int btrfs_tmpfile(struct inode *dir, struct dentry *dentry, umode_t mode)
10542 mark_inode_dirty(inode); 10542 mark_inode_dirty(inode);
10543 10543
10544out: 10544out:
10545 btrfs_end_transaction(trans, root); 10545 btrfs_end_transaction(trans);
10546 if (ret) 10546 if (ret)
10547 iput(inode); 10547 iput(inode);
10548 btrfs_balance_delayed_items(fs_info); 10548 btrfs_balance_delayed_items(fs_info);