]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commit
e2fsck: optimize clone_file on large devices
authorLi Dongyang <dongyangli@ddn.com>
Mon, 19 Dec 2022 13:05:44 +0000 (00:05 +1100)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 26 Jan 2023 02:38:33 +0000 (21:38 -0500)
commit6cae615a47dfe37fe5fd096accb82579813a6366
treea11db3ecae927a117eb47827c009449c5ebaa809
parentf7c9598655420102353ff87946f5bf77ebf465bc
e2fsck: optimize clone_file on large devices

When cloning multiply-claimed blocks for an inode,
clone_file() uses ext2fs_block_iterate3() to iterate
every block calling clone_file_block().
clone_file_block() calls check_if_fs_cluster(), even
the block is not on the block_dup_map, which could take
a long time on a large device.

Only check if it's metadata block when we need to clone
it.

Test block_metadata_map in check_if_fs_block()
and check_if_fs_cluster(), so we don't need to go over
each bg every time. The metadata blocks are already
marked in the bitmap.

Before this patch on a 500TB device with 3 files having
3 multiply-claimed blocks between them, pass1b is stuck
for more than 48 hours without progressing,
before e2fsck was terminated.
After this patch pass1b could finish in 180 seconds.

Signed-off-by: Li Dongyang <dongyangli@ddn.com>
Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1b.c
tests/f_dup_resize/expect.1