f2fs: fix the fault of calculating blkstart twice
authorKinglong Mee <kinglongmee@gmail.com>
Wed, 8 Mar 2017 01:49:53 +0000 (09:49 +0800)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 21 Mar 2017 20:52:16 +0000 (16:52 -0400)
When the zone type is BLK_ZONE_TYPE_CONVENTIONAL, the blkstart is
calculated twice.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/segment.c

index 29ef7088c5582a480b6a1f7965fbbcca4f07e24e..4d7bf84dc3935e62f0293c9f6245e2038d84dad7 100644 (file)
@@ -796,6 +796,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
                struct block_device *bdev, block_t blkstart, block_t blklen)
 {
        sector_t sector, nr_sects;
+       block_t lblkstart = blkstart;
        int devi = 0;
 
        if (sbi->s_ndevs) {
@@ -813,7 +814,7 @@ static int __f2fs_issue_discard_zone(struct f2fs_sb_info *sbi,
        case BLK_ZONE_TYPE_CONVENTIONAL:
                if (!blk_queue_discard(bdev_get_queue(bdev)))
                        return 0;
-               return __f2fs_issue_discard_async(sbi, bdev, blkstart, blklen);
+               return __f2fs_issue_discard_async(sbi, bdev, lblkstart, blklen);
        case BLK_ZONE_TYPE_SEQWRITE_REQ:
        case BLK_ZONE_TYPE_SEQWRITE_PREF:
                sector = SECTOR_FROM_BLOCK(blkstart);