Re: [PATCH v10 23/41] btrfs: split ordered extent when bio is sent

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Naohiro,

I love your patch! Perhaps something to improve:

[auto build test WARNING on xfs-linux/for-next]
[also build test WARNING on v5.10-rc3]
[cannot apply to kdave/for-next block/for-next next-20201110]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Naohiro-Aota/btrfs-zoned-block-device-support/20201110-193227
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
config: powerpc-randconfig-r022-20201110 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 4d81c8adb6ed9840257f6cb6b93f60856d422a15)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install powerpc cross compiling tool for clang build
        # apt-get install binutils-powerpc-linux-gnu
        # https://github.com/0day-ci/linux/commit/c2b1e52b104fa60d0c731cc5016be18e98ec71d2
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Naohiro-Aota/btrfs-zoned-block-device-support/20201110-193227
        git checkout c2b1e52b104fa60d0c731cc5016be18e98ec71d2
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> fs/btrfs/inode.c:2161:5: warning: no previous prototype for function 'extract_ordered_extent' [-Wmissing-prototypes]
   int extract_ordered_extent(struct inode *inode, struct bio *bio,
       ^
   fs/btrfs/inode.c:2161:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
   int extract_ordered_extent(struct inode *inode, struct bio *bio,
   ^
   static 
   1 warning generated.

vim +/extract_ordered_extent +2161 fs/btrfs/inode.c

  2160	
> 2161	int extract_ordered_extent(struct inode *inode, struct bio *bio,
  2162				   loff_t file_offset)
  2163	{
  2164		struct btrfs_ordered_extent *ordered;
  2165		struct extent_map *em = NULL, *em_new = NULL;
  2166		struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree;
  2167		u64 start = (u64)bio->bi_iter.bi_sector << SECTOR_SHIFT;
  2168		u64 len = bio->bi_iter.bi_size;
  2169		u64 end = start + len;
  2170		u64 ordered_end;
  2171		u64 pre, post;
  2172		int ret = 0;
  2173	
  2174		ordered = btrfs_lookup_ordered_extent(BTRFS_I(inode), file_offset);
  2175		if (WARN_ON_ONCE(!ordered))
  2176			return -EIO;
  2177	
  2178		/* No need to split */
  2179		if (ordered->disk_num_bytes == len)
  2180			goto out;
  2181	
  2182		/* We cannot split once end_bio'd ordered extent */
  2183		if (WARN_ON_ONCE(ordered->bytes_left != ordered->disk_num_bytes)) {
  2184			ret = -EINVAL;
  2185			goto out;
  2186		}
  2187	
  2188		/* We cannot split a compressed ordered extent */
  2189		if (WARN_ON_ONCE(ordered->disk_num_bytes != ordered->num_bytes)) {
  2190			ret = -EINVAL;
  2191			goto out;
  2192		}
  2193	
  2194		/* We cannot split a waited ordered extent */
  2195		if (WARN_ON_ONCE(wq_has_sleeper(&ordered->wait))) {
  2196			ret = -EINVAL;
  2197			goto out;
  2198		}
  2199	
  2200		ordered_end = ordered->disk_bytenr + ordered->disk_num_bytes;
  2201		/* bio must be in one ordered extent */
  2202		if (WARN_ON_ONCE(start < ordered->disk_bytenr || end > ordered_end)) {
  2203			ret = -EINVAL;
  2204			goto out;
  2205		}
  2206	
  2207		/* Checksum list should be empty */
  2208		if (WARN_ON_ONCE(!list_empty(&ordered->list))) {
  2209			ret = -EINVAL;
  2210			goto out;
  2211		}
  2212	
  2213		pre = start - ordered->disk_bytenr;
  2214		post = ordered_end - end;
  2215	
  2216		btrfs_split_ordered_extent(ordered, pre, post);
  2217	
  2218		read_lock(&em_tree->lock);
  2219		em = lookup_extent_mapping(em_tree, ordered->file_offset, len);
  2220		if (!em) {
  2221			read_unlock(&em_tree->lock);
  2222			ret = -EIO;
  2223			goto out;
  2224		}
  2225		read_unlock(&em_tree->lock);
  2226	
  2227		ASSERT(!test_bit(EXTENT_FLAG_COMPRESSED, &em->flags));
  2228		em_new = create_io_em(BTRFS_I(inode), em->start + pre, len,
  2229				      em->start + pre, em->block_start + pre, len,
  2230				      len, len, BTRFS_COMPRESS_NONE,
  2231				      BTRFS_ORDERED_REGULAR);
  2232		free_extent_map(em_new);
  2233	
  2234	out:
  2235		free_extent_map(em);
  2236		btrfs_put_ordered_extent(ordered);
  2237	
  2238		return ret;
  2239	}
  2240	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux