diff options
author | Yuezhang Mo <Yuezhang.Mo@sony.com> | 2023-01-04 14:37:47 +0800 |
---|---|---|
committer | Namjae Jeon <linkinjeon@kernel.org> | 2023-02-27 21:14:45 +0900 |
commit | 39c1ce8eafc0ff64fb9e28536ccc7df6a8e2999d (patch) | |
tree | badb112dfa32ee543e7c91671d656065b26f4ea7 /fs/exfat/super.c | |
parent | bdaadfd343e3cba49ad0b009ff4b148dad0fa404 (diff) | |
download | lwn-39c1ce8eafc0ff64fb9e28536ccc7df6a8e2999d.tar.gz lwn-39c1ce8eafc0ff64fb9e28536ccc7df6a8e2999d.zip |
exfat: fix inode->i_blocks for non-512 byte sector size device
inode->i_blocks is not real number of blocks, but 512 byte ones.
Fixes: 98d917047e8b ("exfat: add file operations")
Cc: stable@vger.kernel.org # v5.7+
Reported-by: Wang Yugui <wangyugui@e16-tech.com>
Tested-by: Wang Yugui <wangyugui@e16-tech.com>
Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Diffstat (limited to 'fs/exfat/super.c')
-rw-r--r-- | fs/exfat/super.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/exfat/super.c b/fs/exfat/super.c index 35f0305cd493..8c32460e031e 100644 --- a/fs/exfat/super.c +++ b/fs/exfat/super.c @@ -373,8 +373,7 @@ static int exfat_read_root(struct inode *inode) inode->i_op = &exfat_dir_inode_operations; inode->i_fop = &exfat_dir_operations; - inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> - inode->i_blkbits; + inode->i_blocks = round_up(i_size_read(inode), sbi->cluster_size) >> 9; ei->i_pos = ((loff_t)sbi->root_dir << 32) | 0xffffffff; ei->i_size_aligned = i_size_read(inode); ei->i_size_ondisk = i_size_read(inode); |