aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Chinner <dchinner@redhat.com>2011-03-06 18:04:35 -0500
committerDave Chinner <david@fromorbit.com>2011-03-06 18:04:35 -0500
commitaf34e09da42801c97f39f768c715f5511d914b52 (patch)
tree998f2d3d7e0dced4f401dd00073b1de411027ae7
parent65333b4c3d46909872796321d15f179cb0e32028 (diff)
xfs: kill xfs_fs_mount_cmn_err() macro
The xfs_fs_mount_cmn_err() hides a simple check as to whether the mount path should output an error or not. Remove the macro and open code the check. Signed-off-by: Dave Chinner <dchinner@redhat.com> Reviewed-by: Alex Elder <aelder@sgi.com> Reviewed-by: Christoph Hellwig <hch@lst.de>
-rw-r--r--fs/xfs/xfs_error.h6
-rw-r--r--fs/xfs/xfs_mount.c72
2 files changed, 43 insertions, 35 deletions
diff --git a/fs/xfs/xfs_error.h b/fs/xfs/xfs_error.h
index 4c8b5007000a..e8360514c250 100644
--- a/fs/xfs/xfs_error.h
+++ b/fs/xfs/xfs_error.h
@@ -162,10 +162,4 @@ struct xfs_mount;
162 162
163extern void xfs_hex_dump(void *p, int length); 163extern void xfs_hex_dump(void *p, int length);
164 164
165#define xfs_fs_mount_cmn_err(f, fmt, args...) \
166 do { \
167 if (!(f & XFS_MFSI_QUIET)) \
168 cmn_err(CE_WARN, "XFS: " fmt, ## args); \
169 } while (0)
170
171#endif /* __XFS_ERROR_H__ */ 165#endif /* __XFS_ERROR_H__ */
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index d447aef84bc3..1b43ad3d6ddb 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -311,6 +311,8 @@ xfs_mount_validate_sb(
311 xfs_sb_t *sbp, 311 xfs_sb_t *sbp,
312 int flags) 312 int flags)
313{ 313{
314 int loud = !(flags & XFS_MFSI_QUIET);
315
314 /* 316 /*
315 * If the log device and data device have the 317 * If the log device and data device have the
316 * same device number, the log is internal. 318 * same device number, the log is internal.
@@ -319,28 +321,32 @@ xfs_mount_validate_sb(
319 * a volume filesystem in a non-volume manner. 321 * a volume filesystem in a non-volume manner.
320 */ 322 */
321 if (sbp->sb_magicnum != XFS_SB_MAGIC) { 323 if (sbp->sb_magicnum != XFS_SB_MAGIC) {
322 xfs_fs_mount_cmn_err(flags, "bad magic number"); 324 if (loud)
325 xfs_warn(mp, "bad magic number");
323 return XFS_ERROR(EWRONGFS); 326 return XFS_ERROR(EWRONGFS);
324 } 327 }
325 328
326 if (!xfs_sb_good_version(sbp)) { 329 if (!xfs_sb_good_version(sbp)) {
327 xfs_fs_mount_cmn_err(flags, "bad version"); 330 if (loud)
331 xfs_warn(mp, "bad version");
328 return XFS_ERROR(EWRONGFS); 332 return XFS_ERROR(EWRONGFS);
329 } 333 }
330 334
331 if (unlikely( 335 if (unlikely(
332 sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) { 336 sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {
333 xfs_fs_mount_cmn_err(flags, 337 if (loud)
334 "filesystem is marked as having an external log; " 338 xfs_warn(mp,
335 "specify logdev on the\nmount command line."); 339 "filesystem is marked as having an external log; "
340 "specify logdev on the mount command line.");
336 return XFS_ERROR(EINVAL); 341 return XFS_ERROR(EINVAL);
337 } 342 }
338 343
339 if (unlikely( 344 if (unlikely(
340 sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) { 345 sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {
341 xfs_fs_mount_cmn_err(flags, 346 if (loud)
342 "filesystem is marked as having an internal log; " 347 xfs_warn(mp,
343 "do not specify logdev on\nthe mount command line."); 348 "filesystem is marked as having an internal log; "
349 "do not specify logdev on the mount command line.");
344 return XFS_ERROR(EINVAL); 350 return XFS_ERROR(EINVAL);
345 } 351 }
346 352
@@ -369,7 +375,8 @@ xfs_mount_validate_sb(
369 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || 375 (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) ||
370 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || 376 (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) ||
371 (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) { 377 (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) {
372 xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed"); 378 if (loud)
379 xfs_warn(mp, "SB sanity check 1 failed");
373 return XFS_ERROR(EFSCORRUPTED); 380 return XFS_ERROR(EFSCORRUPTED);
374 } 381 }
375 382
@@ -382,7 +389,8 @@ xfs_mount_validate_sb(
382 (xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks || 389 (xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks ||
383 sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) * 390 sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) *
384 sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) { 391 sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) {
385 xfs_fs_mount_cmn_err(flags, "SB sanity check 2 failed"); 392 if (loud)
393 xfs_warn(mp, "SB sanity check 2 failed");
386 return XFS_ERROR(EFSCORRUPTED); 394 return XFS_ERROR(EFSCORRUPTED);
387 } 395 }
388 396
@@ -390,12 +398,12 @@ xfs_mount_validate_sb(
390 * Until this is fixed only page-sized or smaller data blocks work. 398 * Until this is fixed only page-sized or smaller data blocks work.
391 */ 399 */
392 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) { 400 if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
393 xfs_fs_mount_cmn_err(flags, 401 if (loud) {
394 "file system with blocksize %d bytes", 402 xfs_warn(mp,
395 sbp->sb_blocksize); 403 "File system with blocksize %d bytes. "
396 xfs_fs_mount_cmn_err(flags, 404 "Only pagesize (%ld) or less will currently work.",
397 "only pagesize (%ld) or less will currently work.", 405 sbp->sb_blocksize, PAGE_SIZE);
398 PAGE_SIZE); 406 }
399 return XFS_ERROR(ENOSYS); 407 return XFS_ERROR(ENOSYS);
400 } 408 }
401 409
@@ -409,21 +417,23 @@ xfs_mount_validate_sb(
409 case 2048: 417 case 2048:
410 break; 418 break;
411 default: 419 default:
412 xfs_fs_mount_cmn_err(flags, 420 if (loud)
413 "inode size of %d bytes not supported", 421 xfs_warn(mp, "inode size of %d bytes not supported",
414 sbp->sb_inodesize); 422 sbp->sb_inodesize);
415 return XFS_ERROR(ENOSYS); 423 return XFS_ERROR(ENOSYS);
416 } 424 }
417 425
418 if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) || 426 if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) ||
419 xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) { 427 xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) {
420 xfs_fs_mount_cmn_err(flags, 428 if (loud)
421 "file system too large to be mounted on this system."); 429 xfs_warn(mp,
430 "file system too large to be mounted on this system.");
422 return XFS_ERROR(EFBIG); 431 return XFS_ERROR(EFBIG);
423 } 432 }
424 433
425 if (unlikely(sbp->sb_inprogress)) { 434 if (unlikely(sbp->sb_inprogress)) {
426 xfs_fs_mount_cmn_err(flags, "file system busy"); 435 if (loud)
436 xfs_warn(mp, "file system busy");
427 return XFS_ERROR(EFSCORRUPTED); 437 return XFS_ERROR(EFSCORRUPTED);
428 } 438 }
429 439
@@ -431,8 +441,9 @@ xfs_mount_validate_sb(
431 * Version 1 directory format has never worked on Linux. 441 * Version 1 directory format has never worked on Linux.
432 */ 442 */
433 if (unlikely(!xfs_sb_version_hasdirv2(sbp))) { 443 if (unlikely(!xfs_sb_version_hasdirv2(sbp))) {
434 xfs_fs_mount_cmn_err(flags, 444 if (loud)
435 "file system using version 1 directory format"); 445 xfs_warn(mp,
446 "file system using version 1 directory format");
436 return XFS_ERROR(ENOSYS); 447 return XFS_ERROR(ENOSYS);
437 } 448 }
438 449
@@ -673,6 +684,7 @@ xfs_readsb(xfs_mount_t *mp, int flags)
673 unsigned int sector_size; 684 unsigned int sector_size;
674 xfs_buf_t *bp; 685 xfs_buf_t *bp;
675 int error; 686 int error;
687 int loud = !(flags & XFS_MFSI_QUIET);
676 688
677 ASSERT(mp->m_sb_bp == NULL); 689 ASSERT(mp->m_sb_bp == NULL);
678 ASSERT(mp->m_ddev_targp != NULL); 690 ASSERT(mp->m_ddev_targp != NULL);
@@ -688,7 +700,8 @@ reread:
688 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp, 700 bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp,
689 XFS_SB_DADDR, sector_size, 0); 701 XFS_SB_DADDR, sector_size, 0);
690 if (!bp) { 702 if (!bp) {
691 xfs_fs_mount_cmn_err(flags, "SB buffer read failed"); 703 if (loud)
704 xfs_warn(mp, "SB buffer read failed");
692 return EIO; 705 return EIO;
693 } 706 }
694 707
@@ -699,7 +712,8 @@ reread:
699 xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); 712 xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp));
700 error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags); 713 error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags);
701 if (error) { 714 if (error) {
702 xfs_fs_mount_cmn_err(flags, "SB validate failed"); 715 if (loud)
716 xfs_warn(mp, "SB validate failed");
703 goto release_buf; 717 goto release_buf;
704 } 718 }
705 719
@@ -707,9 +721,9 @@ reread:
707 * We must be able to do sector-sized and sector-aligned IO. 721 * We must be able to do sector-sized and sector-aligned IO.
708 */ 722 */
709 if (sector_size > mp->m_sb.sb_sectsize) { 723 if (sector_size > mp->m_sb.sb_sectsize) {
710 xfs_fs_mount_cmn_err(flags, 724 if (loud)
711 "device supports only %u byte sectors (not %u)", 725 xfs_warn(mp, "device supports %u byte sectors (not %u)",
712 sector_size, mp->m_sb.sb_sectsize); 726 sector_size, mp->m_sb.sb_sectsize);
713 error = ENOSYS; 727 error = ENOSYS;
714 goto release_buf; 728 goto release_buf;
715 } 729 }