aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-09-17 10:55:51 -0400
committerChris Mason <chris.mason@fusionio.com>2013-09-21 11:05:27 -0400
commitf0de181c9b48a397c5a2fbe63dcdd2a26a872695 (patch)
tree02dcf2a9806c241e96b7c47dbbc19f6f249f7a57
parentc4fbb4300abd6f662c7d5049d01f868af9874069 (diff)
Btrfs: kill delay_iput arg to the wait_ordered functions
This is a left over of how we used to wait for ordered extents, which was to grab the inode and then run filemap flush on it. However if we have an ordered extent then we already are holding a ref on the inode, and we just use btrfs_start_ordered_extent anyway, so there is no reason to have an extra ref on the inode to start work on the ordered extent. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
-rw-r--r--fs/btrfs/dev-replace.c4
-rw-r--r--fs/btrfs/extent-tree.c6
-rw-r--r--fs/btrfs/ioctl.c2
-rw-r--r--fs/btrfs/ordered-data.c24
-rw-r--r--fs/btrfs/ordered-data.h5
-rw-r--r--fs/btrfs/relocation.c2
-rw-r--r--fs/btrfs/super.c2
-rw-r--r--fs/btrfs/transaction.c2
8 files changed, 14 insertions, 33 deletions
diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c
index af800ef677a0..5d844438b2d4 100644
--- a/fs/btrfs/dev-replace.c
+++ b/fs/btrfs/dev-replace.c
@@ -400,7 +400,7 @@ int btrfs_dev_replace_start(struct btrfs_root *root,
400 args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR; 400 args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR;
401 btrfs_dev_replace_unlock(dev_replace); 401 btrfs_dev_replace_unlock(dev_replace);
402 402
403 btrfs_wait_all_ordered_extents(root->fs_info, 0); 403 btrfs_wait_all_ordered_extents(root->fs_info);
404 404
405 /* force writing the updated state information to disk */ 405 /* force writing the updated state information to disk */
406 trans = btrfs_start_transaction(root, 0); 406 trans = btrfs_start_transaction(root, 0);
@@ -475,7 +475,7 @@ static int btrfs_dev_replace_finishing(struct btrfs_fs_info *fs_info,
475 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount); 475 mutex_unlock(&dev_replace->lock_finishing_cancel_unmount);
476 return ret; 476 return ret;
477 } 477 }
478 btrfs_wait_all_ordered_extents(root->fs_info, 0); 478 btrfs_wait_all_ordered_extents(root->fs_info);
479 479
480 trans = btrfs_start_transaction(root, 0); 480 trans = btrfs_start_transaction(root, 0);
481 if (IS_ERR(trans)) { 481 if (IS_ERR(trans)) {
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 07f7f6942128..88c6db611de3 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -3991,7 +3991,7 @@ static void btrfs_writeback_inodes_sb_nr(struct btrfs_root *root,
3991 */ 3991 */
3992 btrfs_start_all_delalloc_inodes(root->fs_info, 0); 3992 btrfs_start_all_delalloc_inodes(root->fs_info, 0);
3993 if (!current->journal_info) 3993 if (!current->journal_info)
3994 btrfs_wait_all_ordered_extents(root->fs_info, 0); 3994 btrfs_wait_all_ordered_extents(root->fs_info);
3995 } 3995 }
3996} 3996}
3997 3997
@@ -4021,7 +4021,7 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
4021 if (delalloc_bytes == 0) { 4021 if (delalloc_bytes == 0) {
4022 if (trans) 4022 if (trans)
4023 return; 4023 return;
4024 btrfs_wait_all_ordered_extents(root->fs_info, 0); 4024 btrfs_wait_all_ordered_extents(root->fs_info);
4025 return; 4025 return;
4026 } 4026 }
4027 4027
@@ -4049,7 +4049,7 @@ static void shrink_delalloc(struct btrfs_root *root, u64 to_reclaim, u64 orig,
4049 4049
4050 loops++; 4050 loops++;
4051 if (wait_ordered && !trans) { 4051 if (wait_ordered && !trans) {
4052 btrfs_wait_all_ordered_extents(root->fs_info, 0); 4052 btrfs_wait_all_ordered_extents(root->fs_info);
4053 } else { 4053 } else {
4054 time_left = schedule_timeout_killable(1); 4054 time_left = schedule_timeout_killable(1);
4055 if (time_left) 4055 if (time_left)
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 1a5b9462dd9a..fd6557e7118a 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -574,7 +574,7 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
574 if (ret) 574 if (ret)
575 return ret; 575 return ret;
576 576
577 btrfs_wait_ordered_extents(root, 0); 577 btrfs_wait_ordered_extents(root);
578 578
579 pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_NOFS); 579 pending_snapshot = kzalloc(sizeof(*pending_snapshot), GFP_NOFS);
580 if (!pending_snapshot) 580 if (!pending_snapshot)
diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
index 966b413a33b8..c702cb62f78a 100644
--- a/fs/btrfs/ordered-data.c
+++ b/fs/btrfs/ordered-data.c
@@ -563,11 +563,10 @@ static void btrfs_run_ordered_extent_work(struct btrfs_work *work)
563 * wait for all the ordered extents in a root. This is done when balancing 563 * wait for all the ordered extents in a root. This is done when balancing
564 * space between drives. 564 * space between drives.
565 */ 565 */
566void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput) 566void btrfs_wait_ordered_extents(struct btrfs_root *root)
567{ 567{
568 struct list_head splice, works; 568 struct list_head splice, works;
569 struct btrfs_ordered_extent *ordered, *next; 569 struct btrfs_ordered_extent *ordered, *next;
570 struct inode *inode;
571 570
572 INIT_LIST_HEAD(&splice); 571 INIT_LIST_HEAD(&splice);
573 INIT_LIST_HEAD(&works); 572 INIT_LIST_HEAD(&works);
@@ -580,15 +579,6 @@ void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput)
580 root_extent_list); 579 root_extent_list);
581 list_move_tail(&ordered->root_extent_list, 580 list_move_tail(&ordered->root_extent_list,
582 &root->ordered_extents); 581 &root->ordered_extents);
583 /*
584 * the inode may be getting freed (in sys_unlink path).
585 */
586 inode = igrab(ordered->inode);
587 if (!inode) {
588 cond_resched_lock(&root->ordered_extent_lock);
589 continue;
590 }
591
592 atomic_inc(&ordered->refs); 582 atomic_inc(&ordered->refs);
593 spin_unlock(&root->ordered_extent_lock); 583 spin_unlock(&root->ordered_extent_lock);
594 584
@@ -605,21 +595,13 @@ void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput)
605 list_for_each_entry_safe(ordered, next, &works, work_list) { 595 list_for_each_entry_safe(ordered, next, &works, work_list) {
606 list_del_init(&ordered->work_list); 596 list_del_init(&ordered->work_list);
607 wait_for_completion(&ordered->completion); 597 wait_for_completion(&ordered->completion);
608
609 inode = ordered->inode;
610 btrfs_put_ordered_extent(ordered); 598 btrfs_put_ordered_extent(ordered);
611 if (delay_iput)
612 btrfs_add_delayed_iput(inode);
613 else
614 iput(inode);
615
616 cond_resched(); 599 cond_resched();
617 } 600 }
618 mutex_unlock(&root->fs_info->ordered_operations_mutex); 601 mutex_unlock(&root->fs_info->ordered_operations_mutex);
619} 602}
620 603
621void btrfs_wait_all_ordered_extents(struct btrfs_fs_info *fs_info, 604void btrfs_wait_all_ordered_extents(struct btrfs_fs_info *fs_info)
622 int delay_iput)
623{ 605{
624 struct btrfs_root *root; 606 struct btrfs_root *root;
625 struct list_head splice; 607 struct list_head splice;
@@ -637,7 +619,7 @@ void btrfs_wait_all_ordered_extents(struct btrfs_fs_info *fs_info,
637 &fs_info->ordered_roots); 619 &fs_info->ordered_roots);
638 spin_unlock(&fs_info->ordered_root_lock); 620 spin_unlock(&fs_info->ordered_root_lock);
639 621
640 btrfs_wait_ordered_extents(root, delay_iput); 622 btrfs_wait_ordered_extents(root);
641 btrfs_put_fs_root(root); 623 btrfs_put_fs_root(root);
642 624
643 spin_lock(&fs_info->ordered_root_lock); 625 spin_lock(&fs_info->ordered_root_lock);
diff --git a/fs/btrfs/ordered-data.h b/fs/btrfs/ordered-data.h
index d9a5aa097b4f..0c0b35612d7a 100644
--- a/fs/btrfs/ordered-data.h
+++ b/fs/btrfs/ordered-data.h
@@ -195,9 +195,8 @@ int btrfs_run_ordered_operations(struct btrfs_trans_handle *trans,
195void btrfs_add_ordered_operation(struct btrfs_trans_handle *trans, 195void btrfs_add_ordered_operation(struct btrfs_trans_handle *trans,
196 struct btrfs_root *root, 196 struct btrfs_root *root,
197 struct inode *inode); 197 struct inode *inode);
198void btrfs_wait_ordered_extents(struct btrfs_root *root, int delay_iput); 198void btrfs_wait_ordered_extents(struct btrfs_root *root);
199void btrfs_wait_all_ordered_extents(struct btrfs_fs_info *fs_info, 199void btrfs_wait_all_ordered_extents(struct btrfs_fs_info *fs_info);
200 int delay_iput);
201void btrfs_get_logged_extents(struct btrfs_root *log, struct inode *inode); 200void btrfs_get_logged_extents(struct btrfs_root *log, struct inode *inode);
202void btrfs_wait_logged_extents(struct btrfs_root *log, u64 transid); 201void btrfs_wait_logged_extents(struct btrfs_root *log, u64 transid);
203void btrfs_free_logged_extents(struct btrfs_root *log, u64 transid); 202void btrfs_free_logged_extents(struct btrfs_root *log, u64 transid);
diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
index 09b2b9a0a491..a5a26320503f 100644
--- a/fs/btrfs/relocation.c
+++ b/fs/btrfs/relocation.c
@@ -4246,7 +4246,7 @@ int btrfs_relocate_block_group(struct btrfs_root *extent_root, u64 group_start)
4246 err = ret; 4246 err = ret;
4247 goto out; 4247 goto out;
4248 } 4248 }
4249 btrfs_wait_all_ordered_extents(fs_info, 0); 4249 btrfs_wait_all_ordered_extents(fs_info);
4250 4250
4251 while (1) { 4251 while (1) {
4252 mutex_lock(&fs_info->cleaner_mutex); 4252 mutex_lock(&fs_info->cleaner_mutex);
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 58cb83f23b1a..b341da3ee3ee 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -921,7 +921,7 @@ int btrfs_sync_fs(struct super_block *sb, int wait)
921 return 0; 921 return 0;
922 } 922 }
923 923
924 btrfs_wait_all_ordered_extents(fs_info, 1); 924 btrfs_wait_all_ordered_extents(fs_info);
925 925
926 trans = btrfs_attach_transaction_barrier(root); 926 trans = btrfs_attach_transaction_barrier(root);
927 if (IS_ERR(trans)) { 927 if (IS_ERR(trans)) {
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index cac4a3f76323..e7a95356df83 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -1603,7 +1603,7 @@ static inline int btrfs_start_delalloc_flush(struct btrfs_fs_info *fs_info)
1603static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info) 1603static inline void btrfs_wait_delalloc_flush(struct btrfs_fs_info *fs_info)
1604{ 1604{
1605 if (btrfs_test_opt(fs_info->tree_root, FLUSHONCOMMIT)) 1605 if (btrfs_test_opt(fs_info->tree_root, FLUSHONCOMMIT))
1606 btrfs_wait_all_ordered_extents(fs_info, 1); 1606 btrfs_wait_all_ordered_extents(fs_info);
1607} 1607}
1608 1608
1609int btrfs_commit_transaction(struct btrfs_trans_handle *trans, 1609int btrfs_commit_transaction(struct btrfs_trans_handle *trans,