libext2fs: refactor code which fixes up the checksums in an extent tree
PATCH 1/1 libext2fs: refactor code which fixes up the checksums in an extent tree
The code to recalculate the checksums in an extent tree (which is needed after an inode is relocated so it has a different inode number) was duplicated in tune2fs and resize2fs. In addition, this work could be done in a much more efficient way inside lib/ext2fs/extent.c.
This commit creates a new library function which corrects the checksums in an inode's extent tree, named: ext2fs_fix_extents_checksums()
Signed-off-by Theodore Ts'o <[email protected]>
--- lib/ext2fs/ext2fs.h | 4 ++- lib/ext2fs/extent.c | 48 ++++++++++++++++++++++++++++++++++++ misc/tune2fs.c | 60 +-------------------------------------------- resize/resize2fs.c | 56 ++---------------------------------------- 4 files changed, 54 insertions(+), 114 deletions(-)
lib/ext2fs/ext2fs.h +3 -1
@@ -1295,7 +1295,9 @@ extern errcode_t ext2fs_extent_goto(ext2_extent_handle_t handle,extern errcode_t ext2fs_extent_goto2 (ext2_extent_handle_t handle,int leaf_level,blk64_t blk);extern errcode_t ext2fs_extent_fix_parents (ext2_extent_handle_t handle); -size_t ext2fs_max_extent_depth (ext2_extent_handle_t handle); +extern size_t ext2fs_max_extent_depth (ext2_extent_handle_t handle); +extern errcode_t ext2fs_fix_extents_checksums (ext2_filsys fs,ext2_ino_t ino, +struct ext2_inode *inode);/* fallocate.c */ #define EXT2_FALLOCATE_ZERO_BLOCKS (0x1)
lib/ext2fs/extent.c +48 -0
54 lines not on this page · raw message
misc/tune2fs.c +1 -59
72 lines not on this page · raw message
resize/resize2fs.c +2 -54
68 lines not on this page · raw message
Signature · 1 line
2.18.0.rc0