tree:
https://git.kernel.org/pub/scm/linux/kernel/git/djwong/xfs-linux.git djwong-wtf
head: fb59bf80e08d73ce5299c6e245f1c9929da7624e
commit: 9adb4713c8658cfafb4ea9812cd14a8864dc7387 [177/190] xfs: remove old swap extents
implementation
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 11.0.0 (
https://github.com/llvm/llvm-project
1d4c87335d5236ea1f35937e1014980ba961ae34)
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 x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
git checkout 9adb4713c8658cfafb4ea9812cd14a8864dc7387
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
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 >>, old ones prefixed by <<):
> fs/xfs/xfs_swaprange.c:224:1: warning: no previous prototype for
function 'xfs_swap_extent_forks' [-Wmissing-prototypes]
xfs_swap_extent_forks(
^
fs/xfs/xfs_swaprange.c:223:1: note: declare 'static' if the function is not
intended to be used outside of this translation unit
int
^
static
1 warning generated.
vim +/xfs_swap_extent_forks +224 fs/xfs/xfs_swaprange.c
221
222 /* Swap the extents of two files by swapping data forks. */
223 int
224 xfs_swap_extent_forks(
225 struct xfs_trans **tpp,
226 struct xfs_swapext_req *req)
227 {
228 struct xfs_inode *ip = req->ip1;
229 struct xfs_inode *tip = req->ip2;
230 xfs_filblks_t aforkblks = 0;
231 xfs_filblks_t taforkblks = 0;
232 xfs_extnum_t junk;
233 uint64_t tmp;
234 unsigned int reflink_state;
235 int src_log_flags = XFS_ILOG_CORE;
236 int target_log_flags = XFS_ILOG_CORE;
237 int error;
238
239 reflink_state = xfs_swapext_reflink_prep(req);
240
241 /*
242 * Count the number of extended attribute blocks
243 */
244 if (XFS_IFORK_Q(ip) && ip->i_afp->if_nextents > 0 &&
245 ip->i_afp->if_format != XFS_DINODE_FMT_LOCAL) {
246 error = xfs_bmap_count_blocks(*tpp, ip, XFS_ATTR_FORK, &junk,
247 &aforkblks);
248 if (error)
249 return error;
250 }
251 if (XFS_IFORK_Q(tip) && tip->i_afp->if_nextents > 0 &&
252 tip->i_afp->if_format != XFS_DINODE_FMT_LOCAL) {
253 error = xfs_bmap_count_blocks(*tpp, tip, XFS_ATTR_FORK, &junk,
254 &taforkblks);
255 if (error)
256 return error;
257 }
258
259 /*
260 * Btree format (v3) inodes have the inode number stamped in the bmbt
261 * block headers. We can't start changing the bmbt blocks until the
262 * inode owner change is logged so recovery does the right thing in the
263 * event of a crash. Set the owner change log flags now and leave the
264 * bmbt scan as the last step.
265 */
266 if (xfs_sb_version_has_v3inode(&ip->i_mount->m_sb)) {
267 if (ip->i_df.if_format == XFS_DINODE_FMT_BTREE)
268 target_log_flags |= XFS_ILOG_DOWNER;
269 if (tip->i_df.if_format == XFS_DINODE_FMT_BTREE)
270 src_log_flags |= XFS_ILOG_DOWNER;
271 }
272
273 /*
274 * Swap the data forks of the inodes
275 */
276 swap(ip->i_df, tip->i_df);
277
278 /*
279 * Fix the on-disk inode values
280 */
281 tmp = (uint64_t)ip->i_d.di_nblocks;
282 ip->i_d.di_nblocks = tip->i_d.di_nblocks - taforkblks + aforkblks;
283 tip->i_d.di_nblocks = tmp + taforkblks - aforkblks;
284
285 /*
286 * The extents in the source inode could still contain speculative
287 * preallocation beyond EOF (e.g. the file is open but not modified
288 * while defrag is in progress). In that case, we need to copy over the
289 * number of delalloc blocks the data fork in the source inode is
290 * tracking beyond EOF so that when the fork is truncated away when the
291 * temporary inode is unlinked we don't underrun the i_delayed_blks
292 * counter on that inode.
293 */
294 ASSERT(tip->i_delayed_blks == 0);
295 tip->i_delayed_blks = ip->i_delayed_blks;
296 ip->i_delayed_blks = 0;
297
298 switch (ip->i_df.if_format) {
299 case XFS_DINODE_FMT_EXTENTS:
300 src_log_flags |= XFS_ILOG_DEXT;
301 break;
302 case XFS_DINODE_FMT_BTREE:
303 ASSERT(!xfs_sb_version_has_v3inode(&ip->i_mount->m_sb) ||
304 (src_log_flags & XFS_ILOG_DOWNER));
305 src_log_flags |= XFS_ILOG_DBROOT;
306 break;
307 }
308
309 switch (tip->i_df.if_format) {
310 case XFS_DINODE_FMT_EXTENTS:
311 target_log_flags |= XFS_ILOG_DEXT;
312 break;
313 case XFS_DINODE_FMT_BTREE:
314 target_log_flags |= XFS_ILOG_DBROOT;
315 ASSERT(!xfs_sb_version_has_v3inode(&ip->i_mount->m_sb) ||
316 (target_log_flags & XFS_ILOG_DOWNER));
317 break;
318 }
319
320 xfs_swapext_reflink_finish(*tpp, req, reflink_state);
321
322 xfs_trans_log_inode(*tpp, ip, src_log_flags);
323 xfs_trans_log_inode(*tpp, tip, target_log_flags);
324
325 /*
326 * The extent forks have been swapped, but crc=1,rmapbt=0 filesystems
327 * have inode number owner values in the bmbt blocks that still refer to
328 * the old inode. Scan each bmbt to fix up the owner values with the
329 * inode number of the current inode.
330 */
331 if (src_log_flags & XFS_ILOG_DOWNER) {
332 error = xfs_swap_change_owner(tpp, ip, tip);
333 if (error)
334 return error;
335 }
336 if (target_log_flags & XFS_ILOG_DOWNER) {
337 error = xfs_swap_change_owner(tpp, tip, ip);
338 if (error)
339 return error;
340 }
341
342 return 0;
343 }
344
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org