Skip to content

ext4: get discard out of jbd2 commit kthread

Wang Jianchao linux-ext4 lkml 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest5 patches 1 replyIn review
  2. v35 patches 17 repliesSuperseded
  3. v20 of 7 patches 0 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v11 patch6 repliesSuperseded

Changes in v4 from the cover letter

- In patch 1, avoid modify two lines in patch 1 when remove 'grou'p parameter
- In patch 4, remove redunbant queue_work() in ext4_mb_release(). And queue background discard work to system_unbound_wq as it is not a urgent task.
- In patch 5, flush discard kwork in ext4_should_retry_alloc(), instead of invoke ext4_should_retry_alloc in fallocate again.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5ext4: remove the 'group' parameter of ext4_trim_extentfs/ext4/mballoc.c+3 -40 replies
2/5ext4: add new helper interface ext4_try_to_trim_range()fs/ext4/mballoc.c+57 -450 replies
3/5ext4: remove the repeated comment of ext4_trim_all_freefs/ext4/mballoc.c+1 -60 replies
4/5ext4: get discard out of jbd2 commit kthread contexfs/ext4/ext4.h fs/ext4/mballoc.c+78 -251 reply
5/5ext4: flush background discard kwork when retry allocationfs/ext4/balloc.c fs/ext4/ext4.h fs/ext4/mballoc.c+13 -30 replies

Reviews trailers per patch

4 of 5 patches have a Reviewed-by or Acked-by.

PatchAndreas DilgerJan Kara
1/5R-b R-b
2/5R-b R-b
3/5R-b R-b
4/5R-b
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH V4 0/5] ext4: get discard out of jbd2 commit kthread

Hi all

This is the version 4 patch set that attempts to get discard out of the jbd2 commit kthread. When the user delete a lot data and cause discard flooding, the jbd2 commit kthread can be blocked for very long time and then all of the metadata operations are blocked due to no journal space.

The xfstest with following parameters,
MODULAR=0
TEST_DIR=/mnt/test
TEST_DEV=/dev/nbd37p1
SCRATCH_MNT=/mnt/scratch
SCRATCH_DEV=/dev/nbd37p2
MOUNT_OPTIONS="-o discard"
has passed. The result is consistent w/ or w/o this patch set.

There are 5 patches,

Patch 1 ~ 3, there are no functional changes in them, but just some preparation for following patches

Patch 4 introduces a async kworker to do discard in fstrim fation which implements the core idea of this patch set.

Patch 5 flush discard background work in ext4_should_retry_alloc, This fix the generic/371

Any comments are welcome ;)

V3 -> V4:
- In patch 1, avoid modify two lines in patch 1 when remove 'grou'p parameter
- In patch 4, remove redunbant queue_work() in ext4_mb_release(). And queue background discard work to system_unbound_wq as it is not a urgent task.
- In patch 5, flush discard kwork in ext4_should_retry_alloc(), instead of invoke ext4_should_retry_alloc in fallocate again.

V2 -> V3
- Get rid of the per block group rb tree which carries freed entry. It is not neccesary because we have done aggregation when wait for journal commit. Just use a list to carry the free entries.

V1 -> V2
- free the blocks back to mb buddy after commit and then do ftrim fashion discard

 fs/ext4/balloc.c  |   8 ++-
 fs/ext4/ext4.h    |   3 ++
 fs/ext4/mballoc.c | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
 3 files changed, 148 insertions(+), 79 deletions(-)