tree:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
realtime-reflink-extsize
head: 6337b08dd02c0227dc3781b82b1a8cf6cf9b4fe9
commit: cc7af6fdf9d2c4cf0ab7fd1cdd2332d90f610acf [275/296] xfs: enable CoW for realtime
data
config: parisc-randconfig-r023-20210209 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.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://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git/comm...
git remote add djwong-xfs
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git
git fetch --no-tags djwong-xfs realtime-reflink-extsize
git checkout cc7af6fdf9d2c4cf0ab7fd1cdd2332d90f610acf
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>):
fs/xfs/xfs_reflink.c: In function 'xfs_reflink_end_cow_extent':
> fs/xfs/xfs_reflink.c:622:16: warning: variable 'qflag'
set but not used [-Wunused-but-set-variable]
622 | unsigned int qflag;
| ^~~~~
vim +/qflag +622 fs/xfs/xfs_reflink.c
598
599 /*
600 * Remap part of the CoW fork into the data fork.
601 *
602 * We aim to remap the range starting at @offset_fsb and ending at @end_fsb
603 * into the data fork; this function will remap what it can (at the end of the
604 * range) and update @end_fsb appropriately. Each remap gets its own
605 * transaction because we can end up merging and splitting bmbt blocks for
606 * every remap operation and we'd like to keep the block reservation
607 * requirements as low as possible.
608 */
609 STATIC int
610 xfs_reflink_end_cow_extent(
611 struct xfs_inode *ip,
612 xfs_fileoff_t offset_fsb,
613 xfs_fileoff_t *end_fsb)
614 {
615 struct xfs_bmbt_irec got, del;
616 struct xfs_iext_cursor icur;
617 struct xfs_mount *mp = ip->i_mount;
618 struct xfs_trans *tp;
619 struct xfs_ifork *ifp = XFS_IFORK_PTR(ip, XFS_COW_FORK);
620 xfs_filblks_t rlen;
621 unsigned int resblks;
622 unsigned int qflag;
623 int error;
624
625 /* No COW extents? That's easy! */
626 if (ifp->if_bytes == 0) {
627 *end_fsb = offset_fsb;
628 return 0;
629 }
630
631 resblks = XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK);
632 error = xfs_trans_alloc(mp, &M_RES(mp)->tr_write, resblks, 0,
633 XFS_TRANS_RESERVE, &tp);
634 if (error)
635 return error;
636
637 /*
638 * Lock the inode. We have to ijoin without automatic unlock because
639 * the lead transaction is the refcountbt record deletion; the data
640 * fork update follows as a deferred log item.
641 */
642 xfs_ilock(ip, XFS_ILOCK_EXCL);
643 xfs_trans_ijoin(tp, ip, 0);
644
645 /*
646 * In case of racing, overlapping AIO writes no COW extents might be
647 * left by the time I/O completes for the loser of the race. In that
648 * case we are done.
649 */
650 if (!xfs_iext_lookup_extent_before(ip, ifp, end_fsb, &icur, &got) ||
651 got.br_startoff + got.br_blockcount <= offset_fsb) {
652 *end_fsb = offset_fsb;
653 goto out_cancel;
654 }
655
656 /*
657 * Structure copy @got into @del, then trim @del to the range that we
658 * were asked to remap. We preserve @got for the eventual CoW fork
659 * deletion; from now on @del represents the mapping that we're
660 * actually remapping.
661 */
662 del = got;
663 xfs_trim_extent(&del, offset_fsb, *end_fsb - offset_fsb);
664
665 ASSERT(del.br_blockcount > 0);
666
667 /*
668 * Only remap real extents that contain data. With AIO, speculative
669 * preallocations can leak into the range we are called upon, and we
670 * need to skip them.
671 */
672 if (!xfs_bmap_is_written_extent(&got)) {
673 *end_fsb = del.br_startoff;
674 goto out_cancel;
675 }
676
677 /* Unmap the old blocks in the data fork. */
678 rlen = del.br_blockcount;
679 error = __xfs_bunmapi(tp, ip, del.br_startoff, &rlen, 0, 1);
680 if (error)
681 goto out_cancel;
682
683 /* Trim the extent to whatever got unmapped. */
684 xfs_trim_extent(&del, del.br_startoff + rlen, del.br_blockcount - rlen);
685 trace_xfs_reflink_cow_remap(ip, &del);
686
687 /* Free the CoW orphan record. */
688 xfs_refcount_free_cow_extent(tp, del.br_startblock, del.br_blockcount,
689 XFS_IS_REALTIME_INODE(ip));
690
691 /* Map the new blocks into the data fork. */
692 xfs_bmap_map_extent(tp, ip, XFS_DATA_FORK, &del);
693
694 /* Charge this new data fork mapping to the on-disk quota. */
695 qflag = XFS_IS_REALTIME_INODE(ip) ? XFS_TRANS_DQ_DELRTBCOUNT :
696 XFS_TRANS_DQ_DELBCOUNT;
697 xfs_trans_mod_dquot_byino(tp, ip, qflag, (long)del.br_blockcount);
698
699 /* Remove the mapping from the CoW fork. */
700 xfs_bmap_del_extent_cow(ip, &icur, &got, &del);
701
702 error = xfs_trans_commit(tp);
703 xfs_iunlock(ip, XFS_ILOCK_EXCL);
704 if (error)
705 return error;
706
707 /* Update the caller about how much progress we made. */
708 *end_fsb = del.br_startoff;
709 return 0;
710
711 out_cancel:
712 xfs_trans_cancel(tp);
713 xfs_iunlock(ip, XFS_ILOCK_EXCL);
714 return error;
715 }
716
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org