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

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'for-5.0-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux

Pull btrfs fixes from David Sterba:
"A handful of fixes (some of them in testing for a long time):

- fix some test failures regarding cleanup after transaction abort

- revert of a patch that could cause a deadlock

- delayed iput fixes, that can help in ENOSPC situation when there's
low space and a lot data to write"

* tag 'for-5.0-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
btrfs: wakeup cleaner thread when adding delayed iput
btrfs: run delayed iputs before committing
btrfs: wait on ordered extents on abort cleanup
btrfs: handle delayed ref head accounting cleanup in abort
Revert "btrfs: balance dirty metadata pages in btrfs_finish_ordered_io"

+35 -10
+7
fs/btrfs/ctree.h
··· 35 35 struct btrfs_trans_handle; 36 36 struct btrfs_transaction; 37 37 struct btrfs_pending_snapshot; 38 + struct btrfs_delayed_ref_root; 38 39 extern struct kmem_cache *btrfs_trans_handle_cachep; 39 40 extern struct kmem_cache *btrfs_bit_radix_cachep; 40 41 extern struct kmem_cache *btrfs_path_cachep; ··· 787 786 * main phase. The fs_info::balance_ctl is initialized. 788 787 */ 789 788 BTRFS_FS_BALANCE_RUNNING, 789 + 790 + /* Indicate that the cleaner thread is awake and doing something. */ 791 + BTRFS_FS_CLEANER_RUNNING, 790 792 }; 791 793 792 794 struct btrfs_fs_info { ··· 2665 2661 unsigned long count); 2666 2662 int btrfs_async_run_delayed_refs(struct btrfs_fs_info *fs_info, 2667 2663 unsigned long count, u64 transid, int wait); 2664 + void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info, 2665 + struct btrfs_delayed_ref_root *delayed_refs, 2666 + struct btrfs_delayed_ref_head *head); 2668 2667 int btrfs_lookup_data_extent(struct btrfs_fs_info *fs_info, u64 start, u64 len); 2669 2668 int btrfs_lookup_extent_info(struct btrfs_trans_handle *trans, 2670 2669 struct btrfs_fs_info *fs_info, u64 bytenr,
+12
fs/btrfs/disk-io.c
··· 1682 1682 while (1) { 1683 1683 again = 0; 1684 1684 1685 + set_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags); 1686 + 1685 1687 /* Make the cleaner go to sleep early. */ 1686 1688 if (btrfs_need_cleaner_sleep(fs_info)) 1687 1689 goto sleep; ··· 1730 1728 */ 1731 1729 btrfs_delete_unused_bgs(fs_info); 1732 1730 sleep: 1731 + clear_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags); 1733 1732 if (kthread_should_park()) 1734 1733 kthread_parkme(); 1735 1734 if (kthread_should_stop()) ··· 4204 4201 spin_lock(&fs_info->ordered_root_lock); 4205 4202 } 4206 4203 spin_unlock(&fs_info->ordered_root_lock); 4204 + 4205 + /* 4206 + * We need this here because if we've been flipped read-only we won't 4207 + * get sync() from the umount, so we need to make sure any ordered 4208 + * extents that haven't had their dirty pages IO start writeout yet 4209 + * actually get run and error out properly. 4210 + */ 4211 + btrfs_wait_ordered_roots(fs_info, U64_MAX, 0, (u64)-1); 4207 4212 } 4208 4213 4209 4214 static int btrfs_destroy_delayed_refs(struct btrfs_transaction *trans, ··· 4276 4265 if (pin_bytes) 4277 4266 btrfs_pin_extent(fs_info, head->bytenr, 4278 4267 head->num_bytes, 1); 4268 + btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head); 4279 4269 btrfs_put_delayed_ref_head(head); 4280 4270 cond_resched(); 4281 4271 spin_lock(&delayed_refs->lock);
+14 -7
fs/btrfs/extent-tree.c
··· 2456 2456 return ret ? ret : 1; 2457 2457 } 2458 2458 2459 - static void cleanup_ref_head_accounting(struct btrfs_trans_handle *trans, 2460 - struct btrfs_delayed_ref_head *head) 2459 + void btrfs_cleanup_ref_head_accounting(struct btrfs_fs_info *fs_info, 2460 + struct btrfs_delayed_ref_root *delayed_refs, 2461 + struct btrfs_delayed_ref_head *head) 2461 2462 { 2462 - struct btrfs_fs_info *fs_info = trans->fs_info; 2463 - struct btrfs_delayed_ref_root *delayed_refs = 2464 - &trans->transaction->delayed_refs; 2465 2463 int nr_items = 1; /* Dropping this ref head update. */ 2466 2464 2467 2465 if (head->total_ref_mod < 0) { ··· 2542 2544 } 2543 2545 } 2544 2546 2545 - cleanup_ref_head_accounting(trans, head); 2547 + btrfs_cleanup_ref_head_accounting(fs_info, delayed_refs, head); 2546 2548 2547 2549 trace_run_delayed_ref_head(fs_info, head, 0); 2548 2550 btrfs_delayed_ref_unlock(head); ··· 4952 4954 ret = 0; 4953 4955 break; 4954 4956 case COMMIT_TRANS: 4957 + /* 4958 + * If we have pending delayed iputs then we could free up a 4959 + * bunch of pinned space, so make sure we run the iputs before 4960 + * we do our pinned bytes check below. 4961 + */ 4962 + mutex_lock(&fs_info->cleaner_delayed_iput_mutex); 4963 + btrfs_run_delayed_iputs(fs_info); 4964 + mutex_unlock(&fs_info->cleaner_delayed_iput_mutex); 4965 + 4955 4966 ret = may_commit_transaction(fs_info, space_info); 4956 4967 break; 4957 4968 default: ··· 7195 7188 if (head->must_insert_reserved) 7196 7189 ret = 1; 7197 7190 7198 - cleanup_ref_head_accounting(trans, head); 7191 + btrfs_cleanup_ref_head_accounting(trans->fs_info, delayed_refs, head); 7199 7192 mutex_unlock(&head->mutex); 7200 7193 btrfs_put_delayed_ref_head(head); 7201 7194 return ret;
+2 -3
fs/btrfs/inode.c
··· 3129 3129 /* once for the tree */ 3130 3130 btrfs_put_ordered_extent(ordered_extent); 3131 3131 3132 - /* Try to release some metadata so we don't get an OOM but don't wait */ 3133 - btrfs_btree_balance_dirty_nodelay(fs_info); 3134 - 3135 3132 return ret; 3136 3133 } 3137 3134 ··· 3251 3254 ASSERT(list_empty(&binode->delayed_iput)); 3252 3255 list_add_tail(&binode->delayed_iput, &fs_info->delayed_iputs); 3253 3256 spin_unlock(&fs_info->delayed_iput_lock); 3257 + if (!test_bit(BTRFS_FS_CLEANER_RUNNING, &fs_info->flags)) 3258 + wake_up_process(fs_info->cleaner_kthread); 3254 3259 } 3255 3260 3256 3261 void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info)