aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2018-03-23 13:06:54 -0400
committerDarrick J. Wong <darrick.wong@oracle.com>2018-03-23 21:05:08 -0400
commit7e56d9eaea1397efbac7e6813cbb74066586fdd4 (patch)
tree02eb87049f6c14adce4117fa2910e4cf9b2a65e9
parentd0018ad88909a959e17132d694a7ad917a14883f (diff)
xfs: remove xfs_buf parameter from inode scrub methods
Now that we no longer do raw inode buffer scrubbing, the bp parameter is no longer used anywhere we're dealing with an inode, so remove it and all the useless NULL parameters that go with it. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
-rw-r--r--fs/xfs/scrub/attr.c2
-rw-r--r--fs/xfs/scrub/bmap.c4
-rw-r--r--fs/xfs/scrub/common.c22
-rw-r--r--fs/xfs/scrub/common.h13
-rw-r--r--fs/xfs/scrub/dir.c2
-rw-r--r--fs/xfs/scrub/inode.c106
-rw-r--r--fs/xfs/scrub/quota.c2
-rw-r--r--fs/xfs/scrub/rtbitmap.c3
-rw-r--r--fs/xfs/scrub/trace.h31
9 files changed, 74 insertions, 111 deletions
diff --git a/fs/xfs/scrub/attr.c b/fs/xfs/scrub/attr.c
index 4ed80474f545..127575f0abfb 100644
--- a/fs/xfs/scrub/attr.c
+++ b/fs/xfs/scrub/attr.c
@@ -98,7 +98,7 @@ xfs_scrub_xattr_listent(
98 98
99 if (flags & XFS_ATTR_INCOMPLETE) { 99 if (flags & XFS_ATTR_INCOMPLETE) {
100 /* Incomplete attr key, just mark the inode for preening. */ 100 /* Incomplete attr key, just mark the inode for preening. */
101 xfs_scrub_ino_set_preen(sx->sc, context->dp->i_ino, NULL); 101 xfs_scrub_ino_set_preen(sx->sc, context->dp->i_ino);
102 return; 102 return;
103 } 103 }
104 104
diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c
index 75ea2d63429c..639d14b51e90 100644
--- a/fs/xfs/scrub/bmap.c
+++ b/fs/xfs/scrub/bmap.c
@@ -621,7 +621,7 @@ xfs_scrub_bmap(
621 goto out; 621 goto out;
622 /* No CoW forks on non-reflink inodes/filesystems. */ 622 /* No CoW forks on non-reflink inodes/filesystems. */
623 if (!xfs_is_reflink_inode(ip)) { 623 if (!xfs_is_reflink_inode(ip)) {
624 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino, NULL); 624 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino);
625 goto out; 625 goto out;
626 } 626 }
627 break; 627 break;
@@ -630,7 +630,7 @@ xfs_scrub_bmap(
630 goto out_check_rmap; 630 goto out_check_rmap;
631 if (!xfs_sb_version_hasattr(&mp->m_sb) && 631 if (!xfs_sb_version_hasattr(&mp->m_sb) &&
632 !xfs_sb_version_hasattr2(&mp->m_sb)) 632 !xfs_sb_version_hasattr2(&mp->m_sb))
633 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino, NULL); 633 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino);
634 break; 634 break;
635 default: 635 default:
636 ASSERT(whichfork == XFS_DATA_FORK); 636 ASSERT(whichfork == XFS_DATA_FORK);
diff --git a/fs/xfs/scrub/common.c b/fs/xfs/scrub/common.c
index ddcdda336402..8ed91d5c868d 100644
--- a/fs/xfs/scrub/common.c
+++ b/fs/xfs/scrub/common.c
@@ -213,12 +213,10 @@ xfs_scrub_block_set_preen(
213void 213void
214xfs_scrub_ino_set_preen( 214xfs_scrub_ino_set_preen(
215 struct xfs_scrub_context *sc, 215 struct xfs_scrub_context *sc,
216 xfs_ino_t ino, 216 xfs_ino_t ino)
217 struct xfs_buf *bp)
218{ 217{
219 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN; 218 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
220 trace_xfs_scrub_ino_preen(sc, ino, bp ? bp->b_bn : 0, 219 trace_xfs_scrub_ino_preen(sc, ino, __return_address);
221 __return_address);
222} 220}
223 221
224/* Record a corrupt block. */ 222/* Record a corrupt block. */
@@ -249,22 +247,20 @@ xfs_scrub_block_xref_set_corrupt(
249void 247void
250xfs_scrub_ino_set_corrupt( 248xfs_scrub_ino_set_corrupt(
251 struct xfs_scrub_context *sc, 249 struct xfs_scrub_context *sc,
252 xfs_ino_t ino, 250 xfs_ino_t ino)
253 struct xfs_buf *bp)
254{ 251{
255 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT; 252 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_CORRUPT;
256 trace_xfs_scrub_ino_error(sc, ino, bp ? bp->b_bn : 0, __return_address); 253 trace_xfs_scrub_ino_error(sc, ino, __return_address);
257} 254}
258 255
259/* Record a corruption while cross-referencing with an inode. */ 256/* Record a corruption while cross-referencing with an inode. */
260void 257void
261xfs_scrub_ino_xref_set_corrupt( 258xfs_scrub_ino_xref_set_corrupt(
262 struct xfs_scrub_context *sc, 259 struct xfs_scrub_context *sc,
263 xfs_ino_t ino, 260 xfs_ino_t ino)
264 struct xfs_buf *bp)
265{ 261{
266 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT; 262 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_XCORRUPT;
267 trace_xfs_scrub_ino_error(sc, ino, bp ? bp->b_bn : 0, __return_address); 263 trace_xfs_scrub_ino_error(sc, ino, __return_address);
268} 264}
269 265
270/* Record corruption in a block indexed by a file fork. */ 266/* Record corruption in a block indexed by a file fork. */
@@ -296,12 +292,10 @@ xfs_scrub_fblock_xref_set_corrupt(
296void 292void
297xfs_scrub_ino_set_warning( 293xfs_scrub_ino_set_warning(
298 struct xfs_scrub_context *sc, 294 struct xfs_scrub_context *sc,
299 xfs_ino_t ino, 295 xfs_ino_t ino)
300 struct xfs_buf *bp)
301{ 296{
302 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING; 297 sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
303 trace_xfs_scrub_ino_warning(sc, ino, bp ? bp->b_bn : 0, 298 trace_xfs_scrub_ino_warning(sc, ino, __return_address);
304 __return_address);
305} 299}
306 300
307/* Warn about a block indexed by a file fork that needs review. */ 301/* Warn about a block indexed by a file fork that needs review. */
diff --git a/fs/xfs/scrub/common.h b/fs/xfs/scrub/common.h
index ddb65d22c76a..deaf60400981 100644
--- a/fs/xfs/scrub/common.h
+++ b/fs/xfs/scrub/common.h
@@ -63,25 +63,22 @@ bool xfs_scrub_fblock_xref_process_error(struct xfs_scrub_context *sc,
63 63
64void xfs_scrub_block_set_preen(struct xfs_scrub_context *sc, 64void xfs_scrub_block_set_preen(struct xfs_scrub_context *sc,
65 struct xfs_buf *bp); 65 struct xfs_buf *bp);
66void xfs_scrub_ino_set_preen(struct xfs_scrub_context *sc, xfs_ino_t ino, 66void xfs_scrub_ino_set_preen(struct xfs_scrub_context *sc, xfs_ino_t ino);
67 struct xfs_buf *bp);
68 67
69void xfs_scrub_block_set_corrupt(struct xfs_scrub_context *sc, 68void xfs_scrub_block_set_corrupt(struct xfs_scrub_context *sc,
70 struct xfs_buf *bp); 69 struct xfs_buf *bp);
71void xfs_scrub_ino_set_corrupt(struct xfs_scrub_context *sc, xfs_ino_t ino, 70void xfs_scrub_ino_set_corrupt(struct xfs_scrub_context *sc, xfs_ino_t ino);
72 struct xfs_buf *bp);
73void xfs_scrub_fblock_set_corrupt(struct xfs_scrub_context *sc, int whichfork, 71void xfs_scrub_fblock_set_corrupt(struct xfs_scrub_context *sc, int whichfork,
74 xfs_fileoff_t offset); 72 xfs_fileoff_t offset);
75 73
76void xfs_scrub_block_xref_set_corrupt(struct xfs_scrub_context *sc, 74void xfs_scrub_block_xref_set_corrupt(struct xfs_scrub_context *sc,
77 struct xfs_buf *bp); 75 struct xfs_buf *bp);
78void xfs_scrub_ino_xref_set_corrupt(struct xfs_scrub_context *sc, xfs_ino_t ino, 76void xfs_scrub_ino_xref_set_corrupt(struct xfs_scrub_context *sc,
79 struct xfs_buf *bp); 77 xfs_ino_t ino);
80void xfs_scrub_fblock_xref_set_corrupt(struct xfs_scrub_context *sc, 78void xfs_scrub_fblock_xref_set_corrupt(struct xfs_scrub_context *sc,
81 int whichfork, xfs_fileoff_t offset); 79 int whichfork, xfs_fileoff_t offset);
82 80
83void xfs_scrub_ino_set_warning(struct xfs_scrub_context *sc, xfs_ino_t ino, 81void xfs_scrub_ino_set_warning(struct xfs_scrub_context *sc, xfs_ino_t ino);
84 struct xfs_buf *bp);
85void xfs_scrub_fblock_set_warning(struct xfs_scrub_context *sc, int whichfork, 82void xfs_scrub_fblock_set_warning(struct xfs_scrub_context *sc, int whichfork,
86 xfs_fileoff_t offset); 83 xfs_fileoff_t offset);
87 84
diff --git a/fs/xfs/scrub/dir.c b/fs/xfs/scrub/dir.c
index 50b6a26b0299..38f29806eb54 100644
--- a/fs/xfs/scrub/dir.c
+++ b/fs/xfs/scrub/dir.c
@@ -781,7 +781,7 @@ xfs_scrub_directory(
781 781
782 /* Plausible size? */ 782 /* Plausible size? */
783 if (sc->ip->i_d.di_size < xfs_dir2_sf_hdr_size(0)) { 783 if (sc->ip->i_d.di_size < xfs_dir2_sf_hdr_size(0)) {
784 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino, NULL); 784 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino);
785 goto out; 785 goto out;
786 } 786 }
787 787
diff --git a/fs/xfs/scrub/inode.c b/fs/xfs/scrub/inode.c
index 177e9788030d..9be1655e7e9f 100644
--- a/fs/xfs/scrub/inode.c
+++ b/fs/xfs/scrub/inode.c
@@ -98,7 +98,6 @@ out:
98STATIC void 98STATIC void
99xfs_scrub_inode_extsize( 99xfs_scrub_inode_extsize(
100 struct xfs_scrub_context *sc, 100 struct xfs_scrub_context *sc,
101 struct xfs_buf *bp,
102 struct xfs_dinode *dip, 101 struct xfs_dinode *dip,
103 xfs_ino_t ino, 102 xfs_ino_t ino,
104 uint16_t mode, 103 uint16_t mode,
@@ -149,7 +148,7 @@ xfs_scrub_inode_extsize(
149 148
150 return; 149 return;
151bad: 150bad:
152 xfs_scrub_ino_set_corrupt(sc, ino, bp); 151 xfs_scrub_ino_set_corrupt(sc, ino);
153} 152}
154 153
155/* 154/*
@@ -161,7 +160,6 @@ bad:
161STATIC void 160STATIC void
162xfs_scrub_inode_cowextsize( 161xfs_scrub_inode_cowextsize(
163 struct xfs_scrub_context *sc, 162 struct xfs_scrub_context *sc,
164 struct xfs_buf *bp,
165 struct xfs_dinode *dip, 163 struct xfs_dinode *dip,
166 xfs_ino_t ino, 164 xfs_ino_t ino,
167 uint16_t mode, 165 uint16_t mode,
@@ -205,14 +203,13 @@ xfs_scrub_inode_cowextsize(
205 203
206 return; 204 return;
207bad: 205bad:
208 xfs_scrub_ino_set_corrupt(sc, ino, bp); 206 xfs_scrub_ino_set_corrupt(sc, ino);
209} 207}
210 208
211/* Make sure the di_flags make sense for the inode. */ 209/* Make sure the di_flags make sense for the inode. */
212STATIC void 210STATIC void
213xfs_scrub_inode_flags( 211xfs_scrub_inode_flags(
214 struct xfs_scrub_context *sc, 212 struct xfs_scrub_context *sc,
215 struct xfs_buf *bp,
216 struct xfs_dinode *dip, 213 struct xfs_dinode *dip,
217 xfs_ino_t ino, 214 xfs_ino_t ino,
218 uint16_t mode, 215 uint16_t mode,
@@ -251,14 +248,13 @@ xfs_scrub_inode_flags(
251 248
252 return; 249 return;
253bad: 250bad:
254 xfs_scrub_ino_set_corrupt(sc, ino, bp); 251 xfs_scrub_ino_set_corrupt(sc, ino);
255} 252}
256 253
257/* Make sure the di_flags2 make sense for the inode. */ 254/* Make sure the di_flags2 make sense for the inode. */
258STATIC void 255STATIC void
259xfs_scrub_inode_flags2( 256xfs_scrub_inode_flags2(
260 struct xfs_scrub_context *sc, 257 struct xfs_scrub_context *sc,
261 struct xfs_buf *bp,
262 struct xfs_dinode *dip, 258 struct xfs_dinode *dip,
263 xfs_ino_t ino, 259 xfs_ino_t ino,
264 uint16_t mode, 260 uint16_t mode,
@@ -295,14 +291,13 @@ xfs_scrub_inode_flags2(
295 291
296 return; 292 return;
297bad: 293bad:
298 xfs_scrub_ino_set_corrupt(sc, ino, bp); 294 xfs_scrub_ino_set_corrupt(sc, ino);
299} 295}
300 296
301/* Scrub all the ondisk inode fields. */ 297/* Scrub all the ondisk inode fields. */
302STATIC void 298STATIC void
303xfs_scrub_dinode( 299xfs_scrub_dinode(
304 struct xfs_scrub_context *sc, 300 struct xfs_scrub_context *sc,
305 struct xfs_buf *bp,
306 struct xfs_dinode *dip, 301 struct xfs_dinode *dip,
307 xfs_ino_t ino) 302 xfs_ino_t ino)
308{ 303{
@@ -333,7 +328,7 @@ xfs_scrub_dinode(
333 /* mode is recognized */ 328 /* mode is recognized */
334 break; 329 break;
335 default: 330 default:
336 xfs_scrub_ino_set_corrupt(sc, ino, bp); 331 xfs_scrub_ino_set_corrupt(sc, ino);
337 break; 332 break;
338 } 333 }
339 334
@@ -344,22 +339,22 @@ xfs_scrub_dinode(
344 * We autoconvert v1 inodes into v2 inodes on writeout, 339 * We autoconvert v1 inodes into v2 inodes on writeout,
345 * so just mark this inode for preening. 340 * so just mark this inode for preening.
346 */ 341 */
347 xfs_scrub_ino_set_preen(sc, ino, bp); 342 xfs_scrub_ino_set_preen(sc, ino);
348 break; 343 break;
349 case 2: 344 case 2:
350 case 3: 345 case 3:
351 if (dip->di_onlink != 0) 346 if (dip->di_onlink != 0)
352 xfs_scrub_ino_set_corrupt(sc, ino, bp); 347 xfs_scrub_ino_set_corrupt(sc, ino);
353 348
354 if (dip->di_mode == 0 && sc->ip) 349 if (dip->di_mode == 0 && sc->ip)
355 xfs_scrub_ino_set_corrupt(sc, ino, bp); 350 xfs_scrub_ino_set_corrupt(sc, ino);
356 351
357 if (dip->di_projid_hi != 0 && 352 if (dip->di_projid_hi != 0 &&
358 !xfs_sb_version_hasprojid32bit(&mp->m_sb)) 353 !xfs_sb_version_hasprojid32bit(&mp->m_sb))
359 xfs_scrub_ino_set_corrupt(sc, ino, bp); 354 xfs_scrub_ino_set_corrupt(sc, ino);
360 break; 355 break;
361 default: 356 default:
362 xfs_scrub_ino_set_corrupt(sc, ino, bp); 357 xfs_scrub_ino_set_corrupt(sc, ino);
363 return; 358 return;
364 } 359 }
365 360
@@ -369,40 +364,40 @@ xfs_scrub_dinode(
369 */ 364 */
370 if (dip->di_uid == cpu_to_be32(-1U) || 365 if (dip->di_uid == cpu_to_be32(-1U) ||
371 dip->di_gid == cpu_to_be32(-1U)) 366 dip->di_gid == cpu_to_be32(-1U))
372 xfs_scrub_ino_set_warning(sc, ino, bp); 367 xfs_scrub_ino_set_warning(sc, ino);
373 368
374 /* di_format */ 369 /* di_format */
375 switch (dip->di_format) { 370 switch (dip->di_format) {
376 case XFS_DINODE_FMT_DEV: 371 case XFS_DINODE_FMT_DEV:
377 if (!S_ISCHR(mode) && !S_ISBLK(mode) && 372 if (!S_ISCHR(mode) && !S_ISBLK(mode) &&
378 !S_ISFIFO(mode) && !S_ISSOCK(mode)) 373 !S_ISFIFO(mode) && !S_ISSOCK(mode))
379 xfs_scrub_ino_set_corrupt(sc, ino, bp); 374 xfs_scrub_ino_set_corrupt(sc, ino);
380 break; 375 break;
381 case XFS_DINODE_FMT_LOCAL: 376 case XFS_DINODE_FMT_LOCAL:
382 if (!S_ISDIR(mode) && !S_ISLNK(mode)) 377 if (!S_ISDIR(mode) && !S_ISLNK(mode))
383 xfs_scrub_ino_set_corrupt(sc, ino, bp); 378 xfs_scrub_ino_set_corrupt(sc, ino);
384 break; 379 break;
385 case XFS_DINODE_FMT_EXTENTS: 380 case XFS_DINODE_FMT_EXTENTS:
386 if (!S_ISREG(mode) && !S_ISDIR(mode) && !S_ISLNK(mode)) 381 if (!S_ISREG(mode) && !S_ISDIR(mode) && !S_ISLNK(mode))
387 xfs_scrub_ino_set_corrupt(sc, ino, bp); 382 xfs_scrub_ino_set_corrupt(sc, ino);
388 break; 383 break;
389 case XFS_DINODE_FMT_BTREE: 384 case XFS_DINODE_FMT_BTREE:
390 if (!S_ISREG(mode) && !S_ISDIR(mode)) 385 if (!S_ISREG(mode) && !S_ISDIR(mode))
391 xfs_scrub_ino_set_corrupt(sc, ino, bp); 386 xfs_scrub_ino_set_corrupt(sc, ino);
392 break; 387 break;
393 case XFS_DINODE_FMT_UUID: 388 case XFS_DINODE_FMT_UUID:
394 default: 389 default:
395 xfs_scrub_ino_set_corrupt(sc, ino, bp); 390 xfs_scrub_ino_set_corrupt(sc, ino);
396 break; 391 break;
397 } 392 }
398 393
399 /* di_[amc]time.nsec */ 394 /* di_[amc]time.nsec */
400 if (be32_to_cpu(dip->di_atime.t_nsec) >= NSEC_PER_SEC) 395 if (be32_to_cpu(dip->di_atime.t_nsec) >= NSEC_PER_SEC)
401 xfs_scrub_ino_set_corrupt(sc, ino, bp); 396 xfs_scrub_ino_set_corrupt(sc, ino);
402 if (be32_to_cpu(dip->di_mtime.t_nsec) >= NSEC_PER_SEC) 397 if (be32_to_cpu(dip->di_mtime.t_nsec) >= NSEC_PER_SEC)
403 xfs_scrub_ino_set_corrupt(sc, ino, bp); 398 xfs_scrub_ino_set_corrupt(sc, ino);
404 if (be32_to_cpu(dip->di_ctime.t_nsec) >= NSEC_PER_SEC) 399 if (be32_to_cpu(dip->di_ctime.t_nsec) >= NSEC_PER_SEC)
405 xfs_scrub_ino_set_corrupt(sc, ino, bp); 400 xfs_scrub_ino_set_corrupt(sc, ino);
406 401
407 /* 402 /*
408 * di_size. xfs_dinode_verify checks for things that screw up 403 * di_size. xfs_dinode_verify checks for things that screw up
@@ -411,19 +406,19 @@ xfs_scrub_dinode(
411 */ 406 */
412 isize = be64_to_cpu(dip->di_size); 407 isize = be64_to_cpu(dip->di_size);
413 if (isize & (1ULL << 63)) 408 if (isize & (1ULL << 63))
414 xfs_scrub_ino_set_corrupt(sc, ino, bp); 409 xfs_scrub_ino_set_corrupt(sc, ino);
415 410
416 /* Devices, fifos, and sockets must have zero size */ 411 /* Devices, fifos, and sockets must have zero size */
417 if (!S_ISDIR(mode) && !S_ISREG(mode) && !S_ISLNK(mode) && isize != 0) 412 if (!S_ISDIR(mode) && !S_ISREG(mode) && !S_ISLNK(mode) && isize != 0)
418 xfs_scrub_ino_set_corrupt(sc, ino, bp); 413 xfs_scrub_ino_set_corrupt(sc, ino);
419 414
420 /* Directories can't be larger than the data section size (32G) */ 415 /* Directories can't be larger than the data section size (32G) */
421 if (S_ISDIR(mode) && (isize == 0 || isize >= XFS_DIR2_SPACE_SIZE)) 416 if (S_ISDIR(mode) && (isize == 0 || isize >= XFS_DIR2_SPACE_SIZE))
422 xfs_scrub_ino_set_corrupt(sc, ino, bp); 417 xfs_scrub_ino_set_corrupt(sc, ino);
423 418
424 /* Symlinks can't be larger than SYMLINK_MAXLEN */ 419 /* Symlinks can't be larger than SYMLINK_MAXLEN */
425 if (S_ISLNK(mode) && (isize == 0 || isize >= XFS_SYMLINK_MAXLEN)) 420 if (S_ISLNK(mode) && (isize == 0 || isize >= XFS_SYMLINK_MAXLEN))
426 xfs_scrub_ino_set_corrupt(sc, ino, bp); 421 xfs_scrub_ino_set_corrupt(sc, ino);
427 422
428 /* 423 /*
429 * Warn if the running kernel can't handle the kinds of offsets 424 * Warn if the running kernel can't handle the kinds of offsets
@@ -432,7 +427,7 @@ xfs_scrub_dinode(
432 * overly large offsets, flag the inode for admin review. 427 * overly large offsets, flag the inode for admin review.
433 */ 428 */
434 if (isize >= mp->m_super->s_maxbytes) 429 if (isize >= mp->m_super->s_maxbytes)
435 xfs_scrub_ino_set_warning(sc, ino, bp); 430 xfs_scrub_ino_set_warning(sc, ino);
436 431
437 /* di_nblocks */ 432 /* di_nblocks */
438 if (flags2 & XFS_DIFLAG2_REFLINK) { 433 if (flags2 & XFS_DIFLAG2_REFLINK) {
@@ -447,15 +442,15 @@ xfs_scrub_dinode(
447 */ 442 */
448 if (be64_to_cpu(dip->di_nblocks) >= 443 if (be64_to_cpu(dip->di_nblocks) >=
449 mp->m_sb.sb_dblocks + mp->m_sb.sb_rblocks) 444 mp->m_sb.sb_dblocks + mp->m_sb.sb_rblocks)
450 xfs_scrub_ino_set_corrupt(sc, ino, bp); 445 xfs_scrub_ino_set_corrupt(sc, ino);
451 } else { 446 } else {
452 if (be64_to_cpu(dip->di_nblocks) >= mp->m_sb.sb_dblocks) 447 if (be64_to_cpu(dip->di_nblocks) >= mp->m_sb.sb_dblocks)
453 xfs_scrub_ino_set_corrupt(sc, ino, bp); 448 xfs_scrub_ino_set_corrupt(sc, ino);
454 } 449 }
455 450
456 xfs_scrub_inode_flags(sc, bp, dip, ino, mode, flags); 451 xfs_scrub_inode_flags(sc, dip, ino, mode, flags);
457 452
458 xfs_scrub_inode_extsize(sc, bp, dip, ino, mode, flags); 453 xfs_scrub_inode_extsize(sc, dip, ino, mode, flags);
459 454
460 /* di_nextents */ 455 /* di_nextents */
461 nextents = be32_to_cpu(dip->di_nextents); 456 nextents = be32_to_cpu(dip->di_nextents);
@@ -463,31 +458,31 @@ xfs_scrub_dinode(
463 switch (dip->di_format) { 458 switch (dip->di_format) {
464 case XFS_DINODE_FMT_EXTENTS: 459 case XFS_DINODE_FMT_EXTENTS:
465 if (nextents > fork_recs) 460 if (nextents > fork_recs)
466 xfs_scrub_ino_set_corrupt(sc, ino, bp); 461 xfs_scrub_ino_set_corrupt(sc, ino);
467 break; 462 break;
468 case XFS_DINODE_FMT_BTREE: 463 case XFS_DINODE_FMT_BTREE:
469 if (nextents <= fork_recs) 464 if (nextents <= fork_recs)
470 xfs_scrub_ino_set_corrupt(sc, ino, bp); 465 xfs_scrub_ino_set_corrupt(sc, ino);
471 break; 466 break;
472 default: 467 default:
473 if (nextents != 0) 468 if (nextents != 0)
474 xfs_scrub_ino_set_corrupt(sc, ino, bp); 469 xfs_scrub_ino_set_corrupt(sc, ino);
475 break; 470 break;
476 } 471 }
477 472
478 /* di_forkoff */ 473 /* di_forkoff */
479 if (XFS_DFORK_APTR(dip) >= (char *)dip + mp->m_sb.sb_inodesize) 474 if (XFS_DFORK_APTR(dip) >= (char *)dip + mp->m_sb.sb_inodesize)
480 xfs_scrub_ino_set_corrupt(sc, ino, bp); 475 xfs_scrub_ino_set_corrupt(sc, ino);
481 if (dip->di_anextents != 0 && dip->di_forkoff == 0) 476 if (dip->di_anextents != 0 && dip->di_forkoff == 0)
482 xfs_scrub_ino_set_corrupt(sc, ino, bp); 477 xfs_scrub_ino_set_corrupt(sc, ino);
483 if (dip->di_forkoff == 0 && dip->di_aformat != XFS_DINODE_FMT_EXTENTS) 478 if (dip->di_forkoff == 0 && dip->di_aformat != XFS_DINODE_FMT_EXTENTS)
484 xfs_scrub_ino_set_corrupt(sc, ino, bp); 479 xfs_scrub_ino_set_corrupt(sc, ino);
485 480
486 /* di_aformat */ 481 /* di_aformat */
487 if (dip->di_aformat != XFS_DINODE_FMT_LOCAL && 482 if (dip->di_aformat != XFS_DINODE_FMT_LOCAL &&
488 dip->di_aformat != XFS_DINODE_FMT_EXTENTS && 483 dip->di_aformat != XFS_DINODE_FMT_EXTENTS &&
489 dip->di_aformat != XFS_DINODE_FMT_BTREE) 484 dip->di_aformat != XFS_DINODE_FMT_BTREE)
490 xfs_scrub_ino_set_corrupt(sc, ino, bp); 485 xfs_scrub_ino_set_corrupt(sc, ino);
491 486
492 /* di_anextents */ 487 /* di_anextents */
493 nextents = be16_to_cpu(dip->di_anextents); 488 nextents = be16_to_cpu(dip->di_anextents);
@@ -495,22 +490,22 @@ xfs_scrub_dinode(
495 switch (dip->di_aformat) { 490 switch (dip->di_aformat) {
496 case XFS_DINODE_FMT_EXTENTS: 491 case XFS_DINODE_FMT_EXTENTS:
497 if (nextents > fork_recs) 492 if (nextents > fork_recs)
498 xfs_scrub_ino_set_corrupt(sc, ino, bp); 493 xfs_scrub_ino_set_corrupt(sc, ino);
499 break; 494 break;
500 case XFS_DINODE_FMT_BTREE: 495 case XFS_DINODE_FMT_BTREE:
501 if (nextents <= fork_recs) 496 if (nextents <= fork_recs)
502 xfs_scrub_ino_set_corrupt(sc, ino, bp); 497 xfs_scrub_ino_set_corrupt(sc, ino);
503 break; 498 break;
504 default: 499 default:
505 if (nextents != 0) 500 if (nextents != 0)
506 xfs_scrub_ino_set_corrupt(sc, ino, bp); 501 xfs_scrub_ino_set_corrupt(sc, ino);
507 } 502 }
508 503
509 if (dip->di_version >= 3) { 504 if (dip->di_version >= 3) {
510 if (be32_to_cpu(dip->di_crtime.t_nsec) >= NSEC_PER_SEC) 505 if (be32_to_cpu(dip->di_crtime.t_nsec) >= NSEC_PER_SEC)
511 xfs_scrub_ino_set_corrupt(sc, ino, bp); 506 xfs_scrub_ino_set_corrupt(sc, ino);
512 xfs_scrub_inode_flags2(sc, bp, dip, ino, mode, flags, flags2); 507 xfs_scrub_inode_flags2(sc, dip, ino, mode, flags, flags2);
513 xfs_scrub_inode_cowextsize(sc, bp, dip, ino, mode, flags, 508 xfs_scrub_inode_cowextsize(sc, dip, ino, mode, flags,
514 flags2); 509 flags2);
515 } 510 }
516} 511}
@@ -579,18 +574,18 @@ xfs_scrub_inode_xref_bmap(
579 if (!xfs_scrub_should_check_xref(sc, &error, NULL)) 574 if (!xfs_scrub_should_check_xref(sc, &error, NULL))
580 return; 575 return;
581 if (nextents < be32_to_cpu(dip->di_nextents)) 576 if (nextents < be32_to_cpu(dip->di_nextents))
582 xfs_scrub_ino_xref_set_corrupt(sc, sc->ip->i_ino, NULL); 577 xfs_scrub_ino_xref_set_corrupt(sc, sc->ip->i_ino);
583 578
584 error = xfs_bmap_count_blocks(sc->tp, sc->ip, XFS_ATTR_FORK, 579 error = xfs_bmap_count_blocks(sc->tp, sc->ip, XFS_ATTR_FORK,
585 &nextents, &acount); 580 &nextents, &acount);
586 if (!xfs_scrub_should_check_xref(sc, &error, NULL)) 581 if (!xfs_scrub_should_check_xref(sc, &error, NULL))
587 return; 582 return;
588 if (nextents != be16_to_cpu(dip->di_anextents)) 583 if (nextents != be16_to_cpu(dip->di_anextents))
589 xfs_scrub_ino_xref_set_corrupt(sc, sc->ip->i_ino, NULL); 584 xfs_scrub_ino_xref_set_corrupt(sc, sc->ip->i_ino);
590 585
591 /* Check nblocks against the inode. */ 586 /* Check nblocks against the inode. */
592 if (count + acount != be64_to_cpu(dip->di_nblocks)) 587 if (count + acount != be64_to_cpu(dip->di_nblocks))
593 xfs_scrub_ino_xref_set_corrupt(sc, sc->ip->i_ino, NULL); 588 xfs_scrub_ino_xref_set_corrupt(sc, sc->ip->i_ino);
594} 589}
595 590
596/* Cross-reference with the other btrees. */ 591/* Cross-reference with the other btrees. */
@@ -634,8 +629,7 @@ xfs_scrub_inode_xref(
634static void 629static void
635xfs_scrub_inode_check_reflink_iflag( 630xfs_scrub_inode_check_reflink_iflag(
636 struct xfs_scrub_context *sc, 631 struct xfs_scrub_context *sc,
637 xfs_ino_t ino, 632 xfs_ino_t ino)
638 struct xfs_buf *bp)
639{ 633{
640 struct xfs_mount *mp = sc->mp; 634 struct xfs_mount *mp = sc->mp;
641 bool has_shared; 635 bool has_shared;
@@ -650,9 +644,9 @@ xfs_scrub_inode_check_reflink_iflag(
650 XFS_INO_TO_AGBNO(mp, ino), &error)) 644 XFS_INO_TO_AGBNO(mp, ino), &error))
651 return; 645 return;
652 if (xfs_is_reflink_inode(sc->ip) && !has_shared) 646 if (xfs_is_reflink_inode(sc->ip) && !has_shared)
653 xfs_scrub_ino_set_preen(sc, ino, bp); 647 xfs_scrub_ino_set_preen(sc, ino);
654 else if (!xfs_is_reflink_inode(sc->ip) && has_shared) 648 else if (!xfs_is_reflink_inode(sc->ip) && has_shared)
655 xfs_scrub_ino_set_corrupt(sc, ino, bp); 649 xfs_scrub_ino_set_corrupt(sc, ino);
656} 650}
657 651
658/* Scrub an inode. */ 652/* Scrub an inode. */
@@ -669,13 +663,13 @@ xfs_scrub_inode(
669 * and a NULL inode, so flag the corruption error and return. 663 * and a NULL inode, so flag the corruption error and return.
670 */ 664 */
671 if (!sc->ip) { 665 if (!sc->ip) {
672 xfs_scrub_ino_set_corrupt(sc, sc->sm->sm_ino, NULL); 666 xfs_scrub_ino_set_corrupt(sc, sc->sm->sm_ino);
673 return 0; 667 return 0;
674 } 668 }
675 669
676 /* Scrub the inode core. */ 670 /* Scrub the inode core. */
677 xfs_inode_to_disk(sc->ip, &di, 0); 671 xfs_inode_to_disk(sc->ip, &di, 0);
678 xfs_scrub_dinode(sc, NULL, &di, sc->ip->i_ino); 672 xfs_scrub_dinode(sc, &di, sc->ip->i_ino);
679 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) 673 if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
680 goto out; 674 goto out;
681 675
@@ -685,7 +679,7 @@ xfs_scrub_inode(
685 * we scrubbed the dinode. 679 * we scrubbed the dinode.
686 */ 680 */
687 if (S_ISREG(VFS_I(sc->ip)->i_mode)) 681 if (S_ISREG(VFS_I(sc->ip)->i_mode))
688 xfs_scrub_inode_check_reflink_iflag(sc, sc->ip->i_ino, NULL); 682 xfs_scrub_inode_check_reflink_iflag(sc, sc->ip->i_ino);
689 683
690 xfs_scrub_inode_xref(sc, sc->ip->i_ino, &di); 684 xfs_scrub_inode_xref(sc, sc->ip->i_ino, &di);
691out: 685out:
diff --git a/fs/xfs/scrub/quota.c b/fs/xfs/scrub/quota.c
index 51daa4ae2627..6ba465e6c885 100644
--- a/fs/xfs/scrub/quota.c
+++ b/fs/xfs/scrub/quota.c
@@ -219,7 +219,7 @@ xfs_scrub_quota(
219 /* Look for problem extents. */ 219 /* Look for problem extents. */
220 xfs_ilock(ip, XFS_ILOCK_EXCL); 220 xfs_ilock(ip, XFS_ILOCK_EXCL);
221 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) { 221 if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) {
222 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino, NULL); 222 xfs_scrub_ino_set_corrupt(sc, sc->ip->i_ino);
223 goto out_unlock_inode; 223 goto out_unlock_inode;
224 } 224 }
225 max_dqid_off = ((xfs_dqid_t)-1) / qi->qi_dqperchunk; 225 max_dqid_off = ((xfs_dqid_t)-1) / qi->qi_dqperchunk;
diff --git a/fs/xfs/scrub/rtbitmap.c b/fs/xfs/scrub/rtbitmap.c
index 26390991369a..39c41dfe08ee 100644
--- a/fs/xfs/scrub/rtbitmap.c
+++ b/fs/xfs/scrub/rtbitmap.c
@@ -116,8 +116,7 @@ xfs_scrub_xref_is_used_rt_space(
116 if (!xfs_scrub_should_check_xref(sc, &error, NULL)) 116 if (!xfs_scrub_should_check_xref(sc, &error, NULL))
117 goto out_unlock; 117 goto out_unlock;
118 if (is_free) 118 if (is_free)
119 xfs_scrub_ino_xref_set_corrupt(sc, sc->mp->m_rbmip->i_ino, 119 xfs_scrub_ino_xref_set_corrupt(sc, sc->mp->m_rbmip->i_ino);
120 NULL);
121out_unlock: 120out_unlock:
122 xfs_iunlock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP); 121 xfs_iunlock(sc->mp->m_rbmip, XFS_ILOCK_SHARED | XFS_ILOCK_RTBITMAP);
123} 122}
diff --git a/fs/xfs/scrub/trace.h b/fs/xfs/scrub/trace.h
index 4dc896852bf0..5d2b1c241be5 100644
--- a/fs/xfs/scrub/trace.h
+++ b/fs/xfs/scrub/trace.h
@@ -174,53 +174,32 @@ DEFINE_SCRUB_BLOCK_ERROR_EVENT(xfs_scrub_block_error);
174DEFINE_SCRUB_BLOCK_ERROR_EVENT(xfs_scrub_block_preen); 174DEFINE_SCRUB_BLOCK_ERROR_EVENT(xfs_scrub_block_preen);
175 175
176DECLARE_EVENT_CLASS(xfs_scrub_ino_error_class, 176DECLARE_EVENT_CLASS(xfs_scrub_ino_error_class,
177 TP_PROTO(struct xfs_scrub_context *sc, xfs_ino_t ino, xfs_daddr_t daddr, 177 TP_PROTO(struct xfs_scrub_context *sc, xfs_ino_t ino, void *ret_ip),
178 void *ret_ip), 178 TP_ARGS(sc, ino, ret_ip),
179 TP_ARGS(sc, ino, daddr, ret_ip),
180 TP_STRUCT__entry( 179 TP_STRUCT__entry(
181 __field(dev_t, dev) 180 __field(dev_t, dev)
182 __field(xfs_ino_t, ino) 181 __field(xfs_ino_t, ino)
183 __field(unsigned int, type) 182 __field(unsigned int, type)
184 __field(xfs_agnumber_t, agno)
185 __field(xfs_agblock_t, bno)
186 __field(void *, ret_ip) 183 __field(void *, ret_ip)
187 ), 184 ),
188 TP_fast_assign( 185 TP_fast_assign(
189 xfs_fsblock_t fsbno;
190 xfs_agnumber_t agno;
191 xfs_agblock_t bno;
192
193 if (daddr) {
194 fsbno = XFS_DADDR_TO_FSB(sc->mp, daddr);
195 agno = XFS_FSB_TO_AGNO(sc->mp, fsbno);
196 bno = XFS_FSB_TO_AGBNO(sc->mp, fsbno);
197 } else {
198 agno = XFS_INO_TO_AGNO(sc->mp, ino);
199 bno = XFS_AGINO_TO_AGBNO(sc->mp,
200 XFS_INO_TO_AGINO(sc->mp, ino));
201 }
202
203 __entry->dev = sc->mp->m_super->s_dev; 186 __entry->dev = sc->mp->m_super->s_dev;
204 __entry->ino = ino; 187 __entry->ino = ino;
205 __entry->type = sc->sm->sm_type; 188 __entry->type = sc->sm->sm_type;
206 __entry->agno = agno;
207 __entry->bno = bno;
208 __entry->ret_ip = ret_ip; 189 __entry->ret_ip = ret_ip;
209 ), 190 ),
210 TP_printk("dev %d:%d ino 0x%llx type %u agno %u agbno %u ret_ip %pS", 191 TP_printk("dev %d:%d ino 0x%llx type %u ret_ip %pS",
211 MAJOR(__entry->dev), MINOR(__entry->dev), 192 MAJOR(__entry->dev), MINOR(__entry->dev),
212 __entry->ino, 193 __entry->ino,
213 __entry->type, 194 __entry->type,
214 __entry->agno,
215 __entry->bno,
216 __entry->ret_ip) 195 __entry->ret_ip)
217) 196)
218 197
219#define DEFINE_SCRUB_INO_ERROR_EVENT(name) \ 198#define DEFINE_SCRUB_INO_ERROR_EVENT(name) \
220DEFINE_EVENT(xfs_scrub_ino_error_class, name, \ 199DEFINE_EVENT(xfs_scrub_ino_error_class, name, \
221 TP_PROTO(struct xfs_scrub_context *sc, xfs_ino_t ino, \ 200 TP_PROTO(struct xfs_scrub_context *sc, xfs_ino_t ino, \
222 xfs_daddr_t daddr, void *ret_ip), \ 201 void *ret_ip), \
223 TP_ARGS(sc, ino, daddr, ret_ip)) 202 TP_ARGS(sc, ino, ret_ip))
224 203
225DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_error); 204DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_error);
226DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_preen); 205DEFINE_SCRUB_INO_ERROR_EVENT(xfs_scrub_ino_preen);