From e4d5edd6d1c7bfaed558994e722716c09fe91e0c Mon Sep 17 00:00:00 2001 From: Jin Qian Date: Wed, 31 Jan 2018 17:46:46 -0800 Subject: [PATCH] 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 --- lib/ext2fs/fileio.c | 5 +++++ 1 file changed, 5 insertions(+) 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; -- 1.8.3.1