提交 af34e09d 编写于 作者: D Dave Chinner 提交者: Dave Chinner

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: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NAlex Elder <aelder@sgi.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
上级 65333b4c
...@@ -162,10 +162,4 @@ struct xfs_mount; ...@@ -162,10 +162,4 @@ struct xfs_mount;
extern void xfs_hex_dump(void *p, int length); extern void xfs_hex_dump(void *p, int length);
#define xfs_fs_mount_cmn_err(f, fmt, args...) \
do { \
if (!(f & XFS_MFSI_QUIET)) \
cmn_err(CE_WARN, "XFS: " fmt, ## args); \
} while (0)
#endif /* __XFS_ERROR_H__ */ #endif /* __XFS_ERROR_H__ */
...@@ -311,6 +311,8 @@ xfs_mount_validate_sb( ...@@ -311,6 +311,8 @@ xfs_mount_validate_sb(
xfs_sb_t *sbp, xfs_sb_t *sbp,
int flags) int flags)
{ {
int loud = !(flags & XFS_MFSI_QUIET);
/* /*
* If the log device and data device have the * If the log device and data device have the
* same device number, the log is internal. * same device number, the log is internal.
...@@ -319,28 +321,32 @@ xfs_mount_validate_sb( ...@@ -319,28 +321,32 @@ xfs_mount_validate_sb(
* a volume filesystem in a non-volume manner. * a volume filesystem in a non-volume manner.
*/ */
if (sbp->sb_magicnum != XFS_SB_MAGIC) { if (sbp->sb_magicnum != XFS_SB_MAGIC) {
xfs_fs_mount_cmn_err(flags, "bad magic number"); if (loud)
xfs_warn(mp, "bad magic number");
return XFS_ERROR(EWRONGFS); return XFS_ERROR(EWRONGFS);
} }
if (!xfs_sb_good_version(sbp)) { if (!xfs_sb_good_version(sbp)) {
xfs_fs_mount_cmn_err(flags, "bad version"); if (loud)
xfs_warn(mp, "bad version");
return XFS_ERROR(EWRONGFS); return XFS_ERROR(EWRONGFS);
} }
if (unlikely( if (unlikely(
sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) { sbp->sb_logstart == 0 && mp->m_logdev_targp == mp->m_ddev_targp)) {
xfs_fs_mount_cmn_err(flags, if (loud)
xfs_warn(mp,
"filesystem is marked as having an external log; " "filesystem is marked as having an external log; "
"specify logdev on the\nmount command line."); "specify logdev on the mount command line.");
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
if (unlikely( if (unlikely(
sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) { sbp->sb_logstart != 0 && mp->m_logdev_targp != mp->m_ddev_targp)) {
xfs_fs_mount_cmn_err(flags, if (loud)
xfs_warn(mp,
"filesystem is marked as having an internal log; " "filesystem is marked as having an internal log; "
"do not specify logdev on\nthe mount command line."); "do not specify logdev on the mount command line.");
return XFS_ERROR(EINVAL); return XFS_ERROR(EINVAL);
} }
...@@ -369,7 +375,8 @@ xfs_mount_validate_sb( ...@@ -369,7 +375,8 @@ xfs_mount_validate_sb(
(sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) || (sbp->sb_rextsize * sbp->sb_blocksize > XFS_MAX_RTEXTSIZE) ||
(sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) || (sbp->sb_rextsize * sbp->sb_blocksize < XFS_MIN_RTEXTSIZE) ||
(sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) { (sbp->sb_imax_pct > 100 /* zero sb_imax_pct is valid */))) {
xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed"); if (loud)
xfs_warn(mp, "SB sanity check 1 failed");
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
...@@ -382,7 +389,8 @@ xfs_mount_validate_sb( ...@@ -382,7 +389,8 @@ xfs_mount_validate_sb(
(xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks || (xfs_drfsbno_t)sbp->sb_agcount * sbp->sb_agblocks ||
sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) * sbp->sb_dblocks < (xfs_drfsbno_t)(sbp->sb_agcount - 1) *
sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) { sbp->sb_agblocks + XFS_MIN_AG_BLOCKS)) {
xfs_fs_mount_cmn_err(flags, "SB sanity check 2 failed"); if (loud)
xfs_warn(mp, "SB sanity check 2 failed");
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
...@@ -390,12 +398,12 @@ xfs_mount_validate_sb( ...@@ -390,12 +398,12 @@ xfs_mount_validate_sb(
* Until this is fixed only page-sized or smaller data blocks work. * Until this is fixed only page-sized or smaller data blocks work.
*/ */
if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) { if (unlikely(sbp->sb_blocksize > PAGE_SIZE)) {
xfs_fs_mount_cmn_err(flags, if (loud) {
"file system with blocksize %d bytes", xfs_warn(mp,
sbp->sb_blocksize); "File system with blocksize %d bytes. "
xfs_fs_mount_cmn_err(flags, "Only pagesize (%ld) or less will currently work.",
"only pagesize (%ld) or less will currently work.", sbp->sb_blocksize, PAGE_SIZE);
PAGE_SIZE); }
return XFS_ERROR(ENOSYS); return XFS_ERROR(ENOSYS);
} }
...@@ -409,21 +417,23 @@ xfs_mount_validate_sb( ...@@ -409,21 +417,23 @@ xfs_mount_validate_sb(
case 2048: case 2048:
break; break;
default: default:
xfs_fs_mount_cmn_err(flags, if (loud)
"inode size of %d bytes not supported", xfs_warn(mp, "inode size of %d bytes not supported",
sbp->sb_inodesize); sbp->sb_inodesize);
return XFS_ERROR(ENOSYS); return XFS_ERROR(ENOSYS);
} }
if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) || if (xfs_sb_validate_fsb_count(sbp, sbp->sb_dblocks) ||
xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) { xfs_sb_validate_fsb_count(sbp, sbp->sb_rblocks)) {
xfs_fs_mount_cmn_err(flags, if (loud)
xfs_warn(mp,
"file system too large to be mounted on this system."); "file system too large to be mounted on this system.");
return XFS_ERROR(EFBIG); return XFS_ERROR(EFBIG);
} }
if (unlikely(sbp->sb_inprogress)) { if (unlikely(sbp->sb_inprogress)) {
xfs_fs_mount_cmn_err(flags, "file system busy"); if (loud)
xfs_warn(mp, "file system busy");
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
...@@ -431,7 +441,8 @@ xfs_mount_validate_sb( ...@@ -431,7 +441,8 @@ xfs_mount_validate_sb(
* Version 1 directory format has never worked on Linux. * Version 1 directory format has never worked on Linux.
*/ */
if (unlikely(!xfs_sb_version_hasdirv2(sbp))) { if (unlikely(!xfs_sb_version_hasdirv2(sbp))) {
xfs_fs_mount_cmn_err(flags, if (loud)
xfs_warn(mp,
"file system using version 1 directory format"); "file system using version 1 directory format");
return XFS_ERROR(ENOSYS); return XFS_ERROR(ENOSYS);
} }
...@@ -673,6 +684,7 @@ xfs_readsb(xfs_mount_t *mp, int flags) ...@@ -673,6 +684,7 @@ xfs_readsb(xfs_mount_t *mp, int flags)
unsigned int sector_size; unsigned int sector_size;
xfs_buf_t *bp; xfs_buf_t *bp;
int error; int error;
int loud = !(flags & XFS_MFSI_QUIET);
ASSERT(mp->m_sb_bp == NULL); ASSERT(mp->m_sb_bp == NULL);
ASSERT(mp->m_ddev_targp != NULL); ASSERT(mp->m_ddev_targp != NULL);
...@@ -688,7 +700,8 @@ xfs_readsb(xfs_mount_t *mp, int flags) ...@@ -688,7 +700,8 @@ xfs_readsb(xfs_mount_t *mp, int flags)
bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp, bp = xfs_buf_read_uncached(mp, mp->m_ddev_targp,
XFS_SB_DADDR, sector_size, 0); XFS_SB_DADDR, sector_size, 0);
if (!bp) { if (!bp) {
xfs_fs_mount_cmn_err(flags, "SB buffer read failed"); if (loud)
xfs_warn(mp, "SB buffer read failed");
return EIO; return EIO;
} }
...@@ -699,7 +712,8 @@ xfs_readsb(xfs_mount_t *mp, int flags) ...@@ -699,7 +712,8 @@ xfs_readsb(xfs_mount_t *mp, int flags)
xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp)); xfs_sb_from_disk(&mp->m_sb, XFS_BUF_TO_SBP(bp));
error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags); error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags);
if (error) { if (error) {
xfs_fs_mount_cmn_err(flags, "SB validate failed"); if (loud)
xfs_warn(mp, "SB validate failed");
goto release_buf; goto release_buf;
} }
...@@ -707,8 +721,8 @@ xfs_readsb(xfs_mount_t *mp, int flags) ...@@ -707,8 +721,8 @@ xfs_readsb(xfs_mount_t *mp, int flags)
* We must be able to do sector-sized and sector-aligned IO. * We must be able to do sector-sized and sector-aligned IO.
*/ */
if (sector_size > mp->m_sb.sb_sectsize) { if (sector_size > mp->m_sb.sb_sectsize) {
xfs_fs_mount_cmn_err(flags, if (loud)
"device supports only %u byte sectors (not %u)", xfs_warn(mp, "device supports %u byte sectors (not %u)",
sector_size, mp->m_sb.sb_sectsize); sector_size, mp->m_sb.sb_sectsize);
error = ENOSYS; error = ENOSYS;
goto release_buf; goto release_buf;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册