diff mbox series

[2/2] xfs: Fix xfs_prepare_shift() range for RT

Message ID 20240509104057.1197846-3-john.g.garry@oracle.com (mailing list archive)
State Superseded
Headers show
Series xfs: fallocate RT flush unmap range fixes | expand

Commit Message

John Garry May 9, 2024, 10:40 a.m. UTC
The RT extent range must be considered in the xfs_flush_unmap_range() call
to stabilize the boundary.

This code change is originally from Dave Chinner.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: John Garry <john.g.garry@oracle.com>
---
 fs/xfs/xfs_bmap_util.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

kernel test robot May 10, 2024, 5:35 a.m. UTC | #1
Hi John,

kernel test robot noticed the following build errors:

[auto build test ERROR on xfs-linux/for-next]
[also build test ERROR on next-20240509]
[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/John-Garry/xfs-Fix-xfs_flush_unmap_range-range-for-RT/20240509-184217
base:   https://git.kernel.org/pub/scm/fs/xfs/xfs-linux.git for-next
patch link:    https://lore.kernel.org/r/20240509104057.1197846-3-john.g.garry%40oracle.com
patch subject: [PATCH 2/2] xfs: Fix xfs_prepare_shift() range for RT
config: xtensa-randconfig-001-20240510 (https://download.01.org/0day-ci/archive/20240510/202405101325.ODONtoFD-lkp@intel.com/config)
compiler: xtensa-linux-gcc (GCC) 13.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240510/202405101325.ODONtoFD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405101325.ODONtoFD-lkp@intel.com/

All errors (new ones prefixed by >>):

   `.exit.text' referenced in section `__jump_table' of fs/fuse/inode.o: defined in discarded section `.exit.text' of fs/fuse/inode.o
   `.exit.text' referenced in section `__jump_table' of fs/fuse/inode.o: defined in discarded section `.exit.text' of fs/fuse/inode.o
   xtensa-linux-ld: fs/xfs/xfs_bmap_util.o: in function `xfs_alloc_file_space':
   xfs_bmap_util.c:(.text+0x1dbc): undefined reference to `__moddi3'
   xtensa-linux-ld: fs/xfs/xfs_bmap_util.o: in function `xfs_flush_unmap_range':
   xfs_bmap_util.c:(.text+0x1deb): undefined reference to `__moddi3'
   xtensa-linux-ld: fs/xfs/xfs_bmap_util.o: in function `xfs_alloc_file_space':
   xfs_bmap_util.c:(.text+0x1dc0): undefined reference to `__moddi3'
   xtensa-linux-ld: fs/xfs/xfs_bmap_util.o: in function `xfs_flush_unmap_range':
   xfs_bmap_util.c:(.text+0x1e36): undefined reference to `__moddi3'
>> xtensa-linux-ld: xfs_bmap_util.c:(.text+0x1ea4): undefined reference to `__moddi3'
   xtensa-linux-ld: fs/xfs/xfs_bmap_util.o:xfs_bmap_util.c:(.text+0x1efa): more undefined references to `__moddi3' follow
   `.exit.text' referenced in section `__jump_table' of drivers/misc/phantom.o: defined in discarded section `.exit.text' of drivers/misc/phantom.o
   `.exit.text' referenced in section `__jump_table' of drivers/misc/phantom.o: defined in discarded section `.exit.text' of drivers/misc/phantom.o
   `.exit.text' referenced in section `__jump_table' of drivers/mtd/maps/pcmciamtd.o: defined in discarded section `.exit.text' of drivers/mtd/maps/pcmciamtd.o
   `.exit.text' referenced in section `__jump_table' of drivers/mtd/maps/pcmciamtd.o: defined in discarded section `.exit.text' of drivers/mtd/maps/pcmciamtd.o
diff mbox series

Patch

diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index 5d4aac50cbf5..52d7ee5bbb72 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -888,7 +888,7 @@  xfs_prepare_shift(
 	struct xfs_inode	*ip,
 	loff_t			offset)
 {
-	struct xfs_mount	*mp = ip->i_mount;
+	unsigned int		rounding;
 	int			error;
 
 	/*
@@ -906,11 +906,13 @@  xfs_prepare_shift(
 	 * with the full range of the operation. If we don't, a COW writeback
 	 * completion could race with an insert, front merge with the start
 	 * extent (after split) during the shift and corrupt the file. Start
-	 * with the block just prior to the start to stabilize the boundary.
+	 * with the allocation unit just prior to the start to stabilize the
+	 * boundary.
 	 */
-	offset = round_down(offset, mp->m_sb.sb_blocksize);
+	rounding = xfs_inode_alloc_unitsize(ip);
+	offset = rounddown(offset, rounding);
 	if (offset)
-		offset -= mp->m_sb.sb_blocksize;
+		offset -= rounding;
 
 	/*
 	 * Writeback and invalidate cache for the remainder of the file as we're