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>
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);
}
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++) {
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;
}