• Chao Yu's avatar
    f2fs: fix to account compressed blocks in f2fs_compressed_blocks() · 1a67cbe1
    Chao Yu authored
    por_fsstress reports inconsistent status in orphan inode, the root cause
    of this is in f2fs_write_raw_pages() we decrease i_compr_blocks incorrectly
    due to wrong calculation in f2fs_compressed_blocks().
    
    So this patch exposes below two functions based on __f2fs_cluster_blocks:
    - f2fs_compressed_blocks: get count of compressed blocks in compressed cluster
    - f2fs_cluster_blocks: get count of valid blocks (including reserved blocks)
    in compressed cluster.
    
    Then use f2fs_compress_blocks() to get correct compressed blocks count in
    f2fs_write_raw_pages().
    
    sanity_check_inode: inode (ino=ad80) hash inconsistent i_compr_blocks:2, i_blocks:1, run fsck to fix
    Signed-off-by: default avatarChao Yu <yuchao0@huawei.com>
    Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
    1a67cbe1
compress.c 26.7 KB