summaryrefslogtreecommitdiff
path: root/fs/exfat/file.c
diff options
context:
space:
mode:
authorYuezhang Mo <Yuezhang.Mo@sony.com>2023-01-04 09:37:47 +0300
committerNamjae Jeon <linkinjeon@kernel.org>2023-02-27 15:14:45 +0300
commit39c1ce8eafc0ff64fb9e28536ccc7df6a8e2999d (patch)
treebadb112dfa32ee543e7c91671d656065b26f4ea7 /fs/exfat/file.c
parentbdaadfd343e3cba49ad0b009ff4b148dad0fa404 (diff)
downloadlinux-39c1ce8eafc0ff64fb9e28536ccc7df6a8e2999d.tar.xz
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/file.c')
-rw-r--r--fs/exfat/file.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index f5b29072775d..b33431c74c8a 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -209,8 +209,7 @@ void exfat_truncate(struct inode *inode)
if (err)
goto write_size;
- 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;
write_size:
aligned_size = i_size_read(inode);
if (aligned_size & (blocksize - 1)) {