summaryrefslogtreecommitdiff
path: root/fs/f2fs
diff options
context:
space:
mode:
authorYohan Joung <jyh429@gmail.com>2023-04-02 12:12:59 +0900
committerJaegeuk Kim <jaegeuk@kernel.org>2023-04-04 13:57:30 -0700
commitf26aaee60a9f14035c1a659b5b00a6c8767b4126 (patch)
tree5507fd0adc8aaab2915d2b346b94505700af747b /fs/f2fs
parentd4998b7895ab3a590bcf85f08033166ee9502b03 (diff)
downloadlinux-f26aaee60a9f14035c1a659b5b00a6c8767b4126.tar.gz
f2fs: fix align check for npo2
Fix alignment check to be correct in npo2 as well Signed-off-by: Yohan Joung <yohan.joung@sk.com> Reviewed-by: Chao Yu <chao@kernel.org> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/segment.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 61394346febe..f88828987924 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -1845,6 +1845,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
sector_t sector, nr_sects;
block_t lblkstart = blkstart;
int devi = 0;
+ u64 remainder = 0;
if (f2fs_is_multi_device(sbi)) {
devi = f2fs_target_device_index(sbi, blkstart);
@@ -1860,9 +1861,9 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
if (f2fs_blkz_is_seq(sbi, devi, blkstart)) {
sector = SECTOR_FROM_BLOCK(blkstart);
nr_sects = SECTOR_FROM_BLOCK(blklen);
+ div64_u64_rem(sector, bdev_zone_sectors(bdev), &remainder);
- if (sector & (bdev_zone_sectors(bdev) - 1) ||
- nr_sects != bdev_zone_sectors(bdev)) {
+ if (remainder || nr_sects != bdev_zone_sectors(bdev)) {
f2fs_err(sbi, "(%d) %s: Unaligned zone reset attempted (block %x + %x)",
devi, sbi->s_ndevs ? FDEV(devi).path : "",
blkstart, blklen);