Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: remove no longer used stuff for tracking pending ordered extents

Tracking pending ordered extents per transaction was introduced in commit
50d9aa99bd35 ("Btrfs: make sure logged extents complete in the current
transaction V3") and later updated in commit 161c3549b45a ("Btrfs: change
how we wait for pending ordered extents").

However now that on fsync we always wait for ordered extents to complete
before logging, done in commit 5636cf7d6dc8 ("btrfs: remove the logged
extents infrastructure"), we no longer need the stuff to track for pending
ordered extents, which was not completely removed in the mentioned commit.
So remove the remaining of the pending ordered extents infrastructure.

Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>

authored by

Filipe Manana and committed by
David Sterba
85dd506c ce02f032

-45
-30
fs/btrfs/ordered-data.c
··· 460 460 struct btrfs_inode *btrfs_inode = BTRFS_I(inode); 461 461 struct btrfs_root *root = btrfs_inode->root; 462 462 struct rb_node *node; 463 - bool dec_pending_ordered = false; 464 463 465 464 /* This is paired with btrfs_add_ordered_extent. */ 466 465 spin_lock(&btrfs_inode->lock); ··· 476 477 if (tree->last == node) 477 478 tree->last = NULL; 478 479 set_bit(BTRFS_ORDERED_COMPLETE, &entry->flags); 479 - if (test_and_clear_bit(BTRFS_ORDERED_PENDING, &entry->flags)) 480 - dec_pending_ordered = true; 481 480 spin_unlock_irq(&tree->lock); 482 - 483 - /* 484 - * The current running transaction is waiting on us, we need to let it 485 - * know that we're complete and wake it up. 486 - */ 487 - if (dec_pending_ordered) { 488 - struct btrfs_transaction *trans; 489 - 490 - /* 491 - * The checks for trans are just a formality, it should be set, 492 - * but if it isn't we don't want to deref/assert under the spin 493 - * lock, so be nice and check if trans is set, but ASSERT() so 494 - * if it isn't set a developer will notice. 495 - */ 496 - spin_lock(&fs_info->trans_lock); 497 - trans = fs_info->running_transaction; 498 - if (trans) 499 - refcount_inc(&trans->use_count); 500 - spin_unlock(&fs_info->trans_lock); 501 - 502 - ASSERT(trans); 503 - if (trans) { 504 - if (atomic_dec_and_test(&trans->pending_ordered)) 505 - wake_up(&trans->pending_wait); 506 - btrfs_put_transaction(trans); 507 - } 508 - } 509 481 510 482 spin_lock(&root->ordered_extent_lock); 511 483 list_del_init(&entry->root_extent_list);
-2
fs/btrfs/ordered-data.h
··· 56 56 * the isize. */ 57 57 #define BTRFS_ORDERED_TRUNCATED 8 /* Set when we have to truncate an extent */ 58 58 59 - #define BTRFS_ORDERED_PENDING 9 /* We are waiting for this ordered extent to 60 - * complete in the current transaction. */ 61 59 #define BTRFS_ORDERED_REGULAR 10 /* Regular IO for COW */ 62 60 63 61 struct btrfs_ordered_extent {
-11
fs/btrfs/transaction.c
··· 233 233 extwriter_counter_init(cur_trans, type); 234 234 init_waitqueue_head(&cur_trans->writer_wait); 235 235 init_waitqueue_head(&cur_trans->commit_wait); 236 - init_waitqueue_head(&cur_trans->pending_wait); 237 236 cur_trans->state = TRANS_STATE_RUNNING; 238 237 /* 239 238 * One for this trans handle, one so it will live on until we 240 239 * commit the transaction. 241 240 */ 242 241 refcount_set(&cur_trans->use_count, 2); 243 - atomic_set(&cur_trans->pending_ordered, 0); 244 242 cur_trans->flags = 0; 245 243 cur_trans->start_time = ktime_get_seconds(); 246 244 ··· 1909 1911 btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); 1910 1912 } 1911 1913 1912 - static inline void 1913 - btrfs_wait_pending_ordered(struct btrfs_transaction *cur_trans) 1914 - { 1915 - wait_event(cur_trans->pending_wait, 1916 - atomic_read(&cur_trans->pending_ordered) == 0); 1917 - } 1918 - 1919 1914 int btrfs_commit_transaction(struct btrfs_trans_handle *trans) 1920 1915 { 1921 1916 struct btrfs_fs_info *fs_info = trans->fs_info; ··· 2042 2051 goto cleanup_transaction; 2043 2052 2044 2053 btrfs_wait_delalloc_flush(fs_info); 2045 - 2046 - btrfs_wait_pending_ordered(cur_trans); 2047 2054 2048 2055 btrfs_scrub_pause(fs_info); 2049 2056 /*
-2
fs/btrfs/transaction.h
··· 39 39 */ 40 40 atomic_t num_writers; 41 41 refcount_t use_count; 42 - atomic_t pending_ordered; 43 42 44 43 unsigned long flags; 45 44 ··· 50 51 time64_t start_time; 51 52 wait_queue_head_t writer_wait; 52 53 wait_queue_head_t commit_wait; 53 - wait_queue_head_t pending_wait; 54 54 struct list_head pending_snapshots; 55 55 struct list_head pending_chunks; 56 56 struct list_head switch_commits;