Skip to contentSkip to conversation

ext4: get discard out of jbd2 commit context

PATCH Superseded Wang Jianchao 4 participants 23 messages Jul 24, 2021 – Aug 26, 2021 ext4 file system

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover ext4: get discard out of jbd2 commit context

Hi all

This is the version 3 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 let the fallocate retry when err is ENOSPC. This fix the generic/371

Any comments are welcome ;)

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/ext4.h    |   2 +
 fs/ext4/extents.c |   6 ++-
 fs/ext4/mballoc.c | 223 ++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
 3 files changed, 151 insertions(+), 80 deletions(-)
#1 lore raw

PATCH v3 1/5 ext4: remove the 'group' parameter of ext4_trim_extent

From: Wang Jianchao <[email protected]>

Get rid of the 'group' parameter of ext4_trim_extent as we can get it from the 'e4b'.

---
 fs/ext4/mballoc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/ext4/mballoc.c +4 -5
index 089c958aa2c3..018d5d3c6eeb 100644
@@ -6183,19 +6183,19 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
  * @sb:		super block for the file system
  * @start:	starting block of the free extent in the alloc. group
  * @count:	number of blocks to TRIM
- * @group:	alloc. group we are working with
  * @e4b:	ext4 buddy for the group
  *
  * Trim "count" blocks starting at "start" in the "group". To assure that no
  * one will allocate those blocks, mark it as used in buddy bitmap. This must
  * be called with under the group lock.
  */
