Re: [PATCH 05/50] xfs: pass perag to xfs_alloc_read_agf()

kernel test robot
2022-06-11T13:47:27Z

Hi Dave,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.19-rc1]
[also build test WARNING on next-20220610]
[cannot apply to xfs-linux/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]

url: https://github.com/intel-lab-lkp/linux/commits/Dave-Chinner/xfs-per-ag-centric-allocation-alogrithms/20220611-093037
base: f2906aa863381afb0015a9eb7fefad885d4e5a56
config: sparc64-randconfig-r034-20220611 (https://download.01.org/0day-ci/archive/20220611/202206112144.aFBVTYv8-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 11.3.0
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
# https://github.com/intel-lab-lkp/linux/commit/87045504fb13d6263ddf1d7780eef5eda1cee6ad
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Dave-Chinner/xfs-per-ag-centric-allocation-alogrithms/20220611-093037
git checkout 87045504fb13d6263ddf1d7780eef5eda1cee6ad
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=sparc64 SHELL=/bin/bash fs/xfs/

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/xfs/scrub/repair.c: In function 'xrep_reap_block':
>> fs/xfs/scrub/repair.c:539:41: warning: variable 'agno' set but not used [-Wunused-but-set-variable]
539 | xfs_agnumber_t agno;
| ^~~~

vim +/agno +539 fs/xfs/scrub/repair.c

12c6510e2ff17cf Darrick J. Wong 2018-05-29 528
86d969b425d7ecf Darrick J. Wong 2018-07-30 529 /* Dispose of a single block. */
12c6510e2ff17cf Darrick J. Wong 2018-05-29 530 STATIC int
86d969b425d7ecf Darrick J. Wong 2018-07-30 531 xrep_reap_block(
1d8a748a8aa94a7 Darrick J. Wong 2018-07-19 532 struct xfs_scrub *sc,
12c6510e2ff17cf Darrick J. Wong 2018-05-29 533 xfs_fsblock_t fsbno,
66e3237e724c665 Darrick J. Wong 2018-12-12 534 const struct xfs_owner_info *oinfo,
12c6510e2ff17cf Darrick J. Wong 2018-05-29 535 enum xfs_ag_resv_type resv)
12c6510e2ff17cf Darrick J. Wong 2018-05-29 536 {
12c6510e2ff17cf Darrick J. Wong 2018-05-29 537 struct xfs_btree_cur *cur;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 538 struct xfs_buf *agf_bp = NULL;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 @539 xfs_agnumber_t agno;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 540 xfs_agblock_t agbno;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 541 bool has_other_rmap;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 542 int error;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 543
12c6510e2ff17cf Darrick J. Wong 2018-05-29 544 agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 545 agbno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
87045504fb13d62 Dave Chinner 2022-06-11 546 ASSERT(agno == sc->sa.pag->pag_agno);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 547
12c6510e2ff17cf Darrick J. Wong 2018-05-29 548 /*
12c6510e2ff17cf Darrick J. Wong 2018-05-29 549 * If we are repairing per-inode metadata, we need to read in the AGF
12c6510e2ff17cf Darrick J. Wong 2018-05-29 550 * buffer. Otherwise, we're repairing a per-AG structure, so reuse
12c6510e2ff17cf Darrick J. Wong 2018-05-29 551 * the AGF buffer that the setup functions already grabbed.
12c6510e2ff17cf Darrick J. Wong 2018-05-29 552 */
12c6510e2ff17cf Darrick J. Wong 2018-05-29 553 if (sc->ip) {
87045504fb13d62 Dave Chinner 2022-06-11 554 error = xfs_alloc_read_agf(sc->sa.pag, sc->tp, 0, &agf_bp);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 555 if (error)
12c6510e2ff17cf Darrick J. Wong 2018-05-29 556 return error;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 557 } else {
12c6510e2ff17cf Darrick J. Wong 2018-05-29 558 agf_bp = sc->sa.agf_bp;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 559 }
fa9c3c197329fda Dave Chinner 2021-06-02 560 cur = xfs_rmapbt_init_cursor(sc->mp, sc->tp, agf_bp, sc->sa.pag);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 561
12c6510e2ff17cf Darrick J. Wong 2018-05-29 562 /* Can we find any other rmappings? */
12c6510e2ff17cf Darrick J. Wong 2018-05-29 563 error = xfs_rmap_has_other_keys(cur, agbno, 1, oinfo, &has_other_rmap);
ef97ef26d263fb6 Darrick J. Wong 2018-07-19 564 xfs_btree_del_cursor(cur, error);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 565 if (error)
ef97ef26d263fb6 Darrick J. Wong 2018-07-19 566 goto out_free;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 567
12c6510e2ff17cf Darrick J. Wong 2018-05-29 568 /*
12c6510e2ff17cf Darrick J. Wong 2018-05-29 569 * If there are other rmappings, this block is cross linked and must
12c6510e2ff17cf Darrick J. Wong 2018-05-29 570 * not be freed. Remove the reverse mapping and move on. Otherwise,
12c6510e2ff17cf Darrick J. Wong 2018-05-29 571 * we were the only owner of the block, so free the extent, which will
12c6510e2ff17cf Darrick J. Wong 2018-05-29 572 * also remove the rmap.
12c6510e2ff17cf Darrick J. Wong 2018-05-29 573 *
12c6510e2ff17cf Darrick J. Wong 2018-05-29 574 * XXX: XFS doesn't support detecting the case where a single block
12c6510e2ff17cf Darrick J. Wong 2018-05-29 575 * metadata structure is crosslinked with a multi-block structure
12c6510e2ff17cf Darrick J. Wong 2018-05-29 576 * because the buffer cache doesn't detect aliasing problems, so we
12c6510e2ff17cf Darrick J. Wong 2018-05-29 577 * can't fix 100% of crosslinking problems (yet). The verifiers will
12c6510e2ff17cf Darrick J. Wong 2018-05-29 578 * blow on writeout, the filesystem will shut down, and the admin gets
12c6510e2ff17cf Darrick J. Wong 2018-05-29 579 * to run xfs_repair.
12c6510e2ff17cf Darrick J. Wong 2018-05-29 580 */
12c6510e2ff17cf Darrick J. Wong 2018-05-29 581 if (has_other_rmap)
fa9c3c197329fda Dave Chinner 2021-06-02 582 error = xfs_rmap_free(sc->tp, agf_bp, sc->sa.pag, agbno,
fa9c3c197329fda Dave Chinner 2021-06-02 583 1, oinfo);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 584 else if (resv == XFS_AG_RESV_AGFL)
b5e2196e9c72173 Darrick J. Wong 2018-07-19 585 error = xrep_put_freelist(sc, agbno);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 586 else
12c6510e2ff17cf Darrick J. Wong 2018-05-29 587 error = xfs_free_extent(sc->tp, fsbno, 1, oinfo, resv);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 588 if (agf_bp != sc->sa.agf_bp)
12c6510e2ff17cf Darrick J. Wong 2018-05-29 589 xfs_trans_brelse(sc->tp, agf_bp);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 590 if (error)
12c6510e2ff17cf Darrick J. Wong 2018-05-29 591 return error;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 592
12c6510e2ff17cf Darrick J. Wong 2018-05-29 593 if (sc->ip)
12c6510e2ff17cf Darrick J. Wong 2018-05-29 594 return xfs_trans_roll_inode(&sc->tp, sc->ip);
b5e2196e9c72173 Darrick J. Wong 2018-07-19 595 return xrep_roll_ag_trans(sc);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 596
ef97ef26d263fb6 Darrick J. Wong 2018-07-19 597 out_free:
12c6510e2ff17cf Darrick J. Wong 2018-05-29 598 if (agf_bp != sc->sa.agf_bp)
12c6510e2ff17cf Darrick J. Wong 2018-05-29 599 xfs_trans_brelse(sc->tp, agf_bp);
12c6510e2ff17cf Darrick J. Wong 2018-05-29 600 return error;
12c6510e2ff17cf Darrick J. Wong 2018-05-29 601 }
12c6510e2ff17cf Darrick J. Wong 2018-05-29 602

--
0-DAY CI Kernel Test Service