Re: [PATCH] Btrfs: subpage-blocksize: Define extent_buffer_head.

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

 



Hi Chandan,

[auto build test ERROR on tip/perf/core]
[also build test ERROR on v4.6-rc3 next-20160415]
[cannot apply to btrfs/next]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Chandan-Rajendra/Btrfs-subpage-blocksize-Define-extent_buffer_head/20160417-202933
config: xtensa-allyesconfig (attached as .config)
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=xtensa 

All errors (new ones prefixed by >>):

   fs/btrfs/extent_io.c: In function 'alloc_test_extent_buffer':
>> fs/btrfs/extent_io.c:4953:4: error: 'struct extent_buffer' has no member named 'fs_info'
     eb->fs_info = fs_info;
       ^
>> fs/btrfs/extent_io.c:4971:41: error: 'struct extent_buffer' has no member named 'bflags'
     set_bit(EXTENT_BUFFER_HEAD_IN_TREE, &eb->bflags);
                                            ^
   In file included from include/linux/atomic.h:4:0,
                    from include/linux/debug_locks.h:5,
                    from include/linux/lockdep.h:23,
                    from include/linux/spinlock_types.h:18,
                    from include/linux/spinlock.h:81,
                    from include/linux/mmzone.h:7,
                    from include/linux/gfp.h:5,
                    from include/linux/slab.h:14,
                    from fs/btrfs/extent_io.c:2:
>> fs/btrfs/extent_io.c:4979:16: error: 'struct extent_buffer' has no member named 'refs'
     atomic_inc(&eb->refs);
                   ^
   arch/xtensa/include/asm/atomic.h:173:37: note: in definition of macro 'atomic_inc'
    #define atomic_inc(v) atomic_add(1,(v))
                                        ^
   In file included from arch/xtensa/include/asm/processor.h:16:0,
                    from arch/xtensa/include/asm/bitops.h:22,
                    from include/linux/bitops.h:36,
                    from fs/btrfs/extent_io.c:1:
   fs/btrfs/extent_io.c: In function 'release_extent_buffer':
