From: Jin Qian Date: Thu, 1 Feb 2018 01:46:46 +0000 (-0800) Subject: AOSP: libext2fs: increment i_blocks for shared blocks X-Git-Tag: v1.44.3-rc1~52 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=e4d5edd6d1c7bfaed558994e722716c09fe91e0c;p=tools%2Fe2fsprogs.git AOSP: libext2fs: increment i_blocks for shared blocks This fixes an incorrect i_blocks count when using shared blocks. Signed-off-by: Theodore Ts'o Google-Bug-Id: 64109868 Change-Id: I44a4997f6a93f2a3fc9aa362fd39d72e7cc9ff84 From AOSP commit: 632cc1f02d47ce54d9f17ca5d80c2d7ba2851020 --- diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c index 5bc02d0..a5d90a7 100644 --- a/lib/ext2fs/fileio.c +++ b/lib/ext2fs/fileio.c @@ -475,6 +475,11 @@ errcode_t ext2fs_file_write(ext2_file_t file, const void *buf, ext2fs_hashmap_add(fs->block_sha_map, new_block, new_block->sha, sizeof(new_block->sha)); } + + if (bmap_flags & BMAP_SET) { + ext2fs_iblk_add_blocks(fs, &file->inode, 1); + ext2fs_write_inode(fs, file->ino, &file->inode); + } } file->pos += c;