diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-01-19 19:30:59 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-01-19 19:30:59 -0500 |
commit | 07f1a070ff45c8381c3ddf8552c726525104e1ee (patch) | |
tree | 20b9324b232f19ae7a08c078bf4e8738cd89db45 /lib | |
parent | d3a8fc5ae68477118e32813230518bf4ccc73bf9 (diff) | |
download | e2fsprogs-07f1a070ff45c8381c3ddf8552c726525104e1ee.tar.gz |
ext2fs_block_iterate2: Preserve the uninit flag in extents
When modifying a block via the block_iterate interface, preserve the
uninit flag in the extent. Resize2fs uses this interface, so we have
to preserve the uninit status when relocating a block.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ext2fs/block.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c index 51fdd9ad..6ac93797 100644 --- a/lib/ext2fs/block.c +++ b/lib/ext2fs/block.c @@ -364,6 +364,7 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, e2_blkcnt_t blockcnt = 0; blk_t blk, new_blk; int op = EXT2_EXTENT_ROOT; + int uninit; unsigned int j; ctx.errcode = ext2fs_extent_open(fs, ino, &handle); @@ -419,6 +420,9 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, } continue; } + uninit = 0; + if (extent.e_flags & EXT2_EXTENT_FLAGS_UNINIT) + uninit = EXT2_EXTENT_SET_BMAP_UNINIT; for (blockcnt = extent.e_lblk, j = 0; j < extent.e_len; blk++, blockcnt++, j++) { @@ -432,7 +436,8 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs, ctx.errcode = ext2fs_extent_set_bmap(handle, (blk64_t) blockcnt, - (blk64_t) new_blk, 0); + (blk64_t) new_blk, + uninit); if (ctx.errcode) goto extent_errout; } |