-static int ext4_trim_extent(struct super_block *sb, int start, int count,
-			     ext4_group_t group, struct ext4_buddy *e4b)
+static int ext4_trim_extent(struct super_block *sb,
+		int start, int count, struct ext4_buddy *e4b)
 __releases(bitlock)
 __acquires(bitlock)
 {
 	struct ext4_free_extent ex;
+	ext4_group_t group = e4b->bd_group;
 	int ret = 0;
 
 	trace_ext4_trim_extent(sb, group, start, count);
@@ -6271,8 +6271,7 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 		next = mb_find_next_bit(bitmap, max + 1, start);
 
 		if ((next - start) >= minblocks) {
-			ret = ext4_trim_extent(sb, start,
-					       next - start, group, &e4b);
+			ret = ext4_trim_extent(sb, start, next - start, &e4b);
 			if (ret && ret != -EOPNOTSUPP)
 				break;
 			ret = 0;
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH V3 1/5] ext4: remove the 'group' parameter of ext4_trim_extent

fs/ext4/mballoc.c int ext4_group_add_blocks(handle_t *handle, struct super_block *sb, · line 6193

Quoted 4 lines · Wang Jianchao
fs/ext4/mballoc.c +2 -2
-static int ext4_trim_extent(struct super_block *sb, int start, int count,
-			     ext4_group_t group, struct ext4_buddy *e4b)
+static int ext4_trim_extent(struct super_block *sb,
+		int start, int count, struct ext4_buddy *e4b)

Nit, seems only need to change the second line.

Thanks,
Guoqing

reviewer Reviewed-by on v3 1/5
#3 lore raw

Re: [PATCH V3 1/5] ext4: remove the 'group' parameter of ext4_trim_extent

In reply to Wang Jianchao
Quoted 7 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

Get rid of the 'group' parameter of ext4_trim_extent as we can get it from the 'e4b'.

Looks good. Feel free to add:

Honza

Quoted 44 lines
---
 fs/ext4/mballoc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
fs/ext4/mballoc.c +4 -5
index 089c958aa2c3..018d5d3c6eeb 100644
@@ -6183,19 +6183,19 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
  * @sb:		super block for the file system
  * @start:	starting block of the free extent in the alloc. group
  * @count:	number of blocks to TRIM
- * @group:	alloc. group we are working with
  * @e4b:	ext4 buddy for the group
  *
  * Trim "count" blocks starting at "start" in the "group". To assure that no
  * one will allocate those blocks, mark it as used in buddy bitmap. This must
  * be called with under the group lock.
  */
-static int ext4_trim_extent(struct super_block *sb, int start, int count,
-			     ext4_group_t group, struct ext4_buddy *e4b)
+static int ext4_trim_extent(struct super_block *sb,
+		int start, int count, struct ext4_buddy *e4b)
 __releases(bitlock)
 __acquires(bitlock)
 {
 	struct ext4_free_extent ex;
+	ext4_group_t group = e4b->bd_group;
 	int ret = 0;
 
 	trace_ext4_trim_extent(sb, group, start, count);
@@ -6271,8 +6271,7 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 		next = mb_find_next_bit(bitmap, max + 1, start);
 
 		if ((next - start) >= minblocks) {
-			ret = ext4_trim_extent(sb, start,
-					       next - start, group, &e4b);
+			ret = ext4_trim_extent(sb, start, next - start, &e4b);
 			if (ret && ret != -EOPNOTSUPP)
 				break;
 			ret = 0;
Signature · 1 line
2.17.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#4 lore raw

PATCH v3 2/5 ext4: add new helper interface ext4_try_to_trim_range()

In reply to Wang Jianchao

From: Wang Jianchao <[email protected]>

There is no functional change in this patch but just split the codes, which serachs free block and does trim, into a new function ext4_try_to_trim_range. This is preparing for the following async backgroup discard.

---
 fs/ext4/mballoc.c | 102 ++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 45 deletions(-)
fs/ext4/mballoc.c +57 -45
index 018d5d3c6eeb..e3844152a643 100644
@@ -6218,6 +6218,54 @@ __acquires(bitlock)
 	return ret;
 }
 
+static int ext4_try_to_trim_range(struct super_block *sb,
+		struct ext4_buddy *e4b, ext4_grpblk_t start,
+		ext4_grpblk_t max, ext4_grpblk_t minblocks)
+{
+	ext4_grpblk_t next, count, free_count;
+	void *bitmap;
+	int ret = 0;
+
+	bitmap = e4b->bd_bitmap;
+	start = (e4b->bd_info->bb_first_free > start) ?
+		e4b->bd_info->bb_first_free : start;
+	count = 0;
+	free_count = 0;
+
+	while (start <= max) {
+		start = mb_find_next_zero_bit(bitmap, max + 1, start);
+		if (start > max)
+			break;
+		next = mb_find_next_bit(bitmap, max + 1, start);
+
+		if ((next - start) >= minblocks) {
+			ret = ext4_trim_extent(sb, start, next - start, e4b);
+			if (ret && ret != -EOPNOTSUPP)
+				break;
+			ret = 0;
+			count += next - start;
+		}
+		free_count += next - start;
+		start = next + 1;
+
+		if (fatal_signal_pending(current)) {
+			count = -ERESTARTSYS;
+			break;
+		}
+
+		if (need_resched()) {
+			ext4_unlock_group(sb, e4b->bd_group);
+			cond_resched();
+			ext4_lock_group(sb, e4b->bd_group);
+		}
+
+		if ((e4b->bd_info->bb_free - free_count) < minblocks)
+			break;
+	}
+
+	return count;
+}
+
 /**
  * ext4_trim_all_free -- function to trim all free space in alloc. group
  * @sb:			super block for file system
@@ -6241,10 +6289,8 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 		   ext4_grpblk_t start, ext4_grpblk_t max,
 		   ext4_grpblk_t minblocks)
 {
-	void *bitmap;
-	ext4_grpblk_t next, count = 0, free_count = 0;
 	struct ext4_buddy e4b;
-	int ret = 0;
+	int ret;
 
 	trace_ext4_trim_all_free(sb, group, start, max);
 
@@ -6254,57 +6300,23 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 			     ret, group);
 		return ret;
 	}
-	bitmap = e4b.bd_bitmap;
 
 	ext4_lock_group(sb, group);
-	if (EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) &&
-	    minblocks >= atomic_read(&EXT4_SB(sb)->s_last_trim_minblks))
-		goto out;
-
-	start = (e4b.bd_info->bb_first_free > start) ?
-		e4b.bd_info->bb_first_free : start;
 
-	while (start <= max) {
-		start = mb_find_next_zero_bit(bitmap, max + 1, start);
-		if (start > max)
-			break;
-		next = mb_find_next_bit(bitmap, max + 1, start);
-
-		if ((next - start) >= minblocks) {
-			ret = ext4_trim_extent(sb, start, next - start, &e4b);
-			if (ret && ret != -EOPNOTSUPP)
-				break;
-			ret = 0;
-			count += next - start;
-		}
-		free_count += next - start;
-		start = next + 1;
-
-		if (fatal_signal_pending(current)) {
-			count = -ERESTARTSYS;
-			break;
-		}
-
-		if (need_resched()) {
-			ext4_unlock_group(sb, group);
-			cond_resched();
-			ext4_lock_group(sb, group);
-		}
-
-		if ((e4b.bd_info->bb_free - free_count) < minblocks)
-			break;
+	if (!EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) ||
+	    minblocks < atomic_read(&EXT4_SB(sb)->s_last_trim_minblks)) {
+		ret = ext4_try_to_trim_range(sb, &e4b, start, max, minblocks);
+		if (ret >= 0)
+			EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info);
+	} else {
+		ret = 0;
 	}
 
-	if (!ret) {
-		ret = count;
-		EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info);
-	}
-out:
 	ext4_unlock_group(sb, group);
 	ext4_mb_unload_buddy(&e4b);
 
 	ext4_debug("trimmed %d blocks in the group %d\n",
-		count, group);
+		ret, group);
 
 	return ret;
 }
Signature · 1 line
2.17.1
reviewer Reviewed-by on v3 2/5
#5 lore raw

Re: [PATCH V3 2/5] ext4: add new helper interface ext4_try_to_trim_range()

Quoted 9 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

There is no functional change in this patch but just split the codes, which serachs free block and does trim, into a new function ext4_try_to_trim_range. This is preparing for the following async backgroup discard.

Looks good. Feel free to add:

Honza

Quoted 144 lines
---
 fs/ext4/mballoc.c | 102 ++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 45 deletions(-)
fs/ext4/mballoc.c +57 -45
index 018d5d3c6eeb..e3844152a643 100644
@@ -6218,6 +6218,54 @@ __acquires(bitlock)
 	return ret;
 }
 
+static int ext4_try_to_trim_range(struct super_block *sb,
+		struct ext4_buddy *e4b, ext4_grpblk_t start,
+		ext4_grpblk_t max, ext4_grpblk_t minblocks)
+{
+	ext4_grpblk_t next, count, free_count;
+	void *bitmap;
+	int ret = 0;
+
+	bitmap = e4b->bd_bitmap;
+	start = (e4b->bd_info->bb_first_free > start) ?
+		e4b->bd_info->bb_first_free : start;
+	count = 0;
+	free_count = 0;
+
+	while (start <= max) {
+		start = mb_find_next_zero_bit(bitmap, max + 1, start);
+		if (start > max)
+			break;
+		next = mb_find_next_bit(bitmap, max + 1, start);
+
+		if ((next - start) >= minblocks) {
+			ret = ext4_trim_extent(sb, start, next - start, e4b);
+			if (ret && ret != -EOPNOTSUPP)
+				break;
+			ret = 0;
+			count += next - start;
+		}
+		free_count += next - start;
+		start = next + 1;
+
+		if (fatal_signal_pending(current)) {
+			count = -ERESTARTSYS;
+			break;
+		}
+
+		if (need_resched()) {
+			ext4_unlock_group(sb, e4b->bd_group);
+			cond_resched();
+			ext4_lock_group(sb, e4b->bd_group);
+		}
+
+		if ((e4b->bd_info->bb_free - free_count) < minblocks)
+			break;
+	}
+
+	return count;
+}
+
 /**
  * ext4_trim_all_free -- function to trim all free space in alloc. group
  * @sb:			super block for file system
@@ -6241,10 +6289,8 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 		   ext4_grpblk_t start, ext4_grpblk_t max,
 		   ext4_grpblk_t minblocks)
 {
-	void *bitmap;
-	ext4_grpblk_t next, count = 0, free_count = 0;
 	struct ext4_buddy e4b;
-	int ret = 0;
+	int ret;
 
 	trace_ext4_trim_all_free(sb, group, start, max);
 
@@ -6254,57 +6300,23 @@ ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
 			     ret, group);
 		return ret;
 	}
-	bitmap = e4b.bd_bitmap;
 
 	ext4_lock_group(sb, group);
-	if (EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) &&
-	    minblocks >= atomic_read(&EXT4_SB(sb)->s_last_trim_minblks))
-		goto out;
-
-	start = (e4b.bd_info->bb_first_free > start) ?
-		e4b.bd_info->bb_first_free : start;
 
-	while (start <= max) {
-		start = mb_find_next_zero_bit(bitmap, max + 1, start);
-		if (start > max)
-			break;
-		next = mb_find_next_bit(bitmap, max + 1, start);
-
-		if ((next - start) >= minblocks) {
-			ret = ext4_trim_extent(sb, start, next - start, &e4b);
-			if (ret && ret != -EOPNOTSUPP)
-				break;
-			ret = 0;
-			count += next - start;
-		}
-		free_count += next - start;
-		start = next + 1;
-
-		if (fatal_signal_pending(current)) {
-			count = -ERESTARTSYS;
-			break;
-		}
-
-		if (need_resched()) {
-			ext4_unlock_group(sb, group);
-			cond_resched();
-			ext4_lock_group(sb, group);
-		}
-
-		if ((e4b.bd_info->bb_free - free_count) < minblocks)
-			break;
+	if (!EXT4_MB_GRP_WAS_TRIMMED(e4b.bd_info) ||
+	    minblocks < atomic_read(&EXT4_SB(sb)->s_last_trim_minblks)) {
+		ret = ext4_try_to_trim_range(sb, &e4b, start, max, minblocks);
+		if (ret >= 0)
+			EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info);
+	} else {
+		ret = 0;
 	}
 
-	if (!ret) {
-		ret = count;
-		EXT4_MB_GRP_SET_TRIMMED(e4b.bd_info);
-	}
-out:
 	ext4_unlock_group(sb, group);
 	ext4_mb_unload_buddy(&e4b);
 
 	ext4_debug("trimmed %d blocks in the group %d\n",
-		count, group);
+		ret, group);
 
 	return ret;
 }
Signature · 1 line
2.17.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer
#6 lore raw

Re: [PATCH V3 2/5] ext4: add new helper interface ext4_try_to_trim_range()

In reply to Wang Jianchao
Quoted 38 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

There is no functional change in this patch but just split the codes, which serachs free block and does trim, into a new function ext4_try_to_trim_range. This is preparing for the following async backgroup discard.

---
 fs/ext4/mballoc.c | 102 ++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 45 deletions(-)
fs/ext4/mballoc.c +17 -0
index 018d5d3c6eeb..e3844152a643 100644
@@ -6218,6 +6218,54 @@ __acquires(bitlock)
 	return ret;
 }
 
+static int ext4_try_to_trim_range(struct super_block *sb,
+		struct ext4_buddy *e4b, ext4_grpblk_t start,
+		ext4_grpblk_t max, ext4_grpblk_t minblocks)
+{
+	ext4_grpblk_t next, count, free_count;
+	void *bitmap;
+	int ret = 0;
+
+	bitmap = e4b->bd_bitmap;
+	start = (e4b->bd_info->bb_first_free > start) ?
+		e4b->bd_info->bb_first_free : start;
+	count = 0;
+	free_count = 0;
+
+	while (start <= max) {
+		start = mb_find_next_zero_bit(bitmap, max + 1, start);
+		if (start > max)

fs/ext4/mballoc.c __acquires(bitlock) · line 6247

Quoted 10 lines
fs/ext4/mballoc.c +10 -0
+			break;
+		next = mb_find_next_bit(bitmap, max + 1, start);
+
+		if ((next - start) >= minblocks) {
+			ret = ext4_trim_extent(sb, start, next - start, e4b);
+			if (ret && ret != -EOPNOTSUPP)
+				break;
+			ret = 0;
+			count += next - start;
+		}

"ret" is only used inside the if statement, so this might be better as:

fs/ext4/mballoc.c __acquires(bitlock) · line 6247

Quoted 7 lines
fs/ext4/mballoc.c +7 -0
+		if ((next - start) >= minblocks) {
+			int ret = ext4_trim_extent(sb, start, next - start, e4b);
+
+			if (ret && ret != -EOPNOTSUPP)
+				break;
+			count += next - start;
+		}

... and then drop the "int ret = 0" above.

Otherwise, looks good.

- Ted

#7 lore raw

Re: [PATCH V3 2/5] ext4: add new helper interface ext4_try_to_trim_range()

Quoted 62 lines · Theodore Ts'o
Quoted 38 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

There is no functional change in this patch but just split the codes, which serachs free block and does trim, into a new function ext4_try_to_trim_range. This is preparing for the following async backgroup discard.

---
 fs/ext4/mballoc.c | 102 ++++++++++++++++++++++++++--------------------
 1 file changed, 57 insertions(+), 45 deletions(-)
fs/ext4/mballoc.c +17 -0
index 018d5d3c6eeb..e3844152a643 100644
@@ -6218,6 +6218,54 @@ __acquires(bitlock)
 	return ret;
 }
 
+static int ext4_try_to_trim_range(struct super_block *sb,
+		struct ext4_buddy *e4b, ext4_grpblk_t start,
+		ext4_grpblk_t max, ext4_grpblk_t minblocks)
+{
+	ext4_grpblk_t next, count, free_count;
+	void *bitmap;
+	int ret = 0;
+
+	bitmap = e4b->bd_bitmap;
+	start = (e4b->bd_info->bb_first_free > start) ?
+		e4b->bd_info->bb_first_free : start;
+	count = 0;
+	free_count = 0;
+
+	while (start <= max) {
+		start = mb_find_next_zero_bit(bitmap, max + 1, start);
+		if (start > max)

fs/ext4/mballoc.c __acquires(bitlock) · line 6247

Quoted 10 lines
fs/ext4/mballoc.c +10 -0
+			break;
+		next = mb_find_next_bit(bitmap, max + 1, start);
+
+		if ((next - start) >= minblocks) {
+			ret = ext4_trim_extent(sb, start, next - start, e4b);
+			if (ret && ret != -EOPNOTSUPP)
+				break;
+			ret = 0;
+			count += next - start;
+		}

"ret" is only used inside the if statement, so this might be better as:

fs/ext4/mballoc.c __acquires(bitlock) · line 6247

Quoted 7 lines
fs/ext4/mballoc.c +7 -0
+		if ((next - start) >= minblocks) {
+			int ret = ext4_trim_extent(sb, start, next - start, e4b);
+
+			if (ret && ret != -EOPNOTSUPP)
+				break;
+			count += next - start;
+		}

... and then drop the "int ret = 0" above.

Quoted 2 lines

Otherwise, looks good.

OK, I'll do it in next version

Thanks so much
Jianchao

Quoted 2 lines

- Ted

#8 lore raw

PATCH v3 3/5 ext4: remove the repeated comment of ext4_trim_all_free

In reply to Wang Jianchao

From: Wang Jianchao <[email protected]>

---
 fs/ext4/mballoc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/ext4/mballoc.c +1 -6
index e3844152a643..34be2f07449d 100644
@@ -6274,15 +6274,10 @@ static int ext4_try_to_trim_range(struct super_block *sb,
  * @max:		last group block to examine
  * @minblocks:		minimum extent block count
  *
- * ext4_trim_all_free walks through group's buddy bitmap searching for free
- * extents. When the free block is found, ext4_trim_extent is called to TRIM
- * the extent.
- *
- *
  * ext4_trim_all_free walks through group's block bitmap searching for free
  * extents. When the free extent is found, mark it as used in group buddy
  * bitmap. Then issue a TRIM command on this extent and free the extent in
- * the group buddy bitmap. This is done until whole group is scanned.
+ * the group buddy bitmap.
  */
 static ext4_grpblk_t
 ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
Signature · 1 line
2.17.1
reviewer Reviewed-by on v3 3/5
#9 lore raw

Re: [PATCH V3 3/5] ext4: remove the repeated comment of ext4_trim_all_free

Quoted 4 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

Looks good. Feel free to add:

Honza

Quoted 28 lines
---
 fs/ext4/mballoc.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
fs/ext4/mballoc.c +1 -6
index e3844152a643..34be2f07449d 100644
@@ -6274,15 +6274,10 @@ static int ext4_try_to_trim_range(struct super_block *sb,
  * @max:		last group block to examine
  * @minblocks:		minimum extent block count
  *
- * ext4_trim_all_free walks through group's buddy bitmap searching for free
- * extents. When the free block is found, ext4_trim_extent is called to TRIM
- * the extent.
- *
- *
  * ext4_trim_all_free walks through group's block bitmap searching for free
  * extents. When the free extent is found, mark it as used in group buddy
  * bitmap. Then issue a TRIM command on this extent and free the extent in
- * the group buddy bitmap. This is done until whole group is scanned.
+ * the group buddy bitmap.
  */
 static ext4_grpblk_t
 ext4_trim_all_free(struct super_block *sb, ext4_group_t group,
Signature · 1 line
2.17.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#10 lore raw

PATCH v3 4/5 ext4: get discard out of jbd2 commit kthread contex

In reply to Wang Jianchao

From: Wang Jianchao <[email protected]>

Right now, discard is issued and waited to be completed in jbd2 commit kthread context after the logs are committed. When large amount of files are deleted and discard is flooding, jbd2 commit kthread can be blocked for long time. Then all of the metadata operations can be blocked to wait the log space.

One case is the page fault path with read mm->mmap_sem held, which wants to update the file time but has to wait for the log space. When other threads in the task wants to do mmap, then write mmap_sem is blocked. Finally all of the following read mmap_sem requirements are blocked, even the ps command which need to read the /proc/pid/ -cmdline. Our monitor service which needs to read /proc/pid/cmdline used to be blocked for 5 mins.

This patch frees the blocks back to buddy after commit and then do discard in a async kworker context in fstrim fashion, namely,
- mark blocks to be discarded as used if they have not been allocated
- do discard
- mark them free
After this, jbd2 commit kthread won't be blocked any more by discard and we won't get NOSPC even if the discard is slow or throttled.

---
 fs/ext4/ext4.h    |   2 +
 fs/ext4/mballoc.c | 109 +++++++++++++++++++++++++++++++++++-----------
 2 files changed, 86 insertions(+), 25 deletions(-)
fs/ext4/ext4.h +2 -0
index 3c51e243450d..6b678b968d84 100644
@@ -1536,6 +1536,8 @@ struct ext4_sb_info {
 	unsigned int s_mb_free_pending;
 	struct list_head s_freed_data_list;	/* List of blocks to be freed
 						   after commit completed */
+	struct list_head s_discard_list;
+	struct work_struct s_discard_work;
 	struct rb_root s_mb_avg_fragment_size_root;
 	rwlock_t s_mb_rb_lock;
 	struct list_head *s_mb_largest_free_orders;
fs/ext4/mballoc.c +84 -25

175 lines not on this page · raw message

Signature · 1 line
2.17.1
reviewer Reviewed-by on v3 4/5
#11 lore raw

Re: [PATCH V3 4/5] ext4: get discard out of jbd2 commit kthread contex

Quoted 24 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

Right now, discard is issued and waited to be completed in jbd2 commit kthread context after the logs are committed. When large amount of files are deleted and discard is flooding, jbd2 commit kthread can be blocked for long time. Then all of the metadata operations can be blocked to wait the log space.

One case is the page fault path with read mm->mmap_sem held, which wants to update the file time but has to wait for the log space. When other threads in the task wants to do mmap, then write mmap_sem is blocked. Finally all of the following read mmap_sem requirements are blocked, even the ps command which need to read the /proc/pid/ -cmdline. Our monitor service which needs to read /proc/pid/cmdline used to be blocked for 5 mins.

This patch frees the blocks back to buddy after commit and then do discard in a async kworker context in fstrim fashion, namely,
- mark blocks to be discarded as used if they have not been allocated
- do discard
- mark them free
After this, jbd2 commit kthread won't be blocked any more by discard and we won't get NOSPC even if the discard is slow or throttled.

Quoted 3 lines

Looks good to me. Just one small comment below. With that addressed feel free to add:

fs/ext4/mballoc.c int ext4_mb_release(struct super_block *sb) · line 3537

Quoted 9 lines
fs/ext4/mballoc.c +5 -0
@@ -3474,6 +3530,14 @@ int ext4_mb_release(struct super_block *sb)
 	struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
 	int count;
 
+	if (test_opt(sb, DISCARD)) {
+		/*
+		 * wait the discard work to drain all of ext4_free_data
+		 */
+		queue_work(ext4_discard_wq, &sbi->s_discard_work);

Do we really need to queue the work here? The filesystem should be quiescent by now, we take care to queue the work whenever we add item to empty list. So it should be enough to have flush_work() here and then possibly

	WARN_ON_ONCE(!list_empty(&sbi->s_discard_list))

Or am I missing something?

Honza

Quoted 3 lines
fs/ext4/mballoc.c +3 -0
+		flush_work(&sbi->s_discard_work);
+	}
+
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#12 lore raw

Re: [PATCH V3 4/5] ext4: get discard out of jbd2 commit kthread contex

Quoted 50 lines · Jan Kara
Quoted 24 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

Right now, discard is issued and waited to be completed in jbd2 commit kthread context after the logs are committed. When large amount of files are deleted and discard is flooding, jbd2 commit kthread can be blocked for long time. Then all of the metadata operations can be blocked to wait the log space.

One case is the page fault path with read mm->mmap_sem held, which wants to update the file time but has to wait for the log space. When other threads in the task wants to do mmap, then write mmap_sem is blocked. Finally all of the following read mmap_sem requirements are blocked, even the ps command which need to read the /proc/pid/ -cmdline. Our monitor service which needs to read /proc/pid/cmdline used to be blocked for 5 mins.

This patch frees the blocks back to buddy after commit and then do discard in a async kworker context in fstrim fashion, namely,
- mark blocks to be discarded as used if they have not been allocated
- do discard
- mark them free
After this, jbd2 commit kthread won't be blocked any more by discard and we won't get NOSPC even if the discard is slow or throttled.

Quoted 3 lines

Looks good to me. Just one small comment below. With that addressed feel free to add:

fs/ext4/mballoc.c int ext4_mb_release(struct super_block *sb) · line 3537

Quoted 9 lines
fs/ext4/mballoc.c +5 -0
@@ -3474,6 +3530,14 @@ int ext4_mb_release(struct super_block *sb)
 	struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
 	int count;
 
+	if (test_opt(sb, DISCARD)) {
+		/*
+		 * wait the discard work to drain all of ext4_free_data
+		 */
+		queue_work(ext4_discard_wq, &sbi->s_discard_work);

Do we really need to queue the work here? The filesystem should be quiescent by now, we take care to queue the work whenever we add item to empty list. So it should be enough to have flush_work() here and then possibly

Quoted 3 lines
	WARN_ON_ONCE(!list_empty(&sbi->s_discard_list))

Or am I missing something?

queue_work here is indeed redundant.

Thanks so much for you point out this.
Jianchao

Quoted 6 lines

Honza

Quoted 3 lines
fs/ext4/mballoc.c +3 -0
+		flush_work(&sbi->s_discard_work);
+	}
+
maintainer
#13 lore raw

Re: [PATCH V3 4/5] ext4: get discard out of jbd2 commit kthread contex

In reply to Wang Jianchao
Quoted 5 lines · Wang Jianchao
fs/ext4/mballoc.c +0 -0
index 34be2f07449d..a496509e61b7 100644

fs/ext4/mballoc.c int ext4_mb_release(struct super_block *sb) · line 3538

Quoted 9 lines
fs/ext4/mballoc.c +6 -0
@@ -3474,6 +3530,14 @@ int ext4_mb_release(struct super_block *sb)
 	struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
 	int count;
 
+	if (test_opt(sb, DISCARD)) {
+		/*
+		 * wait the discard work to drain all of ext4_free_data
+		 */
+		queue_work(ext4_discard_wq, &sbi->s_discard_work);
+		flush_work(&sbi->s_discard_work);

I agree with Jan --- it's not clear to me why the call to queue_work() is needed. After the flush_work() call returns, if s_discard_work is still non-empty, there must be something terribly wrong --- are we missing something?

fs/ext4/mballoc.c int __init ext4_init_mballoc(void) · line 3730

Quoted 8 lines
fs/ext4/mballoc.c +4 -0
@@ -3672,8 +3724,14 @@ int __init ext4_init_mballoc(void)
 	if (ext4_free_data_cachep == NULL)
 		goto out_ac_free;
 
+	ext4_discard_wq = alloc_workqueue("ext4discard", WQ_UNBOUND, 0);
+	if (!ext4_discard_wq)
+		goto out_free_data;
+

Perhaps we should only allocate the workqueue when it's needed --- e.g., when a file system is mounted or remounted with "-o discard"?

Then in ext4_exit_malloc(), we only free it if ext4_discard_wq is non-NULL.

This would save a bit of memory on systems that wouldn't need the ext4 discard work queue.

- Ted

#14 lore raw

Re: [PATCH V3 4/5] ext4: get discard out of jbd2 commit kthread contex

Quoted 9 lines · Theodore Ts'o
Quoted 8 lines · Wang Jianchao
fs/ext4/mballoc.c +0 -0
index 34be2f07449d..a496509e61b7 100644
@@ -3474,6 +3530,14 @@ int ext4_mb_release(struct super_block *sb)
 	struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
 	int count;
 
Quoted 11 lines

fs/ext4/mballoc.c int ext4_mb_release(struct super_block *sb) · line 3538

Quoted 6 lines
fs/ext4/mballoc.c +6 -0
+	if (test_opt(sb, DISCARD)) {
+		/*
+		 * wait the discard work to drain all of ext4_free_data
+		 */
+		queue_work(ext4_discard_wq, &sbi->s_discard_work);
+		flush_work(&sbi->s_discard_work);

I agree with Jan --- it's not clear to me why the call to queue_work() is needed. After the flush_work() call returns, if s_discard_work is still non-empty, there must be something terribly wrong --- are we missing something?

Yes,the queue_work() is redundant.
I will get rid of it in next version.

Quoted 14 lines

fs/ext4/mballoc.c int __init ext4_init_mballoc(void) · line 3730

Quoted 9 lines
fs/ext4/mballoc.c +4 -0
@@ -3672,8 +3724,14 @@ int __init ext4_init_mballoc(void)
 	if (ext4_free_data_cachep == NULL)
 		goto out_ac_free;
 
+	ext4_discard_wq = alloc_workqueue("ext4discard", WQ_UNBOUND, 0);
+	if (!ext4_discard_wq)
+		goto out_free_data;
+

Perhaps we should only allocate the workqueue when it's needed --- e.g., when a file system is mounted or remounted with "-o discard"?

Quoted 5 lines

Then in ext4_exit_malloc(), we only free it if ext4_discard_wq is non-NULL.

This would save a bit of memory on systems that wouldn't need the ext4 discard work queue.

Yes, it make sense to the system with pool memory

Thanks so much
Jianchao

Quoted 3 lines

- Ted

#15 lore raw

Re: [PATCH V3 4/5] ext4: get discard out of jbd2 commit kthread contex

Quoted 14 lines · Wang Jianchao
Quoted 14 lines

fs/ext4/mballoc.c int __init ext4_init_mballoc(void) · line 3730

Quoted 9 lines
fs/ext4/mballoc.c +4 -0
@@ -3672,8 +3724,14 @@ int __init ext4_init_mballoc(void)
 	if (ext4_free_data_cachep == NULL)
 		goto out_ac_free;
 
+	ext4_discard_wq = alloc_workqueue("ext4discard", WQ_UNBOUND, 0);
+	if (!ext4_discard_wq)
+		goto out_free_data;
+

Perhaps we should only allocate the workqueue when it's needed --- e.g., when a file system is mounted or remounted with "-o discard"?

Quoted 7 lines
Quoted 5 lines

Then in ext4_exit_malloc(), we only free it if ext4_discard_wq is non-NULL.

This would save a bit of memory on systems that wouldn't need the ext4 discard work queue.

Yes, it make sense to the system with pool memory

s/pool/poor :)

Quoted 7 lines

Thanks so much
Jianchao

Quoted 3 lines

- Ted

#16 lore raw

PATCH v3 5/5 ext4: make fallocate retry when err is ENOSPC

In reply to Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

---
 fs/ext4/extents.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/extents.c +5 -1
index 92ad64b89d9b..ad0b874d3448 100644
@@ -4635,7 +4635,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	struct inode *inode = file_inode(file);
 	loff_t new_size = 0;
 	unsigned int max_blocks;
-	int ret = 0;
+	int ret = 0, retries = 0;
 	int flags;
 	ext4_lblk_t lblk;
 	unsigned int blkbits = inode->i_blkbits;
@@ -4656,6 +4656,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		     FALLOC_FL_INSERT_RANGE))
 		return -EOPNOTSUPP;
 
+retry:
 	ext4_fc_start_update(inode);
 
 	if (mode & FALLOC_FL_PUNCH_HOLE) {
@@ -4722,6 +4723,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
 exit:
 	ext4_fc_stop_update(inode);
+	if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+		goto retry;
+
 	return ret;
 }
 
Signature · 1 line
2.17.1
#17 lore raw

Re: [PATCH V3 5/5] ext4: make fallocate retry when err is ENOSPC

Hi,

Quoted 32 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

---
  fs/ext4/extents.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/extents.c +2 -1
index 92ad64b89d9b..ad0b874d3448 100644
@@ -4635,7 +4635,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
  	struct inode *inode = file_inode(file);
  	loff_t new_size = 0;
  	unsigned int max_blocks;
-	int ret = 0;
+	int ret = 0, retries = 0;
  	int flags;
  	ext4_lblk_t lblk;
  	unsigned int blkbits = inode->i_blkbits;
@@ -4656,6 +4656,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
  		     FALLOC_FL_INSERT_RANGE))
  		return -EOPNOTSUPP;
 
+retry:
  	ext4_fc_start_update(inode);
 
  	if (mode & FALLOC_FL_PUNCH_HOLE) {

fs/ext4/extents.c long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) · line 4728

Quoted 6 lines
fs/ext4/extents.c +3 -0
@@ -4722,6 +4723,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
  	trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
  exit:
  	ext4_fc_stop_update(inode);
+	if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+		goto retry;
+

Not sure if it is necessary since ext4_alloc_file_blocks already retries allocate.

Thanks,
Guoqing

#18 lore raw

Re: [PATCH V3 5/5] ext4: make fallocate retry when err is ENOSPC

Quoted 33 lines · Guoqing Jiang

Hi,

Quoted 30 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

---
  fs/ext4/extents.c | 6 +++++-

  1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/extents.c +1 -1
index 92ad64b89d9b..ad0b874d3448 100644
@@ -4635,7 +4635,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
       struct inode *inode = file_inode(file);
       loff_t new_size = 0;
       unsigned int max_blocks;
-    int ret = 0;
+    int ret = 0, retries = 0;
       int flags;
       ext4_lblk_t lblk;
       unsigned int blkbits = inode->i_blkbits;
@@ -4656,6 +4656,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
                FALLOC_FL_INSERT_RANGE))
           return -EOPNOTSUPP;

  +retry:
      ext4_fc_start_update(inode);
        if (mode & FALLOC_FL_PUNCH_HOLE) {

fs/ext4/extents.c +0 -0
@@ -4722,6 +4723,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
Quoted 8 lines
Quoted 6 lines
fs/ext4/extents.c +0 -0
       trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);

  exit:
      ext4_fc_stop_update(inode);
+    if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) +        goto retry;
+