>> fs/btrfs/extent_io.c:5149:16: error: 'buf' undeclared (first use in this function)
          &eb_head(buf)->bflags))) {
                   ^
   include/linux/compiler.h:170:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
   fs/btrfs/extent_io.c:5149:16: note: each undeclared identifier is reported only once for each function it appears in
          &eb_head(buf)->bflags))) {
                   ^
   include/linux/compiler.h:170:42: note: in definition of macro 'unlikely'
    # define unlikely(x) __builtin_expect(!!(x), 0)
                                             ^
>> fs/btrfs/extent_io.c:5150:33: error: 'eb' undeclared (first use in this function)
       __free_extent_buffer(eb_head(eb));
                                    ^

vim +4953 fs/btrfs/extent_io.c

faa2dbf00 Josef Bacik         2014-05-07  4947  	eb = find_extent_buffer(fs_info, start);
faa2dbf00 Josef Bacik         2014-05-07  4948  	if (eb)
faa2dbf00 Josef Bacik         2014-05-07  4949  		return eb;
3f556f785 David Sterba        2014-06-15  4950  	eb = alloc_dummy_extent_buffer(fs_info, start);
faa2dbf00 Josef Bacik         2014-05-07  4951  	if (!eb)
faa2dbf00 Josef Bacik         2014-05-07  4952  		return NULL;
faa2dbf00 Josef Bacik         2014-05-07 @4953  	eb->fs_info = fs_info;
faa2dbf00 Josef Bacik         2014-05-07  4954  again:
faa2dbf00 Josef Bacik         2014-05-07  4955  	ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM);
faa2dbf00 Josef Bacik         2014-05-07  4956  	if (ret)
faa2dbf00 Josef Bacik         2014-05-07  4957  		goto free_eb;
faa2dbf00 Josef Bacik         2014-05-07  4958  	spin_lock(&fs_info->buffer_lock);
faa2dbf00 Josef Bacik         2014-05-07  4959  	ret = radix_tree_insert(&fs_info->buffer_radix,
09cbfeaf1 Kirill A. Shutemov  2016-04-01  4960  				start >> PAGE_SHIFT, eb);
faa2dbf00 Josef Bacik         2014-05-07  4961  	spin_unlock(&fs_info->buffer_lock);
faa2dbf00 Josef Bacik         2014-05-07  4962  	radix_tree_preload_end();
faa2dbf00 Josef Bacik         2014-05-07  4963  	if (ret == -EEXIST) {
faa2dbf00 Josef Bacik         2014-05-07  4964  		exists = find_extent_buffer(fs_info, start);
faa2dbf00 Josef Bacik         2014-05-07  4965  		if (exists)
faa2dbf00 Josef Bacik         2014-05-07  4966  			goto free_eb;
faa2dbf00 Josef Bacik         2014-05-07  4967  		else
faa2dbf00 Josef Bacik         2014-05-07  4968  			goto again;
faa2dbf00 Josef Bacik         2014-05-07  4969  	}
faa2dbf00 Josef Bacik         2014-05-07  4970  	check_buffer_tree_ref(eb);
e6fa7cb7e Chandan Rajendra    2016-04-17 @4971  	set_bit(EXTENT_BUFFER_HEAD_IN_TREE, &eb->bflags);
faa2dbf00 Josef Bacik         2014-05-07  4972  
faa2dbf00 Josef Bacik         2014-05-07  4973  	/*
faa2dbf00 Josef Bacik         2014-05-07  4974  	 * We will free dummy extent buffer's if they come into
faa2dbf00 Josef Bacik         2014-05-07  4975  	 * free_extent_buffer with a ref count of 2, but if we are using this we
faa2dbf00 Josef Bacik         2014-05-07  4976  	 * want the buffers to stay in memory until we're done with them, so
faa2dbf00 Josef Bacik         2014-05-07  4977  	 * bump the ref count again.
faa2dbf00 Josef Bacik         2014-05-07  4978  	 */
faa2dbf00 Josef Bacik         2014-05-07 @4979  	atomic_inc(&eb->refs);
faa2dbf00 Josef Bacik         2014-05-07  4980  	return eb;
faa2dbf00 Josef Bacik         2014-05-07  4981  free_eb:
faa2dbf00 Josef Bacik         2014-05-07  4982  	btrfs_release_extent_buffer(eb);
faa2dbf00 Josef Bacik         2014-05-07  4983  	return exists;
faa2dbf00 Josef Bacik         2014-05-07  4984  }
faa2dbf00 Josef Bacik         2014-05-07  4985  #endif
faa2dbf00 Josef Bacik         2014-05-07  4986  
f28491e0a Josef Bacik         2013-12-16  4987  struct extent_buffer *alloc_extent_buffer(struct btrfs_fs_info *fs_info,
ce3e69847 David Sterba        2014-06-15  4988  					  u64 start)
d1310b2e0 Chris Mason         2008-01-24  4989  {
ce3e69847 David Sterba        2014-06-15  4990  	unsigned long len = fs_info->tree_root->nodesize;
d1310b2e0 Chris Mason         2008-01-24  4991  	unsigned long num_pages = num_extent_pages(start, len);
d1310b2e0 Chris Mason         2008-01-24  4992  	unsigned long i;
09cbfeaf1 Kirill A. Shutemov  2016-04-01  4993  	unsigned long index = start >> PAGE_SHIFT;
e6fa7cb7e Chandan Rajendra    2016-04-17  4994  	struct extent_buffer *eb, *cur_eb;
6af118ce5 Chris Mason         2008-07-22  4995  	struct extent_buffer *exists = NULL;
d1310b2e0 Chris Mason         2008-01-24  4996  	struct page *p;
f28491e0a Josef Bacik         2013-12-16  4997  	struct address_space *mapping = fs_info->btree_inode->i_mapping;
d1310b2e0 Chris Mason         2008-01-24  4998  	int uptodate = 1;
19fe0a8b7 Miao Xie            2010-10-26  4999  	int ret;
d1310b2e0 Chris Mason         2008-01-24  5000  
f28491e0a Josef Bacik         2013-12-16  5001  	eb = find_extent_buffer(fs_info, start);
452c75c3d Chandra Seetharaman 2013-10-07  5002  	if (eb)
6af118ce5 Chris Mason         2008-07-22  5003  		return eb;
6af118ce5 Chris Mason         2008-07-22  5004  
23d79d81b David Sterba        2014-06-15  5005  	eb = __alloc_extent_buffer(fs_info, start, len);
2b114d1d3 Peter               2008-04-01  5006  	if (!eb)
d1310b2e0 Chris Mason         2008-01-24  5007  		return NULL;
d1310b2e0 Chris Mason         2008-01-24  5008  
727011e07 Chris Mason         2010-08-06  5009  	for (i = 0; i < num_pages; i++, index++) {
d1b5c5671 Michal Hocko        2015-08-19  5010  		p = find_or_create_page(mapping, index, GFP_NOFS|__GFP_NOFAIL);
4804b3829 Josef Bacik         2012-10-05  5011  		if (!p)
6af118ce5 Chris Mason         2008-07-22  5012  			goto free_eb;
4f2de97ac Josef Bacik         2012-03-07  5013  
4f2de97ac Josef Bacik         2012-03-07  5014  		spin_lock(&mapping->private_lock);
4f2de97ac Josef Bacik         2012-03-07  5015  		if (PagePrivate(p)) {
4f2de97ac Josef Bacik         2012-03-07  5016  			/*
4f2de97ac Josef Bacik         2012-03-07  5017  			 * We could have already allocated an eb for this page
4f2de97ac Josef Bacik         2012-03-07  5018  			 * and attached one so lets see if we can get a ref on
4f2de97ac Josef Bacik         2012-03-07  5019  			 * the existing eb, and if we can we know it's good and
4f2de97ac Josef Bacik         2012-03-07  5020  			 * we can just return that one, else we know we can just
4f2de97ac Josef Bacik         2012-03-07  5021  			 * overwrite page->private.
4f2de97ac Josef Bacik         2012-03-07  5022  			 */
4f2de97ac Josef Bacik         2012-03-07  5023  			exists = (struct extent_buffer *)p->private;
e6fa7cb7e Chandan Rajendra    2016-04-17  5024  			if (atomic_inc_not_zero(&eb_head(exists)->refs)) {
4f2de97ac Josef Bacik         2012-03-07  5025  				spin_unlock(&mapping->private_lock);
4f2de97ac Josef Bacik         2012-03-07  5026  				unlock_page(p);
09cbfeaf1 Kirill A. Shutemov  2016-04-01  5027  				put_page(p);
e6fa7cb7e Chandan Rajendra    2016-04-17  5028  				do {
e6fa7cb7e Chandan Rajendra    2016-04-17  5029  					if (exists->start == start) {
2457aec63 Mel Gorman          2014-06-04  5030  						mark_extent_buffer_accessed(exists, p);
4f2de97ac Josef Bacik         2012-03-07  5031  						goto free_eb;
4f2de97ac Josef Bacik         2012-03-07  5032  					}
e6fa7cb7e Chandan Rajendra    2016-04-17  5033  				} while ((exists = exists->eb_next) != NULL);
e6fa7cb7e Chandan Rajendra    2016-04-17  5034  
e6fa7cb7e Chandan Rajendra    2016-04-17  5035  				BUG();
e6fa7cb7e Chandan Rajendra    2016-04-17  5036  			}
5ca64f45e Omar Sandoval       2015-02-24  5037  			exists = NULL;
4f2de97ac Josef Bacik         2012-03-07  5038  
4f2de97ac Josef Bacik         2012-03-07  5039  			/*
4f2de97ac Josef Bacik         2012-03-07  5040  			 * Do this so attach doesn't complain and we need to
4f2de97ac Josef Bacik         2012-03-07  5041  			 * drop the ref the old guy had.
4f2de97ac Josef Bacik         2012-03-07  5042  			 */
4f2de97ac Josef Bacik         2012-03-07  5043  			ClearPagePrivate(p);
0b32f4bbb Josef Bacik         2012-03-13  5044  			WARN_ON(PageDirty(p));
09cbfeaf1 Kirill A. Shutemov  2016-04-01  5045  			put_page(p);
d1310b2e0 Chris Mason         2008-01-24  5046  		}
e6fa7cb7e Chandan Rajendra    2016-04-17  5047  		attach_extent_buffer_page(&(eb_head(eb)->eb), p);
4f2de97ac Josef Bacik         2012-03-07  5048  		spin_unlock(&mapping->private_lock);
0b32f4bbb Josef Bacik         2012-03-13  5049  		WARN_ON(PageDirty(p));
e6fa7cb7e Chandan Rajendra    2016-04-17  5050  		mark_page_accessed(p);
e6fa7cb7e Chandan Rajendra    2016-04-17  5051  		eb_head(eb)->pages[i] = p;
d1310b2e0 Chris Mason         2008-01-24  5052  		if (!PageUptodate(p))
d1310b2e0 Chris Mason         2008-01-24  5053  			uptodate = 0;
eb14ab8ed Chris Mason         2011-02-10  5054  
eb14ab8ed Chris Mason         2011-02-10  5055  		/*
eb14ab8ed Chris Mason         2011-02-10  5056  		 * see below about how we avoid a nasty race with release page
eb14ab8ed Chris Mason         2011-02-10  5057  		 * and why we unlock later
eb14ab8ed Chris Mason         2011-02-10  5058  		 */
d1310b2e0 Chris Mason         2008-01-24  5059  	}
e6fa7cb7e Chandan Rajendra    2016-04-17  5060  	if (uptodate) {
e6fa7cb7e Chandan Rajendra    2016-04-17  5061  		cur_eb = &(eb_head(eb)->eb);
e6fa7cb7e Chandan Rajendra    2016-04-17  5062  		do {
e6fa7cb7e Chandan Rajendra    2016-04-17  5063  			set_bit(EXTENT_BUFFER_UPTODATE, &cur_eb->ebflags);
e6fa7cb7e Chandan Rajendra    2016-04-17  5064  		} while ((cur_eb = cur_eb->eb_next) != NULL);
e6fa7cb7e Chandan Rajendra    2016-04-17  5065  	}
115391d23 Josef Bacik         2012-03-09  5066  again:
19fe0a8b7 Miao Xie            2010-10-26  5067  	ret = radix_tree_preload(GFP_NOFS & ~__GFP_HIGHMEM);
e6fa7cb7e Chandan Rajendra    2016-04-17  5068  	if (ret) {
e6fa7cb7e Chandan Rajendra    2016-04-17  5069  		exists = NULL;
19fe0a8b7 Miao Xie            2010-10-26  5070  		goto free_eb;
e6fa7cb7e Chandan Rajendra    2016-04-17  5071  	}
19fe0a8b7 Miao Xie            2010-10-26  5072  
f28491e0a Josef Bacik         2013-12-16  5073  	spin_lock(&fs_info->buffer_lock);
f28491e0a Josef Bacik         2013-12-16  5074  	ret = radix_tree_insert(&fs_info->buffer_radix,
e6fa7cb7e Chandan Rajendra    2016-04-17  5075  				start >> PAGE_SHIFT, eb_head(eb));
f28491e0a Josef Bacik         2013-12-16  5076  	spin_unlock(&fs_info->buffer_lock);
19fe0a8b7 Miao Xie            2010-10-26  5077  	radix_tree_preload_end();
452c75c3d Chandra Seetharaman 2013-10-07  5078  	if (ret == -EEXIST) {
f28491e0a Josef Bacik         2013-12-16  5079  		exists = find_extent_buffer(fs_info, start);
452c75c3d Chandra Seetharaman 2013-10-07  5080  		if (exists)
6af118ce5 Chris Mason         2008-07-22  5081  			goto free_eb;
452c75c3d Chandra Seetharaman 2013-10-07  5082  		else
452c75c3d Chandra Seetharaman 2013-10-07  5083  			goto again;
6af118ce5 Chris Mason         2008-07-22  5084  	}
6af118ce5 Chris Mason         2008-07-22  5085  	/* add one reference for the tree */
0b32f4bbb Josef Bacik         2012-03-13  5086  	check_buffer_tree_ref(eb);
e6fa7cb7e Chandan Rajendra    2016-04-17  5087  	set_bit(EXTENT_BUFFER_HEAD_IN_TREE, &eb_head(eb)->bflags);
eb14ab8ed Chris Mason         2011-02-10  5088  
eb14ab8ed Chris Mason         2011-02-10  5089  	/*
eb14ab8ed Chris Mason         2011-02-10  5090  	 * there is a race where release page may have
eb14ab8ed Chris Mason         2011-02-10  5091  	 * tried to find this extent buffer in the radix
eb14ab8ed Chris Mason         2011-02-10  5092  	 * but failed.  It will tell the VM it is safe to
eb14ab8ed Chris Mason         2011-02-10  5093  	 * reclaim the, and it will clear the page private bit.
eb14ab8ed Chris Mason         2011-02-10  5094  	 * We must make sure to set the page private bit properly
eb14ab8ed Chris Mason         2011-02-10  5095  	 * after the extent buffer is in the radix tree so
eb14ab8ed Chris Mason         2011-02-10  5096  	 * it doesn't get lost
eb14ab8ed Chris Mason         2011-02-10  5097  	 */
e6fa7cb7e Chandan Rajendra    2016-04-17  5098  	SetPageChecked(eb_head(eb)->pages[0]);
727011e07 Chris Mason         2010-08-06  5099  	for (i = 1; i < num_pages; i++) {
e6fa7cb7e Chandan Rajendra    2016-04-17  5100  		p = eb_head(eb)->pages[i];
727011e07 Chris Mason         2010-08-06  5101  		ClearPageChecked(p);
727011e07 Chris Mason         2010-08-06  5102  		unlock_page(p);
727011e07 Chris Mason         2010-08-06  5103  	}
e6fa7cb7e Chandan Rajendra    2016-04-17  5104  	unlock_page(eb_head(eb)->pages[0]);
d1310b2e0 Chris Mason         2008-01-24  5105  	return eb;
d1310b2e0 Chris Mason         2008-01-24  5106  
6af118ce5 Chris Mason         2008-07-22  5107  free_eb:
e6fa7cb7e Chandan Rajendra    2016-04-17  5108  	WARN_ON(!atomic_dec_and_test(&eb_head(eb)->refs));
727011e07 Chris Mason         2010-08-06  5109  	for (i = 0; i < num_pages; i++) {
e6fa7cb7e Chandan Rajendra    2016-04-17  5110  		if (eb_head(eb)->pages[i])
e6fa7cb7e Chandan Rajendra    2016-04-17  5111  			unlock_page(eb_head(eb)->pages[i]);
727011e07 Chris Mason         2010-08-06  5112  	}
eb14ab8ed Chris Mason         2011-02-10  5113  
897ca6e9b Miao Xie            2010-10-26  5114  	btrfs_release_extent_buffer(eb);
6af118ce5 Chris Mason         2008-07-22  5115  	return exists;
d1310b2e0 Chris Mason         2008-01-24  5116  }
d1310b2e0 Chris Mason         2008-01-24  5117  
3083ee2e1 Josef Bacik         2012-03-09  5118  static inline void btrfs_release_extent_buffer_rcu(struct rcu_head *head)
3083ee2e1 Josef Bacik         2012-03-09  5119  {
e6fa7cb7e Chandan Rajendra    2016-04-17  5120  	struct extent_buffer_head *ebh =
e6fa7cb7e Chandan Rajendra    2016-04-17  5121  			container_of(head, struct extent_buffer_head, rcu_head);
3083ee2e1 Josef Bacik         2012-03-09  5122  
e6fa7cb7e Chandan Rajendra    2016-04-17  5123  	__free_extent_buffer(ebh);
3083ee2e1 Josef Bacik         2012-03-09  5124  }
3083ee2e1 Josef Bacik         2012-03-09  5125  
3083ee2e1 Josef Bacik         2012-03-09  5126  /* Expects to have eb->eb_lock already held */
e6fa7cb7e Chandan Rajendra    2016-04-17  5127  static int release_extent_buffer(struct extent_buffer_head *ebh)
3083ee2e1 Josef Bacik         2012-03-09  5128  {
e6fa7cb7e Chandan Rajendra    2016-04-17  5129  	WARN_ON(atomic_read(&ebh->refs) == 0);
e6fa7cb7e Chandan Rajendra    2016-04-17  5130  	if (atomic_dec_and_test(&ebh->refs)) {
e6fa7cb7e Chandan Rajendra    2016-04-17  5131  		if (test_and_clear_bit(EXTENT_BUFFER_HEAD_IN_TREE,
e6fa7cb7e Chandan Rajendra    2016-04-17  5132  					&ebh->bflags)) {
e6fa7cb7e Chandan Rajendra    2016-04-17  5133  			struct btrfs_fs_info *fs_info = ebh->fs_info;
3083ee2e1 Josef Bacik         2012-03-09  5134  
e6fa7cb7e Chandan Rajendra    2016-04-17  5135  			spin_unlock(&ebh->refs_lock);
3083ee2e1 Josef Bacik         2012-03-09  5136  
f28491e0a Josef Bacik         2013-12-16  5137  			spin_lock(&fs_info->buffer_lock);
f28491e0a Josef Bacik         2013-12-16  5138  			radix_tree_delete(&fs_info->buffer_radix,
e6fa7cb7e Chandan Rajendra    2016-04-17  5139  					ebh->eb.start >> PAGE_SHIFT);
f28491e0a Josef Bacik         2013-12-16  5140  			spin_unlock(&fs_info->buffer_lock);
34b41acec Josef Bacik         2013-12-13  5141  		} else {
e6fa7cb7e Chandan Rajendra    2016-04-17  5142  			spin_unlock(&ebh->refs_lock);
815a51c74 Jan Schmidt         2012-05-16  5143  		}
3083ee2e1 Josef Bacik         2012-03-09  5144  
3083ee2e1 Josef Bacik         2012-03-09  5145  		/* Should be safe to release our pages at this point */
e6fa7cb7e Chandan Rajendra    2016-04-17  5146  		btrfs_release_extent_buffer_page(&ebh->eb);
bcb7e449e Josef Bacik         2015-03-16  5147  #ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS
e6fa7cb7e Chandan Rajendra    2016-04-17  5148  		if (unlikely(test_bit(EXTENT_BUFFER_HEAD_DUMMY,
e6fa7cb7e Chandan Rajendra    2016-04-17 @5149  						&eb_head(buf)->bflags))) {
e6fa7cb7e Chandan Rajendra    2016-04-17 @5150  			__free_extent_buffer(eb_head(eb));
bcb7e449e Josef Bacik         2015-03-16  5151  			return 1;
bcb7e449e Josef Bacik         2015-03-16  5152  		}
bcb7e449e Josef Bacik         2015-03-16  5153  #endif

:::::: The code at line 4953 was first introduced by commit
:::::: faa2dbf004e89e8f7ccd28fbe6f07c308417b8ae Btrfs: add sanity tests for new qgroup accounting code

:::::: TO: Josef Bacik <jbacik@xxxxxx>
:::::: CC: Chris Mason <clm@xxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: Binary data


[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux