Re: [PATCH 5/7] nilfs2: Convert nilfs_find_uncommited_extent() to use filemap_get_folios_contig()
From: kernel test robot
Date: Mon Aug 15 2022 - 23:02:15 EST
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@xxxxxxxxx/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@xxxxxxxxx>
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:
--
0-DAY CI Kernel Test Service
https://01.org/lkp