Not sure if it is necessary since ext4_alloc_file_blocks already retries allocate.

Yes, this patch should be get rid of.
But it is indeed helpful to fix the xfstest generic/371 which does concurrently write/rm and fallocate/rm. I'll figure out some other way to improve that

Thanks
Jianchao

Quoted 3 lines

Thanks,
Guoqing

reviewer
#19 lore raw

Re: [PATCH V3 5/5] ext4: make fallocate retry when err is ENOSPC

Quoted 45 lines · Wang Jianchao
Quoted 33 lines · Guoqing Jiang

Hi,

Quoted 30 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

---
  fs/ext4/extents.c | 6 +++++-

  1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/extents.c +1 -1
index 92ad64b89d9b..ad0b874d3448 100644
@@ -4635,7 +4635,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
       struct inode *inode = file_inode(file);
       loff_t new_size = 0;
       unsigned int max_blocks;
-    int ret = 0;
+    int ret = 0, retries = 0;
       int flags;
       ext4_lblk_t lblk;
       unsigned int blkbits = inode->i_blkbits;
@@ -4656,6 +4656,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
                FALLOC_FL_INSERT_RANGE))
           return -EOPNOTSUPP;

  +retry:
      ext4_fc_start_update(inode);
        if (mode & FALLOC_FL_PUNCH_HOLE) {

fs/ext4/extents.c +0 -0
@@ -4722,6 +4723,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
Quoted 8 lines
Quoted 6 lines
fs/ext4/extents.c +0 -0
       trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);

  exit:
      ext4_fc_stop_update(inode);
