Message ID | 1477641337-12321-9-git-send-email-damien.lemoal@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Damien, [auto build test WARNING on v4.9-rc2] [cannot apply to f2fs/dev next-20161028] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Damien-Le-Moal/f2fs-Zoned-block-device-support/20161028-160349 config: x86_64-randconfig-x017-201643 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All warnings (new ones prefixed by >>): In file included from fs/f2fs/segment.c:20:0: fs/f2fs/f2fs.h: In function 'get_blkz_type': fs/f2fs/f2fs.h:2424:35: error: 'struct f2fs_sb_info' has no member named 'log_blocks_per_blkz'; did you mean 'log_blocks_per_seg'? unsigned int zno = blkaddr >> sbi->log_blocks_per_blkz; ^~ fs/f2fs/f2fs.h:2426:12: error: 'struct f2fs_sb_info' has no member named 'blkz_type' return sbi->blkz_type[zno]; ^~ In file included from include/linux/linkage.h:4:0, from include/linux/fs.h:4, from fs/f2fs/segment.c:11: fs/f2fs/segment.c: In function 'f2fs_issue_discard_zone': fs/f2fs/segment.c:668:18: error: implicit declaration of function 'bdev_zone_size' [-Werror=implicit-function-declaration] if (nr_sects != bdev_zone_size(bdev)) { ^ include/linux/compiler.h:149:30: note: in definition of macro '__trace_if' if (__builtin_constant_p(!!(cond)) ? !!(cond) : \ ^~~~ >> fs/f2fs/segment.c:668:2: note: in expansion of macro 'if' if (nr_sects != bdev_zone_size(bdev)) { ^~ fs/f2fs/segment.c:683:7: error: 'BLK_ZONE_TYPE_CONVENTIONAL' undeclared (first use in this function) case BLK_ZONE_TYPE_CONVENTIONAL: ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:683:7: note: each undeclared identifier is reported only once for each function it appears in fs/f2fs/segment.c:689:7: error: 'BLK_ZONE_TYPE_SEQWRITE_REQ' undeclared (first use in this function) case BLK_ZONE_TYPE_SEQWRITE_REQ: ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:690:7: error: 'BLK_ZONE_TYPE_SEQWRITE_PREF' undeclared (first use in this function) case BLK_ZONE_TYPE_SEQWRITE_PREF: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:691:10: error: implicit declaration of function 'blkdev_reset_zones' [-Werror=implicit-function-declaration] return blkdev_reset_zones(bdev, sector, ^~~~~~~~~~~~~~~~~~ In file included from fs/f2fs/segment.c:20:0: fs/f2fs/f2fs.h: In function 'get_blkz_type': fs/f2fs/f2fs.h:2427:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors vim +/if +668 fs/f2fs/segment.c 652 bio->bi_private = be; 653 bio->bi_end_io = f2fs_submit_bio_wait_endio; 654 bio->bi_opf |= REQ_SYNC; 655 submit_bio(bio); 656 } 657 658 return err; 659 } 660 661 static int f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, 662 block_t blkstart, block_t blklen) 663 { 664 sector_t sector = SECTOR_FROM_BLOCK(blkstart); 665 sector_t nr_sects = SECTOR_FROM_BLOCK(blklen); 666 struct block_device *bdev = sbi->sb->s_bdev; 667 > 668 if (nr_sects != bdev_zone_size(bdev)) { 669 f2fs_msg(sbi->sb, KERN_INFO, 670 "Unaligned discard attempted (sector %llu + %llu)", 671 (unsigned long long)sector, 672 (unsigned long long)nr_sects); 673 return -EIO; 674 } 675 676 /* --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Damien, [auto build test ERROR on v4.9-rc2] [cannot apply to f2fs/dev next-20161028] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Damien-Le-Moal/f2fs-Zoned-block-device-support/20161028-160349 config: x86_64-randconfig-x014-201643 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=x86_64 All error/warnings (new ones prefixed by >>): In file included from fs/f2fs/segment.c:20:0: fs/f2fs/f2fs.h: In function 'get_blkz_type': fs/f2fs/f2fs.h:2424:35: error: 'struct f2fs_sb_info' has no member named 'log_blocks_per_blkz'; did you mean 'log_blocks_per_seg'? unsigned int zno = blkaddr >> sbi->log_blocks_per_blkz; ^~ fs/f2fs/f2fs.h:2426:12: error: 'struct f2fs_sb_info' has no member named 'blkz_type' return sbi->blkz_type[zno]; ^~ fs/f2fs/segment.c: In function 'f2fs_issue_discard_zone': >> fs/f2fs/segment.c:668:18: error: implicit declaration of function 'bdev_zone_size' [-Werror=implicit-function-declaration] if (nr_sects != bdev_zone_size(bdev)) { ^~~~~~~~~~~~~~ >> fs/f2fs/segment.c:683:7: error: 'BLK_ZONE_TYPE_CONVENTIONAL' undeclared (first use in this function) case BLK_ZONE_TYPE_CONVENTIONAL: ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:683:7: note: each undeclared identifier is reported only once for each function it appears in >> fs/f2fs/segment.c:689:7: error: 'BLK_ZONE_TYPE_SEQWRITE_REQ' undeclared (first use in this function) case BLK_ZONE_TYPE_SEQWRITE_REQ: ^~~~~~~~~~~~~~~~~~~~~~~~~~ >> fs/f2fs/segment.c:690:7: error: 'BLK_ZONE_TYPE_SEQWRITE_PREF' undeclared (first use in this function) case BLK_ZONE_TYPE_SEQWRITE_PREF: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ >> fs/f2fs/segment.c:691:10: error: implicit declaration of function 'blkdev_reset_zones' [-Werror=implicit-function-declaration] return blkdev_reset_zones(bdev, sector, ^~~~~~~~~~~~~~~~~~ In file included from fs/f2fs/segment.c:20:0: fs/f2fs/f2fs.h: In function 'get_blkz_type': >> fs/f2fs/f2fs.h:2427:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors vim +/bdev_zone_size +668 fs/f2fs/segment.c 662 block_t blkstart, block_t blklen) 663 { 664 sector_t sector = SECTOR_FROM_BLOCK(blkstart); 665 sector_t nr_sects = SECTOR_FROM_BLOCK(blklen); 666 struct block_device *bdev = sbi->sb->s_bdev; 667 > 668 if (nr_sects != bdev_zone_size(bdev)) { 669 f2fs_msg(sbi->sb, KERN_INFO, 670 "Unaligned discard attempted (sector %llu + %llu)", 671 (unsigned long long)sector, 672 (unsigned long long)nr_sects); 673 return -EIO; 674 } 675 676 /* 677 * We need to know the type of the zone: for conventional zones, 678 * use regular discard if the drive supports it. For sequential 679 * zones, reset the zone write pointer. 680 */ 681 switch (get_blkz_type(sbi, blkstart)) { 682 > 683 case BLK_ZONE_TYPE_CONVENTIONAL: 684 if (!blk_queue_discard(bdev_get_queue(bdev))) 685 return 0; 686 return __f2fs_issue_discard_async(sbi, blkstart, 687 blklen); 688 > 689 case BLK_ZONE_TYPE_SEQWRITE_REQ: > 690 case BLK_ZONE_TYPE_SEQWRITE_PREF: > 691 return blkdev_reset_zones(bdev, sector, 692 nr_sects, GFP_NOFS); 693 694 default: --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Damien, [auto build test WARNING on v4.9-rc2] [cannot apply to f2fs/dev next-20161028] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] [Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information] url: https://github.com/0day-ci/linux/commits/Damien-Le-Moal/f2fs-Zoned-block-device-support/20161028-160349 reproduce: # apt-get install sparse make ARCH=x86_64 allmodconfig make C=1 CF=-D__CHECK_ENDIAN__ sparse warnings: (new ones prefixed by >>) include/linux/compiler.h:253:8: sparse: attribute 'no_sanitize_address': unknown attribute fs/f2fs/segment.c:668:25: sparse: undefined identifier 'bdev_zone_size' fs/f2fs/f2fs.h:2424:42: sparse: no member 'log_blocks_per_blkz' in struct f2fs_sb_info fs/f2fs/f2fs.h:2426:19: sparse: no member 'blkz_type' in struct f2fs_sb_info fs/f2fs/segment.c:683:14: sparse: undefined identifier 'BLK_ZONE_TYPE_CONVENTIONAL' fs/f2fs/segment.c:689:14: sparse: undefined identifier 'BLK_ZONE_TYPE_SEQWRITE_REQ' fs/f2fs/segment.c:690:14: sparse: undefined identifier 'BLK_ZONE_TYPE_SEQWRITE_PREF' fs/f2fs/segment.c:691:24: sparse: undefined identifier 'blkdev_reset_zones' >> fs/f2fs/segment.c:683:14: sparse: incompatible types for 'case' statement fs/f2fs/segment.c:689:14: sparse: incompatible types for 'case' statement fs/f2fs/segment.c:690:14: sparse: incompatible types for 'case' statement fs/f2fs/segment.c:683:14: sparse: Expected constant expression in case statement fs/f2fs/segment.c:689:14: sparse: Expected constant expression in case statement fs/f2fs/segment.c:690:14: sparse: Expected constant expression in case statement In file included from fs/f2fs/segment.c:20:0: fs/f2fs/f2fs.h: In function 'get_blkz_type': fs/f2fs/f2fs.h:2424:35: error: 'struct f2fs_sb_info' has no member named 'log_blocks_per_blkz'; did you mean 'log_blocks_per_seg'? unsigned int zno = blkaddr >> sbi->log_blocks_per_blkz; ^~ fs/f2fs/f2fs.h:2426:12: error: 'struct f2fs_sb_info' has no member named 'blkz_type' return sbi->blkz_type[zno]; ^~ fs/f2fs/segment.c: In function 'f2fs_issue_discard_zone': fs/f2fs/segment.c:668:18: error: implicit declaration of function 'bdev_zone_size' [-Werror=implicit-function-declaration] if (nr_sects != bdev_zone_size(bdev)) { ^~~~~~~~~~~~~~ fs/f2fs/segment.c:683:7: error: 'BLK_ZONE_TYPE_CONVENTIONAL' undeclared (first use in this function) case BLK_ZONE_TYPE_CONVENTIONAL: ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:683:7: note: each undeclared identifier is reported only once for each function it appears in fs/f2fs/segment.c:689:7: error: 'BLK_ZONE_TYPE_SEQWRITE_REQ' undeclared (first use in this function) case BLK_ZONE_TYPE_SEQWRITE_REQ: ^~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:690:7: error: 'BLK_ZONE_TYPE_SEQWRITE_PREF' undeclared (first use in this function) case BLK_ZONE_TYPE_SEQWRITE_PREF: ^~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/f2fs/segment.c:691:10: error: implicit declaration of function 'blkdev_reset_zones' [-Werror=implicit-function-declaration] return blkdev_reset_zones(bdev, sector, ^~~~~~~~~~~~~~~~~~ In file included from fs/f2fs/segment.c:20:0: fs/f2fs/f2fs.h: In function 'get_blkz_type': fs/f2fs/f2fs.h:2427:1: warning: control reaches end of non-void function [-Wreturn-type] } ^ cc1: some warnings being treated as errors vim +/case +683 fs/f2fs/segment.c 662 block_t blkstart, block_t blklen) 663 { 664 sector_t sector = SECTOR_FROM_BLOCK(blkstart); 665 sector_t nr_sects = SECTOR_FROM_BLOCK(blklen); 666 struct block_device *bdev = sbi->sb->s_bdev; 667 > 668 if (nr_sects != bdev_zone_size(bdev)) { 669 f2fs_msg(sbi->sb, KERN_INFO, 670 "Unaligned discard attempted (sector %llu + %llu)", 671 (unsigned long long)sector, 672 (unsigned long long)nr_sects); 673 return -EIO; 674 } 675 676 /* 677 * We need to know the type of the zone: for conventional zones, 678 * use regular discard if the drive supports it. For sequential 679 * zones, reset the zone write pointer. 680 */ 681 switch (get_blkz_type(sbi, blkstart)) { 682 > 683 case BLK_ZONE_TYPE_CONVENTIONAL: 684 if (!blk_queue_discard(bdev_get_queue(bdev))) 685 return 0; 686 return __f2fs_issue_discard_async(sbi, blkstart, --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c index fc886f0..bce79e2 100644 --- a/fs/f2fs/segment.c +++ b/fs/f2fs/segment.c @@ -633,15 +633,19 @@ static void f2fs_submit_bio_wait_endio(struct bio *bio) } /* this function is copied from blkdev_issue_discard from block/blk-lib.c */ -int __f2fs_issue_discard_async(struct f2fs_sb_info *sbi, sector_t sector, - sector_t nr_sects, gfp_t gfp_mask, unsigned long flags) +static int __f2fs_issue_discard_async(struct f2fs_sb_info *sbi, + block_t blkstart, block_t blklen) { struct block_device *bdev = sbi->sb->s_bdev; struct bio *bio = NULL; int err; - err = __blkdev_issue_discard(bdev, sector, nr_sects, gfp_mask, flags, - &bio); + trace_f2fs_issue_discard(sbi->sb, blkstart, blklen); + + err = __blkdev_issue_discard(bdev, + SECTOR_FROM_BLOCK(blkstart), + SECTOR_FROM_BLOCK(blklen), + GFP_NOFS, 0, &bio); if (!err && bio) { struct bio_entry *be = __add_bio_entry(sbi, bio); @@ -654,11 +658,48 @@ int __f2fs_issue_discard_async(struct f2fs_sb_info *sbi, sector_t sector, return err; } +static int f2fs_issue_discard_zone(struct f2fs_sb_info *sbi, + block_t blkstart, block_t blklen) +{ + sector_t sector = SECTOR_FROM_BLOCK(blkstart); + sector_t nr_sects = SECTOR_FROM_BLOCK(blklen); + struct block_device *bdev = sbi->sb->s_bdev; + + if (nr_sects != bdev_zone_size(bdev)) { + f2fs_msg(sbi->sb, KERN_INFO, + "Unaligned discard attempted (sector %llu + %llu)", + (unsigned long long)sector, + (unsigned long long)nr_sects); + return -EIO; + } + + /* + * We need to know the type of the zone: for conventional zones, + * use regular discard if the drive supports it. For sequential + * zones, reset the zone write pointer. + */ + switch (get_blkz_type(sbi, blkstart)) { + + case BLK_ZONE_TYPE_CONVENTIONAL: + if (!blk_queue_discard(bdev_get_queue(bdev))) + return 0; + return __f2fs_issue_discard_async(sbi, blkstart, + blklen); + + case BLK_ZONE_TYPE_SEQWRITE_REQ: + case BLK_ZONE_TYPE_SEQWRITE_PREF: + return blkdev_reset_zones(bdev, sector, + nr_sects, GFP_NOFS); + + default: + /* Unknown zone type: broken device ? */ + return -EIO; + } +} + static int f2fs_issue_discard(struct f2fs_sb_info *sbi, block_t blkstart, block_t blklen) { - sector_t start = SECTOR_FROM_BLOCK(blkstart); - sector_t len = SECTOR_FROM_BLOCK(blklen); struct seg_entry *se; unsigned int offset; block_t i; @@ -670,8 +711,11 @@ static int f2fs_issue_discard(struct f2fs_sb_info *sbi, if (!f2fs_test_and_set_bit(offset, se->discard_map)) sbi->discard_blks--; } - trace_f2fs_issue_discard(sbi->sb, blkstart, blklen); - return __f2fs_issue_discard_async(sbi, start, len, GFP_NOFS, 0); + + if (f2fs_sb_mounted_blkzoned(sbi->sb)) + return f2fs_issue_discard_zone(sbi, blkstart, blklen); + + return __f2fs_issue_discard_async(sbi, blkstart, blklen); } static void __add_discard_entry(struct f2fs_sb_info *sbi,
When a zoned block device is mounted, discarding sections contained in sequential zones must reset the zone write pointer. For sections contained in conventional zones, the regular discard is used if the drive supports it. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> --- fs/f2fs/segment.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 52 insertions(+), 8 deletions(-)