CC: [email protected] TO: Michal Rostecki <[email protected]> CC: David Sterba <[email protected]> CC: Filipe Manana <[email protected]>
tree: https://github.com/kdave/btrfs-devel.git dev/raid-policy head: 92ab5dba1e9e01e617039e8450d1491b0806c31c commit: ab97dc56044d4d8d346e6e294a73f8690d9d3d7b [77/85] btrfs: let callers of btrfs_get_io_geometry pass the em :::::: branch date: 2 hours ago :::::: commit date: 5 hours ago config: i386-randconfig-m021-20210128 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> Reported-by: Dan Carpenter <[email protected]> New smatch warnings: fs/btrfs/inode.c:8052 btrfs_submit_direct() error: uninitialized symbol 'em'. Old smatch warnings: include/linux/fs.h:861 i_size_write() warn: statement has no effect 31 vim +/em +8052 fs/btrfs/inode.c c36cac28cb94e5 Omar Sandoval 2020-04-16 7932 f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 7933 static blk_qc_t btrfs_submit_direct(struct inode *inode, struct iomap *iomap, f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 7934 struct bio *dio_bio, loff_t file_offset) e65e1535542931 Miao Xie 2010-11-22 7935 { c36cac28cb94e5 Omar Sandoval 2020-04-16 7936 const bool write = (bio_op(dio_bio) == REQ_OP_WRITE); 0b246afa62b0cf Jeff Mahoney 2016-06-22 7937 struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb); 769b4f2497bdb3 Omar Sandoval 2020-04-16 7938 const bool raid56 = (btrfs_data_alloc_profile(fs_info) & 769b4f2497bdb3 Omar Sandoval 2020-04-16 7939 BTRFS_BLOCK_GROUP_RAID56_MASK); c36cac28cb94e5 Omar Sandoval 2020-04-16 7940 struct btrfs_dio_private *dip; e65e1535542931 Miao Xie 2010-11-22 7941 struct bio *bio; c36cac28cb94e5 Omar Sandoval 2020-04-16 7942 u64 start_sector; 1ae399382512b3 Josef Bacik 2011-04-06 7943 int async_submit = 0; 725130bac5857a Liu Bo 2017-05-16 7944 u64 submit_len; 725130bac5857a Liu Bo 2017-05-16 7945 int clone_offset = 0; 725130bac5857a Liu Bo 2017-05-16 7946 int clone_len; ab97dc56044d4d Michal Rostecki 2021-01-27 7947 u64 logical; 5f4dc8fc835bbb Chandan Rajendra 2016-01-21 7948 int ret; 58efbc9f546330 Omar Sandoval 2017-08-22 7949 blk_status_t status; 89b798ad1b42b1 Nikolay Borisov 2019-06-03 7950 struct btrfs_io_geometry geom; f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 7951 struct btrfs_dio_data *dio_data = iomap->private; ab97dc56044d4d Michal Rostecki 2021-01-27 7952 struct extent_map *em; e65e1535542931 Miao Xie 2010-11-22 7953 c36cac28cb94e5 Omar Sandoval 2020-04-16 7954 dip = btrfs_create_dio_private(dio_bio, inode, file_offset); c36cac28cb94e5 Omar Sandoval 2020-04-16 7955 if (!dip) { c36cac28cb94e5 Omar Sandoval 2020-04-16 7956 if (!write) { c36cac28cb94e5 Omar Sandoval 2020-04-16 7957 unlock_extent(&BTRFS_I(inode)->io_tree, file_offset, c36cac28cb94e5 Omar Sandoval 2020-04-16 7958 file_offset + dio_bio->bi_iter.bi_size - 1); c36cac28cb94e5 Omar Sandoval 2020-04-16 7959 } c36cac28cb94e5 Omar Sandoval 2020-04-16 7960 dio_bio->bi_status = BLK_STS_RESOURCE; f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 7961 bio_endio(dio_bio); f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 7962 return BLK_QC_T_NONE; c36cac28cb94e5 Omar Sandoval 2020-04-16 7963 } facc8a2247340a Miao Xie 2013-07-25 7964 334c16d82cfe18 Josef Bacik 2020-10-16 7965 if (!write) { 85879573fc8b06 Omar Sandoval 2020-04-16 7966 /* 85879573fc8b06 Omar Sandoval 2020-04-16 7967 * Load the csums up front to reduce csum tree searches and 85879573fc8b06 Omar Sandoval 2020-04-16 7968 * contention when submitting bios. 334c16d82cfe18 Josef Bacik 2020-10-16 7969 * 334c16d82cfe18 Josef Bacik 2020-10-16 7970 * If we have csums disabled this will do nothing. 85879573fc8b06 Omar Sandoval 2020-04-16 7971 */ 6275193ef19033 Qu Wenruo 2020-12-02 7972 status = btrfs_lookup_bio_sums(inode, dio_bio, dip->csums); 85879573fc8b06 Omar Sandoval 2020-04-16 7973 if (status != BLK_STS_OK) 85879573fc8b06 Omar Sandoval 2020-04-16 7974 goto out_err; 02f57c7aedef1a Josef Bacik 2011-04-06 7975 } 02f57c7aedef1a Josef Bacik 2011-04-06 7976 769b4f2497bdb3 Omar Sandoval 2020-04-16 7977 start_sector = dio_bio->bi_iter.bi_sector; ab97dc56044d4d Michal Rostecki 2021-01-27 7978 logical = start_sector << 9; 769b4f2497bdb3 Omar Sandoval 2020-04-16 7979 submit_len = dio_bio->bi_iter.bi_size; 53b381b3abeb86 David Woodhouse 2013-01-29 7980 3c91ee6964114b Arnd Bergmann 2017-05-18 7981 do { ab97dc56044d4d Michal Rostecki 2021-01-27 7982 em = btrfs_get_chunk_map(fs_info, logical, submit_len); ab97dc56044d4d Michal Rostecki 2021-01-27 7983 if (IS_ERR(em)) { ab97dc56044d4d Michal Rostecki 2021-01-27 7984 status = errno_to_blk_status(PTR_ERR(em)); ab97dc56044d4d Michal Rostecki 2021-01-27 7985 em = NULL; ab97dc56044d4d Michal Rostecki 2021-01-27 7986 goto out_err; ab97dc56044d4d Michal Rostecki 2021-01-27 7987 } ab97dc56044d4d Michal Rostecki 2021-01-27 7988 ret = btrfs_get_io_geometry(fs_info, em, btrfs_op(dio_bio), ab97dc56044d4d Michal Rostecki 2021-01-27 7989 logical, submit_len, &geom); 769b4f2497bdb3 Omar Sandoval 2020-04-16 7990 if (ret) { 769b4f2497bdb3 Omar Sandoval 2020-04-16 7991 status = errno_to_blk_status(ret); 769b4f2497bdb3 Omar Sandoval 2020-04-16 7992 goto out_err; 02f57c7aedef1a Josef Bacik 2011-04-06 7993 } 89b798ad1b42b1 Nikolay Borisov 2019-06-03 7994 ASSERT(geom.len <= INT_MAX); 769b4f2497bdb3 Omar Sandoval 2020-04-16 7995 89b798ad1b42b1 Nikolay Borisov 2019-06-03 7996 clone_len = min_t(int, submit_len, geom.len); 7a5c3c9be1059f Miao Xie 2014-06-17 7997 725130bac5857a Liu Bo 2017-05-16 7998 /* 725130bac5857a Liu Bo 2017-05-16 7999 * This will never fail as it's passing GPF_NOFS and 725130bac5857a Liu Bo 2017-05-16 8000 * the allocation is backed by btrfs_bioset. 725130bac5857a Liu Bo 2017-05-16 8001 */ 769b4f2497bdb3 Omar Sandoval 2020-04-16 8002 bio = btrfs_bio_clone_partial(dio_bio, clone_offset, clone_len); 02f57c7aedef1a Josef Bacik 2011-04-06 8003 bio->bi_private = dip; 02f57c7aedef1a Josef Bacik 2011-04-06 8004 bio->bi_end_io = btrfs_end_dio_bio; c1dc08967f69c6 Miao Xie 2014-09-12 8005 btrfs_io_bio(bio)->logical = file_offset; 02f57c7aedef1a Josef Bacik 2011-04-06 8006 725130bac5857a Liu Bo 2017-05-16 8007 ASSERT(submit_len >= clone_len); 725130bac5857a Liu Bo 2017-05-16 8008 submit_len -= clone_len; 725130bac5857a Liu Bo 2017-05-16 8009 e65e1535542931 Miao Xie 2010-11-22 8010 /* 725130bac5857a Liu Bo 2017-05-16 8011 * Increase the count before we submit the bio so we know 725130bac5857a Liu Bo 2017-05-16 8012 * the end IO handler won't happen before we increase the 725130bac5857a Liu Bo 2017-05-16 8013 * count. Otherwise, the dip might get freed before we're 725130bac5857a Liu Bo 2017-05-16 8014 * done setting it up. 769b4f2497bdb3 Omar Sandoval 2020-04-16 8015 * 769b4f2497bdb3 Omar Sandoval 2020-04-16 8016 * We transfer the initial reference to the last bio, so we 769b4f2497bdb3 Omar Sandoval 2020-04-16 8017 * don't need to increment the reference count for the last one. e65e1535542931 Miao Xie 2010-11-22 8018 */ 769b4f2497bdb3 Omar Sandoval 2020-04-16 8019 if (submit_len > 0) { e3b318d14df7d6 Omar Sandoval 2020-04-16 8020 refcount_inc(&dip->refs); 769b4f2497bdb3 Omar Sandoval 2020-04-16 8021 /* 769b4f2497bdb3 Omar Sandoval 2020-04-16 8022 * If we are submitting more than one bio, submit them 769b4f2497bdb3 Omar Sandoval 2020-04-16 8023 * all asynchronously. The exception is RAID 5 or 6, as 769b4f2497bdb3 Omar Sandoval 2020-04-16 8024 * asynchronous checksums make it difficult to collect 769b4f2497bdb3 Omar Sandoval 2020-04-16 8025 * full stripe writes. e65e1535542931 Miao Xie 2010-11-22 8026 */ 769b4f2497bdb3 Omar Sandoval 2020-04-16 8027 if (!raid56) 769b4f2497bdb3 Omar Sandoval 2020-04-16 8028 async_submit = 1; 769b4f2497bdb3 Omar Sandoval 2020-04-16 8029 } 725130bac5857a Liu Bo 2017-05-16 8030 d0ee39349311ce David Sterba 2018-03-08 8031 status = btrfs_submit_dio_bio(bio, inode, file_offset, c329861da40623 Josef Bacik 2012-08-03 8032 async_submit); 58efbc9f546330 Omar Sandoval 2017-08-22 8033 if (status) { e65e1535542931 Miao Xie 2010-11-22 8034 bio_put(bio); 769b4f2497bdb3 Omar Sandoval 2020-04-16 8035 if (submit_len > 0) e3b318d14df7d6 Omar Sandoval 2020-04-16 8036 refcount_dec(&dip->refs); e65e1535542931 Miao Xie 2010-11-22 8037 goto out_err; e65e1535542931 Miao Xie 2010-11-22 8038 } e65e1535542931 Miao Xie 2010-11-22 8039 f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 8040 dio_data->submitted += clone_len; 725130bac5857a Liu Bo 2017-05-16 8041 clone_offset += clone_len; 725130bac5857a Liu Bo 2017-05-16 8042 start_sector += clone_len >> 9; 725130bac5857a Liu Bo 2017-05-16 8043 file_offset += clone_len; ab97dc56044d4d Michal Rostecki 2021-01-27 8044 ab97dc56044d4d Michal Rostecki 2021-01-27 8045 free_extent_map(em); 3c91ee6964114b Arnd Bergmann 2017-05-18 8046 } while (submit_len > 0); f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 8047 return BLK_QC_T_NONE; e65e1535542931 Miao Xie 2010-11-22 8048 e65e1535542931 Miao Xie 2010-11-22 8049 out_err: 769b4f2497bdb3 Omar Sandoval 2020-04-16 8050 dip->dio_bio->bi_status = status; 769b4f2497bdb3 Omar Sandoval 2020-04-16 8051 btrfs_dio_private_put(dip); ab97dc56044d4d Michal Rostecki 2021-01-27 @8052 free_extent_map(em); ab97dc56044d4d Michal Rostecki 2021-01-27 8053 f85781fb505ec0 Goldwyn Rodrigues 2020-08-17 8054 return BLK_QC_T_NONE; 4b46fce23349bf Josef Bacik 2010-05-23 8055 } 4b46fce23349bf Josef Bacik 2010-05-23 8056 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected]
.config.gz
Description: application/gzip
_______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