+    if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) +        goto retry;
+

Not sure if it is necessary since ext4_alloc_file_blocks already retries allocate.

Quoted 3 lines

Yes, this patch should be get rid of. But it is indeed helpful to fix the xfstest generic/371 which does concurrently write/rm and fallocate/rm. I'll figure out some other way to improve that

Note that the retry logic is only a heuristic. It is not guaranteed any number of retries is enough, we just do three to not give up too easily... Your patch effectively raised number of retries to 9 so that may have masked the issue. But I don't think so high number of retries is a sensible choice because that way it may take too long to return ENOSPC.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#20 lore raw

Re: [PATCH V3 5/5] ext4: make fallocate retry when err is ENOSPC

Quoted 50 lines · Jan Kara
Quoted 45 lines · Wang Jianchao
Quoted 33 lines · Guoqing Jiang

Hi,

Quoted 30 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

---
  fs/ext4/extents.c | 6 +++++-

  1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/extents.c +1 -1
index 92ad64b89d9b..ad0b874d3448 100644
@@ -4635,7 +4635,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
       struct inode *inode = file_inode(file);
       loff_t new_size = 0;
       unsigned int max_blocks;
-    int ret = 0;
+    int ret = 0, retries = 0;
       int flags;
       ext4_lblk_t lblk;
       unsigned int blkbits = inode->i_blkbits;
