[XFS] Implement the silent parameter to fill_super, previously ignored.

SGI-PV: 951299
SGI-Modid: xfs-linux-melb:xfs-kern:25632a

Signed-off-by: Nathan Scott <nathans@sgi.com>

+49 -47
+6 -5
fs/xfs/linux-2.6/xfs_super.c
··· 67 67 68 68 STATIC struct xfs_mount_args * 69 69 xfs_args_allocate( 70 - struct super_block *sb) 70 + struct super_block *sb, 71 + int silent) 71 72 { 72 73 struct xfs_mount_args *args; 73 74 ··· 81 80 args->flags |= XFSMNT_DIRSYNC; 82 81 if (sb->s_flags & MS_SYNCHRONOUS) 83 82 args->flags |= XFSMNT_WSYNC; 84 - 85 - /* Default to 32 bit inodes on Linux all the time */ 83 + if (silent) 84 + args->flags |= XFSMNT_QUIET; 86 85 args->flags |= XFSMNT_32BITINODES; 87 86 88 87 return args; ··· 720 719 char *options) 721 720 { 722 721 vfs_t *vfsp = vfs_from_sb(sb); 723 - struct xfs_mount_args *args = xfs_args_allocate(sb); 722 + struct xfs_mount_args *args = xfs_args_allocate(sb, 0); 724 723 int error; 725 724 726 725 VFS_PARSEARGS(vfsp, options, args, 1, error); ··· 826 825 { 827 826 vnode_t *rootvp; 828 827 struct vfs *vfsp = vfs_allocate(sb); 829 - struct xfs_mount_args *args = xfs_args_allocate(sb); 828 + struct xfs_mount_args *args = xfs_args_allocate(sb, silent); 830 829 struct kstatfs statvfs; 831 830 int error, error2; 832 831
+1
fs/xfs/xfs_clnt.h
··· 68 68 * enforcement */ 69 69 #define XFSMNT_PQUOTAENF 0x00000040 /* IRIX project quota limit 70 70 * enforcement */ 71 + #define XFSMNT_QUIET 0x00000080 /* don't report mount errors */ 71 72 #define XFSMNT_NOALIGN 0x00000200 /* don't allocate at 72 73 * stripe boundaries*/ 73 74 #define XFSMNT_RETERR 0x00000400 /* return error to user */
+3
fs/xfs/xfs_error.h
··· 186 186 #define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \ 187 187 xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args) 188 188 189 + #define xfs_fs_mount_cmn_err(f, fmt, args...) \ 190 + ((f & XFS_MFSI_QUIET)? cmn_err(CE_WARN, "XFS: " fmt, ## args) : (void)0) 191 + 189 192 #endif /* __XFS_ERROR_H__ */
+31 -40
fs/xfs/xfs_mount.c
··· 213 213 STATIC int 214 214 xfs_mount_validate_sb( 215 215 xfs_mount_t *mp, 216 - xfs_sb_t *sbp) 216 + xfs_sb_t *sbp, 217 + int flags) 217 218 { 218 219 /* 219 220 * If the log device and data device have the ··· 224 223 * a volume filesystem in a non-volume manner. 225 224 */ 226 225 if (sbp->sb_magicnum != XFS_SB_MAGIC) { 227 - cmn_err(CE_WARN, "XFS: bad magic number"); 226 + xfs_fs_mount_cmn_err(flags, "bad magic number"); 228 227 return XFS_ERROR(EWRONGFS); 229 228 } 230 229 231 230 if (!XFS_SB_GOOD_VERSION(sbp)) { 232 - cmn_err(CE_WARN, "XFS: bad version"); 231 + xfs_fs_mount_cmn_err(flags, "bad version"); 233 232 return XFS_ERROR(EWRONGFS); 234 233 } 235 234 236 235 if (unlikely( 237 236 sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) { 238 - cmn_err(CE_WARN, 239 - "XFS: filesystem is marked as having an external log; " 240 - "specify logdev on the\nmount command line."); 241 - XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(1)", 242 - XFS_ERRLEVEL_HIGH, mp, sbp); 243 - return XFS_ERROR(EFSCORRUPTED); 237 + xfs_fs_mount_cmn_err(flags, 238 + "filesystem is marked as having an external log; " 239 + "specify logdev on the\nmount command line."); 240 + return XFS_ERROR(EINVAL); 244 241 } 245 242 246 243 if (unlikely( 247 244 sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) { 248 - cmn_err(CE_WARN, 249 - "XFS: filesystem is marked as having an internal log; " 250 - "don't specify logdev on\nthe mount command line."); 251 - XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(2)", 252 - XFS_ERRLEVEL_HIGH, mp, sbp); 253 - return XFS_ERROR(EFSCORRUPTED); 245 + xfs_fs_mount_cmn_err(flags, 246 + "filesystem is marked as having an internal log; " 247 + "do not specify logdev on\nthe mount command line."); 248 + return XFS_ERROR(EINVAL); 254 249 } 255 250 256 251 /* ··· 271 274 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || 272 275 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || 273 276 (sbp->sb_imax_pct > 100 || sbp->sb_imax_pct < 1))) { 274 - cmn_err(CE_WARN, "XFS: SB sanity check 1 failed"); 275 - XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(3)", 276 - XFS_ERRLEVEL_LOW, mp, sbp); 277 + xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed"); 277 278 return XFS_ERROR(EFSCORRUPTED); 278 279 } 279 280 ··· 284 289 (xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks || 285 290 sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) * 286 291 sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) { 287 - cmn_err(CE_WARN, "XFS: SB sanity check 2 failed"); 288 - XFS_ERROR_REPORT("xfs_mount_validate_sb(4)", 289 - XFS_ERRLEVEL_LOW, mp); 292 + xfs_fs_mount_cmn_err(flags, "SB sanity check 2 failed"); 290 293 return XFS_ERROR(EFSCORRUPTED); 291 294 } 292 295 ··· 300 307 (sbp->sb_dblocks << (sbp->sb_blocklog - BBSHIFT)) > UINT_MAX || 301 308 (sbp->sb_rblocks << (sbp->sb_blocklog - BBSHIFT)) > UINT_MAX)) { 302 309 #endif 303 - cmn_err(CE_WARN, 304 - "XFS: File system is too large to be mounted on this system."); 310 + xfs_fs_mount_cmn_err(flags, 311 + "file system too large to be mounted on this system."); 305 312 return XFS_ERROR(E2BIG); 306 313 } 307 314 308 315 if (unlikely(sbp->sb_inprogress)) { 309 - cmn_err(CE_WARN, "XFS: file system busy"); 310 - XFS_ERROR_REPORT("xfs_mount_validate_sb(5)", 311 - XFS_ERRLEVEL_LOW, mp); 316 + xfs_fs_mount_cmn_err(flags, "file system busy"); 312 317 return XFS_ERROR(EFSCORRUPTED); 313 318 } 314 319 ··· 314 323 * Version 1 directory format has never worked on Linux. 315 324 */ 316 325 if (unlikely(!XFS_SB_VERSION_HASDIRV2(sbp))) { 317 - cmn_err(CE_WARN, 318 - "XFS: Attempted to mount file system using version 1 directory format"); 326 + xfs_fs_mount_cmn_err(flags, 327 + "file system using version 1 directory format"); 319 328 return XFS_ERROR(ENOSYS); 320 329 } 321 330 ··· 323 332 * Until this is fixed only page-sized or smaller data blocks work. 324 333 */ 325 334 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) { 326 - cmn_err(CE_WARN, 327 - "XFS: Attempted to mount file system with blocksize %d bytes", 335 + xfs_fs_mount_cmn_err(flags, 336 + "file system with blocksize %d bytes", 328 337 sbp->sb_blocksize); 329 - cmn_err(CE_WARN, 330 - "XFS: Only page-sized (%ld) or less blocksizes currently work.", 338 + xfs_fs_mount_cmn_err(flags, 339 + "only pagesize (%ld) or less will currently work.", 331 340 PAGE_SIZE); 332 341 return XFS_ERROR(ENOSYS); 333 342 } ··· 475 484 * Does the initial read of the superblock. 476 485 */ 477 486 int 478 - xfs_readsb(xfs_mount_t *mp) 487 + xfs_readsb(xfs_mount_t *mp, int flags) 479 488 { 480 489 unsigned int sector_size; 481 490 unsigned int extra_flags; ··· 497 506 bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR, 498 507 BTOBB(sector_size), extra_flags); 499 508 if (!bp || XFS_BUF_ISERROR(bp)) { 500 - cmn_err(CE_WARN, "XFS: SB read failed"); 509 + xfs_fs_mount_cmn_err(flags, "SB read failed"); 501 510 error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM; 502 511 goto fail; 503 512 } ··· 511 520 sbp = XFS_BUF_TO_SBP(bp); 512 521 xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1, XFS_SB_ALL_BITS); 513 522 514 - error = xfs_mount_validate_sb(mp, &(mp->m_sb)); 523 + error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags); 515 524 if (error) { 516 - cmn_err(CE_WARN, "XFS: SB validate failed"); 525 + xfs_fs_mount_cmn_err(flags, "SB validate failed"); 517 526 goto fail; 518 527 } 519 528 ··· 521 530 * We must be able to do sector-sized and sector-aligned IO. 522 531 */ 523 532 if (sector_size > mp->m_sb.sb_sectsize) { 524 - cmn_err(CE_WARN, 525 - "XFS: device supports only %u byte sectors (not %u)", 533 + xfs_fs_mount_cmn_err(flags, 534 + "device supports only %u byte sectors (not %u)", 526 535 sector_size, mp->m_sb.sb_sectsize); 527 536 error = ENOSYS; 528 537 goto fail; ··· 539 548 bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR, 540 549 BTOBB(sector_size), extra_flags); 541 550 if (!bp || XFS_BUF_ISERROR(bp)) { 542 - cmn_err(CE_WARN, "XFS: SB re-read failed"); 551 + xfs_fs_mount_cmn_err(flags, "SB re-read failed"); 543 552 error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM; 544 553 goto fail; 545 554 } ··· 669 678 int error = 0; 670 679 671 680 if (mp->m_sb_bp == NULL) { 672 - if ((error = xfs_readsb(mp))) { 681 + if ((error = xfs_readsb(mp, mfsi_flags))) { 673 682 return error; 674 683 } 675 684 }
+4 -1
fs/xfs/xfs_mount.h
··· 510 510 */ 511 511 #define XFS_MFSI_SECOND 0x01 /* Secondary mount -- skip stuff */ 512 512 #define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */ 513 + /* XFS_MFSI_RRINODES */ 513 514 #define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */ 514 515 /* log recovery */ 515 516 #define XFS_MFSI_NO_QUOTACHECK 0x10 /* Skip quotacheck processing */ 517 + /* XFS_MFSI_CONVERT_SUNIT */ 518 + #define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */ 516 519 517 520 /* 518 521 * Macros for getting from mount to vfs and back. ··· 584 581 extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, 585 582 uint, int); 586 583 extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); 587 - extern int xfs_readsb(xfs_mount_t *mp); 584 + extern int xfs_readsb(xfs_mount_t *, int); 588 585 extern void xfs_freesb(xfs_mount_t *); 589 586 extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int); 590 587 extern int xfs_syncsub(xfs_mount_t *, int, int, int *);
+4 -1
fs/xfs/xfs_vfsops.c
··· 442 442 p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO); 443 443 mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs; 444 444 445 + if (args->flags & XFSMNT_QUIET) 446 + flags |= XFS_MFSI_QUIET; 447 + 445 448 /* 446 449 * Open real time and log devices - order is important. 447 450 */ ··· 495 492 error = xfs_start_flags(vfsp, args, mp); 496 493 if (error) 497 494 goto error1; 498 - error = xfs_readsb(mp); 495 + error = xfs_readsb(mp, flags); 499 496 if (error) 500 497 goto error1; 501 498 error = xfs_finish_flags(vfsp, args, mp);