linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH e2fsprogs] resize2fs: avoid constantly flushing while moving blocks
@ 2023-11-07  9:46 Anssi Hannula
  2024-04-17  4:33 ` Theodore Ts'o
  0 siblings, 1 reply; 2+ messages in thread
From: Anssi Hannula @ 2023-11-07  9:46 UTC (permalink / raw)
  To: linux-ext4, Theodore Ts'o

resize2fs block_mover() flushes data after each extent and, curiously,
only if progress indicator is enabled, every inode_blocks_per_group
blocks.

This significantly affects performance, e.g. on a tested large
filesystem on top of MD-RAID6+LVM+dm-crypt these flush calls reduce the
operation rate from approx. 500MB/s to 5MB/s, causing extremely long
shrinking times for large size deltas (70TB in my case).

Since this step performs just plain data copying and does not e.g. save
any progress/checkpoint information or similar metadata, it seems like
this flushing is of very limited usefulness, especially when considering
the (in some cases) 100x performance impact.

Remove the mid-operation flushes and only flush after all blocks have
been moved.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 resize/resize2fs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 5eeb7d44..46540501 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1863,7 +1863,6 @@ static errcode_t block_mover(ext2_resize_t rfs)
 			old_blk += c;
 			moved += c;
 			if (rfs->progress) {
-				io_channel_flush(fs->io);
 				retval = (rfs->progress)(rfs,
 						E2_RSZ_BLOCK_RELOC_PASS,
 						moved, to_move);
@@ -1871,9 +1870,10 @@ static errcode_t block_mover(ext2_resize_t rfs)
 					goto errout;
 			}
 		} while (size > 0);
-		io_channel_flush(fs->io);
 	}
 
+	io_channel_flush(fs->io);
+
 errout:
 	if (badblock_list) {
 		if (!retval && bb_modified)
-- 
2.41.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH e2fsprogs] resize2fs: avoid constantly flushing while moving blocks
  2023-11-07  9:46 [PATCH e2fsprogs] resize2fs: avoid constantly flushing while moving blocks Anssi Hannula
@ 2024-04-17  4:33 ` Theodore Ts'o
  0 siblings, 0 replies; 2+ messages in thread
From: Theodore Ts'o @ 2024-04-17  4:33 UTC (permalink / raw)
  To: linux-ext4, Anssi Hannula; +Cc: Theodore Ts'o


On Tue, 07 Nov 2023 11:46:53 +0200, Anssi Hannula wrote:
> resize2fs block_mover() flushes data after each extent and, curiously,
> only if progress indicator is enabled, every inode_blocks_per_group
> blocks.
> 
> This significantly affects performance, e.g. on a tested large
> filesystem on top of MD-RAID6+LVM+dm-crypt these flush calls reduce the
> operation rate from approx. 500MB/s to 5MB/s, causing extremely long
> shrinking times for large size deltas (70TB in my case).
> 
> [...]

Applied, thanks!

[1/1] resize2fs: avoid constantly flushing while moving blocks
      commit: e0e6b13d0ea7330234a6fe51ec3ba13ef884735e

Best regards,
-- 
Theodore Ts'o <tytso@mit.edu>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-17  4:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-07  9:46 [PATCH e2fsprogs] resize2fs: avoid constantly flushing while moving blocks Anssi Hannula
2024-04-17  4:33 ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).