@@ -4656,6 +4656,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
                FALLOC_FL_INSERT_RANGE))
           return -EOPNOTSUPP;

  +retry:
      ext4_fc_start_update(inode);
        if (mode & FALLOC_FL_PUNCH_HOLE) {

fs/ext4/extents.c +0 -0
@@ -4722,6 +4723,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
Quoted 8 lines
Quoted 6 lines
fs/ext4/extents.c +0 -0
       trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);

  exit:
      ext4_fc_stop_update(inode);
+    if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries)) +        goto retry;
+

Not sure if it is necessary since ext4_alloc_file_blocks already retries allocate.

Quoted 3 lines

Yes, this patch should be get rid of. But it is indeed helpful to fix the xfstest generic/371 which does concurrently write/rm and fallocate/rm. I'll figure out some other way to improve that

Quoted 5 lines

Note that the retry logic is only a heuristic. It is not guaranteed any number of retries is enough, we just do three to not give up too easily... Your patch effectively raised number of retries to 9 so that may have masked the issue. But I don't think so high number of retries is a sensible choice because that way it may take too long to return ENOSPC.

The failure seems due to the background discard which marks the blocks used before issue discard.

The test make a 256M filesystem which has 59316 4K blocks. There are two thread running concurrently,
- write, rm 80M file
- fallocate, rm 80M file

When the fallocate failed, I can observe there was a 80M on-going background trim

We seems to need to add a flush_work(sbi->s_discard_work) into ext4_should_retry_alloc()

Thanks so much
Jianchao

Quoted 3 lines

Honza

reviewer
#21 lore raw

Re: [PATCH V3 5/5] ext4: make fallocate retry when err is ENOSPC

In reply to Wang Jianchao
Quoted 6 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

Did you really observe this? Because the retry is already handled in ext4_alloc_file_blocks() that's used by ext4_fallocate(). So no retry should be needed there.

Honza

Quoted 38 lines
---
 fs/ext4/extents.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext4/extents.c +5 -1
index 92ad64b89d9b..ad0b874d3448 100644
@@ -4635,7 +4635,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	struct inode *inode = file_inode(file);
 	loff_t new_size = 0;
 	unsigned int max_blocks;
-	int ret = 0;
+	int ret = 0, retries = 0;
 	int flags;
 	ext4_lblk_t lblk;
 	unsigned int blkbits = inode->i_blkbits;
@@ -4656,6 +4656,7 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 		     FALLOC_FL_INSERT_RANGE))
 		return -EOPNOTSUPP;
 
+retry:
 	ext4_fc_start_update(inode);
 
 	if (mode & FALLOC_FL_PUNCH_HOLE) {
@@ -4722,6 +4723,9 @@ long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len)
 	trace_ext4_fallocate_exit(inode, offset, max_blocks, ret);
 exit:
 	ext4_fc_stop_update(inode);
+	if (ret == -ENOSPC && ext4_should_retry_alloc(inode->i_sb, &retries))
+		goto retry;
+
 	return ret;
 }
 
Signature · 1 line
2.17.1
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
reviewer
#22 lore raw

Re: [PATCH V3 5/5] ext4: make fallocate retry when err is ENOSPC

Quoted 11 lines · Jan Kara
Quoted 6 lines · Wang Jianchao

From: Wang Jianchao <[email protected]>

The blocks may be waiting for journal commit to be freed back to mb buddy. Let fallocate wait and retry in that case.

Did you really observe this? Because the retry is already handled in ext4_alloc_file_blocks() that's used by ext4_fallocate(). So no retry should be needed there.

Oh, I can see you've addressed these already in another reply. I'll comment there.

Honza

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR