Message ID | 20220815185452.37447-6-vishal.moola@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | Convert to filemap_get_folios_contig() | expand |
Hi "Vishal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220815]
[cannot apply to kdave/for-next]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20220816/202208160738.yErltyXd-lkp@intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/ce1966344933bbe10010035cd25f23ec7dd76914
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
git checkout ce1966344933bbe10010035cd25f23ec7dd76914
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash fs/nilfs2/
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
fs/nilfs2/page.c: In function 'nilfs_find_uncommitted_extent':
>> fs/nilfs2/page.c:542:1: warning: label 'out' defined but not used [-Wunused-label]
542 | out:
| ^~~
vim +/out +542 fs/nilfs2/page.c
622daaff0a8975 Ryusuke Konishi 2010-12-26 466
622daaff0a8975 Ryusuke Konishi 2010-12-26 467 /**
622daaff0a8975 Ryusuke Konishi 2010-12-26 468 * nilfs_find_uncommitted_extent - find extent of uncommitted data
622daaff0a8975 Ryusuke Konishi 2010-12-26 469 * @inode: inode
622daaff0a8975 Ryusuke Konishi 2010-12-26 470 * @start_blk: start block offset (in)
622daaff0a8975 Ryusuke Konishi 2010-12-26 471 * @blkoff: start offset of the found extent (out)
622daaff0a8975 Ryusuke Konishi 2010-12-26 472 *
622daaff0a8975 Ryusuke Konishi 2010-12-26 473 * This function searches an extent of buffers marked "delayed" which
622daaff0a8975 Ryusuke Konishi 2010-12-26 474 * starts from a block offset equal to or larger than @start_blk. If
622daaff0a8975 Ryusuke Konishi 2010-12-26 475 * such an extent was found, this will store the start offset in
622daaff0a8975 Ryusuke Konishi 2010-12-26 476 * @blkoff and return its length in blocks. Otherwise, zero is
622daaff0a8975 Ryusuke Konishi 2010-12-26 477 * returned.
622daaff0a8975 Ryusuke Konishi 2010-12-26 478 */
622daaff0a8975 Ryusuke Konishi 2010-12-26 479 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
622daaff0a8975 Ryusuke Konishi 2010-12-26 480 sector_t start_blk,
622daaff0a8975 Ryusuke Konishi 2010-12-26 481 sector_t *blkoff)
622daaff0a8975 Ryusuke Konishi 2010-12-26 482 {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 483) unsigned int i, nr;
622daaff0a8975 Ryusuke Konishi 2010-12-26 484 pgoff_t index;
622daaff0a8975 Ryusuke Konishi 2010-12-26 485 unsigned int nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 486 unsigned long length = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 487 sector_t b;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 488) struct folio_batch fbatch;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 489) struct folio *folio;
622daaff0a8975 Ryusuke Konishi 2010-12-26 490
622daaff0a8975 Ryusuke Konishi 2010-12-26 491 if (inode->i_mapping->nrpages == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 492 return 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 493
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 494 index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 495 nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 496
ce1966344933bb Vishal Moola (Oracle 2022-08-15 497) folio_batch_init(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 498
622daaff0a8975 Ryusuke Konishi 2010-12-26 499 repeat:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 500) nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
ce1966344933bb Vishal Moola (Oracle 2022-08-15 501) &fbatch);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 502) if (nr == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 503 return length;
622daaff0a8975 Ryusuke Konishi 2010-12-26 504
ce1966344933bb Vishal Moola (Oracle 2022-08-15 505) b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 506 i = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 507 do {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 508) folio = fbatch.folios[i];
622daaff0a8975 Ryusuke Konishi 2010-12-26 509
ce1966344933bb Vishal Moola (Oracle 2022-08-15 510) folio_lock(folio);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 511) if (folio_buffers(folio)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 512 struct buffer_head *bh, *head;
622daaff0a8975 Ryusuke Konishi 2010-12-26 513
ce1966344933bb Vishal Moola (Oracle 2022-08-15 514) bh = head = folio_buffers(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 515 do {
622daaff0a8975 Ryusuke Konishi 2010-12-26 516 if (b < start_blk)
622daaff0a8975 Ryusuke Konishi 2010-12-26 517 continue;
622daaff0a8975 Ryusuke Konishi 2010-12-26 518 if (buffer_delay(bh)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 519 if (length == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 520 *blkoff = b;
622daaff0a8975 Ryusuke Konishi 2010-12-26 521 length++;
622daaff0a8975 Ryusuke Konishi 2010-12-26 522 } else if (length > 0) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 523 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 524 }
622daaff0a8975 Ryusuke Konishi 2010-12-26 525 } while (++b, bh = bh->b_this_page, bh != head);
622daaff0a8975 Ryusuke Konishi 2010-12-26 526 } else {
622daaff0a8975 Ryusuke Konishi 2010-12-26 527 if (length > 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 528 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 529
622daaff0a8975 Ryusuke Konishi 2010-12-26 530 b += nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 531 }
ce1966344933bb Vishal Moola (Oracle 2022-08-15 532) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 533
ce1966344933bb Vishal Moola (Oracle 2022-08-15 534) } while (++i < nr);
622daaff0a8975 Ryusuke Konishi 2010-12-26 535
ce1966344933bb Vishal Moola (Oracle 2022-08-15 536) folio_batch_release(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 537 cond_resched();
622daaff0a8975 Ryusuke Konishi 2010-12-26 538 goto repeat;
622daaff0a8975 Ryusuke Konishi 2010-12-26 539
622daaff0a8975 Ryusuke Konishi 2010-12-26 540 out_locked:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 541) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 @542 out:
Hi "Vishal,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v6.0-rc1 next-20220815]
[cannot apply to kdave/for-next konis-nilfs2/upstream]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 568035b01cfb107af8d2e4bd2fb9aea22cf5b868
config: s390-randconfig-r044-20220815 (https://download.01.org/0day-ci/archive/20220816/202208161010.5ZmABhnS-lkp@intel.com/config)
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6afcc4a459ead8809a0d6d9b4bf7b64bcc13582b)
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 s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/intel-lab-lkp/linux/commit/ce1966344933bbe10010035cd25f23ec7dd76914
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Vishal-Moola-Oracle/Convert-to-filemap_get_folios_contig/20220816-025830
git checkout ce1966344933bbe10010035cd25f23ec7dd76914
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> fs/nilfs2/page.c:542:1: warning: unused label 'out' [-Wunused-label]
out:
^~~~
1 warning generated.
vim +/out +542 fs/nilfs2/page.c
622daaff0a8975 Ryusuke Konishi 2010-12-26 466
622daaff0a8975 Ryusuke Konishi 2010-12-26 467 /**
622daaff0a8975 Ryusuke Konishi 2010-12-26 468 * nilfs_find_uncommitted_extent - find extent of uncommitted data
622daaff0a8975 Ryusuke Konishi 2010-12-26 469 * @inode: inode
622daaff0a8975 Ryusuke Konishi 2010-12-26 470 * @start_blk: start block offset (in)
622daaff0a8975 Ryusuke Konishi 2010-12-26 471 * @blkoff: start offset of the found extent (out)
622daaff0a8975 Ryusuke Konishi 2010-12-26 472 *
622daaff0a8975 Ryusuke Konishi 2010-12-26 473 * This function searches an extent of buffers marked "delayed" which
622daaff0a8975 Ryusuke Konishi 2010-12-26 474 * starts from a block offset equal to or larger than @start_blk. If
622daaff0a8975 Ryusuke Konishi 2010-12-26 475 * such an extent was found, this will store the start offset in
622daaff0a8975 Ryusuke Konishi 2010-12-26 476 * @blkoff and return its length in blocks. Otherwise, zero is
622daaff0a8975 Ryusuke Konishi 2010-12-26 477 * returned.
622daaff0a8975 Ryusuke Konishi 2010-12-26 478 */
622daaff0a8975 Ryusuke Konishi 2010-12-26 479 unsigned long nilfs_find_uncommitted_extent(struct inode *inode,
622daaff0a8975 Ryusuke Konishi 2010-12-26 480 sector_t start_blk,
622daaff0a8975 Ryusuke Konishi 2010-12-26 481 sector_t *blkoff)
622daaff0a8975 Ryusuke Konishi 2010-12-26 482 {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 483) unsigned int i, nr;
622daaff0a8975 Ryusuke Konishi 2010-12-26 484 pgoff_t index;
622daaff0a8975 Ryusuke Konishi 2010-12-26 485 unsigned int nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 486 unsigned long length = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 487 sector_t b;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 488) struct folio_batch fbatch;
ce1966344933bb Vishal Moola (Oracle 2022-08-15 489) struct folio *folio;
622daaff0a8975 Ryusuke Konishi 2010-12-26 490
622daaff0a8975 Ryusuke Konishi 2010-12-26 491 if (inode->i_mapping->nrpages == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 492 return 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 493
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 494 index = start_blk >> (PAGE_SHIFT - inode->i_blkbits);
09cbfeaf1a5a67 Kirill A. Shutemov 2016-04-01 495 nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 496
ce1966344933bb Vishal Moola (Oracle 2022-08-15 497) folio_batch_init(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 498
622daaff0a8975 Ryusuke Konishi 2010-12-26 499 repeat:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 500) nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX,
ce1966344933bb Vishal Moola (Oracle 2022-08-15 501) &fbatch);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 502) if (nr == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 503 return length;
622daaff0a8975 Ryusuke Konishi 2010-12-26 504
ce1966344933bb Vishal Moola (Oracle 2022-08-15 505) b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits);
622daaff0a8975 Ryusuke Konishi 2010-12-26 506 i = 0;
622daaff0a8975 Ryusuke Konishi 2010-12-26 507 do {
ce1966344933bb Vishal Moola (Oracle 2022-08-15 508) folio = fbatch.folios[i];
622daaff0a8975 Ryusuke Konishi 2010-12-26 509
ce1966344933bb Vishal Moola (Oracle 2022-08-15 510) folio_lock(folio);
ce1966344933bb Vishal Moola (Oracle 2022-08-15 511) if (folio_buffers(folio)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 512 struct buffer_head *bh, *head;
622daaff0a8975 Ryusuke Konishi 2010-12-26 513
ce1966344933bb Vishal Moola (Oracle 2022-08-15 514) bh = head = folio_buffers(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 515 do {
622daaff0a8975 Ryusuke Konishi 2010-12-26 516 if (b < start_blk)
622daaff0a8975 Ryusuke Konishi 2010-12-26 517 continue;
622daaff0a8975 Ryusuke Konishi 2010-12-26 518 if (buffer_delay(bh)) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 519 if (length == 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 520 *blkoff = b;
622daaff0a8975 Ryusuke Konishi 2010-12-26 521 length++;
622daaff0a8975 Ryusuke Konishi 2010-12-26 522 } else if (length > 0) {
622daaff0a8975 Ryusuke Konishi 2010-12-26 523 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 524 }
622daaff0a8975 Ryusuke Konishi 2010-12-26 525 } while (++b, bh = bh->b_this_page, bh != head);
622daaff0a8975 Ryusuke Konishi 2010-12-26 526 } else {
622daaff0a8975 Ryusuke Konishi 2010-12-26 527 if (length > 0)
622daaff0a8975 Ryusuke Konishi 2010-12-26 528 goto out_locked;
622daaff0a8975 Ryusuke Konishi 2010-12-26 529
622daaff0a8975 Ryusuke Konishi 2010-12-26 530 b += nblocks_in_page;
622daaff0a8975 Ryusuke Konishi 2010-12-26 531 }
ce1966344933bb Vishal Moola (Oracle 2022-08-15 532) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 533
ce1966344933bb Vishal Moola (Oracle 2022-08-15 534) } while (++i < nr);
622daaff0a8975 Ryusuke Konishi 2010-12-26 535
ce1966344933bb Vishal Moola (Oracle 2022-08-15 536) folio_batch_release(&fbatch);
622daaff0a8975 Ryusuke Konishi 2010-12-26 537 cond_resched();
622daaff0a8975 Ryusuke Konishi 2010-12-26 538 goto repeat;
622daaff0a8975 Ryusuke Konishi 2010-12-26 539
622daaff0a8975 Ryusuke Konishi 2010-12-26 540 out_locked:
ce1966344933bb Vishal Moola (Oracle 2022-08-15 541) folio_unlock(folio);
622daaff0a8975 Ryusuke Konishi 2010-12-26 @542 out:
diff --git a/fs/nilfs2/page.c b/fs/nilfs2/page.c index 3267e96c256c..40cc8eb0bc8e 100644 --- a/fs/nilfs2/page.c +++ b/fs/nilfs2/page.c @@ -480,13 +480,13 @@ unsigned long nilfs_find_uncommitted_extent(struct inode *inode, sector_t start_blk, sector_t *blkoff) { - unsigned int i; + unsigned int i, nr; pgoff_t index; unsigned int nblocks_in_page; unsigned long length = 0; sector_t b; - struct pagevec pvec; - struct page *page; + struct folio_batch fbatch; + struct folio *folio; if (inode->i_mapping->nrpages == 0) return 0; @@ -494,27 +494,24 @@ unsigned long nilfs_find_uncommitted_extent(struct inode *inode, index = start_blk >> (PAGE_SHIFT - inode->i_blkbits); nblocks_in_page = 1U << (PAGE_SHIFT - inode->i_blkbits); - pagevec_init(&pvec); + folio_batch_init(&fbatch); repeat: - pvec.nr = find_get_pages_contig(inode->i_mapping, index, PAGEVEC_SIZE, - pvec.pages); - if (pvec.nr == 0) + nr = filemap_get_folios_contig(inode->i_mapping, &index, ULONG_MAX, + &fbatch); + if (nr == 0) return length; - if (length > 0 && pvec.pages[0]->index > index) - goto out; - - b = pvec.pages[0]->index << (PAGE_SHIFT - inode->i_blkbits); + b = fbatch.folios[0]->index << (PAGE_SHIFT - inode->i_blkbits); i = 0; do { - page = pvec.pages[i]; + folio = fbatch.folios[i]; - lock_page(page); - if (page_has_buffers(page)) { + folio_lock(folio); + if (folio_buffers(folio)) { struct buffer_head *bh, *head; - bh = head = page_buffers(page); + bh = head = folio_buffers(folio); do { if (b < start_blk) continue; @@ -532,18 +529,17 @@ unsigned long nilfs_find_uncommitted_extent(struct inode *inode, b += nblocks_in_page; } - unlock_page(page); + folio_unlock(folio); - } while (++i < pagevec_count(&pvec)); + } while (++i < nr); - index = page->index + 1; - pagevec_release(&pvec); + folio_batch_release(&fbatch); cond_resched(); goto repeat; out_locked: - unlock_page(page); + folio_unlock(folio); out: - pagevec_release(&pvec); + folio_batch_release(&fbatch); return length; }
Converted function to use folios throughout. This is in preparation for the removal of find_get_pages_contig(). Now also supports large folios. Also cleaned up an unnecessary if statement - pvec.pages[0]->index > index will always evaluate to false, and filemap_get_folios_contig() returns 0 if there is no folio found at index. Signed-off-by: Vishal Moola (Oracle) <vishal.moola@gmail.com> --- fs/nilfs2/page.c | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-)