Commit 764d1f89 authored by Nathan Scott's avatar Nathan Scott

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

SGI-PV: 951299
SGI-Modid: xfs-linux-melb:xfs-kern:25632a
Signed-off-by: default avatarNathan Scott <nathans@sgi.com>
parent 4b4fa25c
...@@ -67,7 +67,8 @@ mempool_t *xfs_ioend_pool; ...@@ -67,7 +67,8 @@ mempool_t *xfs_ioend_pool;
STATIC struct xfs_mount_args * STATIC struct xfs_mount_args *
xfs_args_allocate( xfs_args_allocate(
struct super_block *sb) struct super_block *sb,
int silent)
{ {
struct xfs_mount_args *args; struct xfs_mount_args *args;
...@@ -80,8 +81,8 @@ xfs_args_allocate( ...@@ -80,8 +81,8 @@ xfs_args_allocate(
args->flags |= XFSMNT_DIRSYNC; args->flags |= XFSMNT_DIRSYNC;
if (sb->s_flags & MS_SYNCHRONOUS) if (sb->s_flags & MS_SYNCHRONOUS)
args->flags |= XFSMNT_WSYNC; args->flags |= XFSMNT_WSYNC;
if (silent)
/* Default to 32 bit inodes on Linux all the time */ args->flags |= XFSMNT_QUIET;
args->flags |= XFSMNT_32BITINODES; args->flags |= XFSMNT_32BITINODES;
return args; return args;
...@@ -719,7 +720,7 @@ xfs_fs_remount( ...@@ -719,7 +720,7 @@ xfs_fs_remount(
char *options) char *options)
{ {
vfs_t *vfsp = vfs_from_sb(sb); vfs_t *vfsp = vfs_from_sb(sb);
struct xfs_mount_args *args = xfs_args_allocate(sb); struct xfs_mount_args *args = xfs_args_allocate(sb, 0);
int error; int error;
VFS_PARSEARGS(vfsp, options, args, 1, error); VFS_PARSEARGS(vfsp, options, args, 1, error);
...@@ -825,7 +826,7 @@ xfs_fs_fill_super( ...@@ -825,7 +826,7 @@ xfs_fs_fill_super(
{ {
vnode_t *rootvp; vnode_t *rootvp;
struct vfs *vfsp = vfs_allocate(sb); struct vfs *vfsp = vfs_allocate(sb);
struct xfs_mount_args *args = xfs_args_allocate(sb); struct xfs_mount_args *args = xfs_args_allocate(sb, silent);
struct kstatfs statvfs; struct kstatfs statvfs;
int error, error2; int error, error2;
......
...@@ -68,6 +68,7 @@ struct xfs_mount_args { ...@@ -68,6 +68,7 @@ struct xfs_mount_args {
* enforcement */ * enforcement */
#define XFSMNT_PQUOTAENF 0x00000040 /* IRIX project quota limit #define XFSMNT_PQUOTAENF 0x00000040 /* IRIX project quota limit
* enforcement */ * enforcement */
#define XFSMNT_QUIET 0x00000080 /* don't report mount errors */
#define XFSMNT_NOALIGN 0x00000200 /* don't allocate at #define XFSMNT_NOALIGN 0x00000200 /* don't allocate at
* stripe boundaries*/ * stripe boundaries*/
#define XFSMNT_RETERR 0x00000400 /* return error to user */ #define XFSMNT_RETERR 0x00000400 /* return error to user */
......
...@@ -186,4 +186,7 @@ extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...); ...@@ -186,4 +186,7 @@ extern void xfs_fs_cmn_err(int level, struct xfs_mount *mp, char *fmt, ...);
#define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \ #define xfs_fs_repair_cmn_err(level, mp, fmt, args...) \
xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args) xfs_fs_cmn_err(level, mp, fmt " Unmount and run xfs_repair.", ## args)
#define xfs_fs_mount_cmn_err(f, fmt, args...) \
((f & XFS_MFSI_QUIET)? cmn_err(CE_WARN, "XFS: " fmt, ## args) : (void)0)
#endif /* __XFS_ERROR_H__ */ #endif /* __XFS_ERROR_H__ */
...@@ -213,7 +213,8 @@ xfs_mount_free( ...@@ -213,7 +213,8 @@ xfs_mount_free(
STATIC int STATIC int
xfs_mount_validate_sb( xfs_mount_validate_sb(
xfs_mount_t *mp, xfs_mount_t *mp,
xfs_sb_t *sbp) xfs_sb_t *sbp,
int flags)
{ {
/* /*
* If the log device and data device have the * If the log device and data device have the
...@@ -223,33 +224,29 @@ xfs_mount_validate_sb( ...@@ -223,33 +224,29 @@ 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) {
cmn_err(CE_WARN, "XFS: bad magic number"); xfs_fs_mount_cmn_err(flags, "bad magic number");
return XFS_ERROR(EWRONGFS); return XFS_ERROR(EWRONGFS);
} }
if (!XFS_SB_GOOD_VERSION(sbp)) { if (!XFS_SB_GOOD_VERSION(sbp)) {
cmn_err(CE_WARN, "XFS: bad version"); xfs_fs_mount_cmn_err(flags, "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)) {
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: 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\nmount command line.");
XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(1)", return XFS_ERROR(EINVAL);
XFS_ERRLEVEL_HIGH, mp, sbp);
return XFS_ERROR(EFSCORRUPTED);
} }
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)) {
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: filesystem is marked as having an internal log; " "filesystem is marked as having an internal log; "
"don't specify logdev on\nthe mount command line."); "do not specify logdev on\nthe mount command line.");
XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(2)", return XFS_ERROR(EINVAL);
XFS_ERRLEVEL_HIGH, mp, sbp);
return XFS_ERROR(EFSCORRUPTED);
} }
/* /*
...@@ -274,9 +271,7 @@ xfs_mount_validate_sb( ...@@ -274,9 +271,7 @@ 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 || sbp->sb_imax_pct < 1))) { (sbp->sb_imax_pct > 100 || sbp->sb_imax_pct < 1))) {
cmn_err(CE_WARN, "XFS: SB sanity check 1 failed"); xfs_fs_mount_cmn_err(flags, "SB sanity check 1 failed");
XFS_CORRUPTION_ERROR("xfs_mount_validate_sb(3)",
XFS_ERRLEVEL_LOW, mp, sbp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
...@@ -289,9 +284,7 @@ xfs_mount_validate_sb( ...@@ -289,9 +284,7 @@ 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)) {
cmn_err(CE_WARN, "XFS: SB sanity check 2 failed"); xfs_fs_mount_cmn_err(flags, "SB sanity check 2 failed");
XFS_ERROR_REPORT("xfs_mount_validate_sb(4)",
XFS_ERRLEVEL_LOW, mp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
...@@ -307,15 +300,13 @@ xfs_mount_validate_sb( ...@@ -307,15 +300,13 @@ xfs_mount_validate_sb(
(sbp->sb_dblocks << (sbp->sb_blocklog - BBSHIFT)) > UINT_MAX || (sbp->sb_dblocks << (sbp->sb_blocklog - BBSHIFT)) > UINT_MAX ||
(sbp->sb_rblocks << (sbp->sb_blocklog - BBSHIFT)) > UINT_MAX)) { (sbp->sb_rblocks << (sbp->sb_blocklog - BBSHIFT)) > UINT_MAX)) {
#endif #endif
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: File system is too large to be mounted on this system."); "file system too large to be mounted on this system.");
return XFS_ERROR(E2BIG); return XFS_ERROR(E2BIG);
} }
if (unlikely(sbp->sb_inprogress)) { if (unlikely(sbp->sb_inprogress)) {
cmn_err(CE_WARN, "XFS: file system busy"); xfs_fs_mount_cmn_err(flags, "file system busy");
XFS_ERROR_REPORT("xfs_mount_validate_sb(5)",
XFS_ERRLEVEL_LOW, mp);
return XFS_ERROR(EFSCORRUPTED); return XFS_ERROR(EFSCORRUPTED);
} }
...@@ -323,8 +314,8 @@ xfs_mount_validate_sb( ...@@ -323,8 +314,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))) {
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: Attempted to mount file system using version 1 directory format"); "file system using version 1 directory format");
return XFS_ERROR(ENOSYS); return XFS_ERROR(ENOSYS);
} }
...@@ -332,11 +323,11 @@ xfs_mount_validate_sb( ...@@ -332,11 +323,11 @@ 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)) {
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: Attempted to mount file system with blocksize %d bytes", "file system with blocksize %d bytes",
sbp->sb_blocksize); sbp->sb_blocksize);
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: Only page-sized (%ld) or less blocksizes currently work.", "only pagesize (%ld) or less will currently work.",
PAGE_SIZE); PAGE_SIZE);
return XFS_ERROR(ENOSYS); return XFS_ERROR(ENOSYS);
} }
...@@ -484,7 +475,7 @@ xfs_xlatesb( ...@@ -484,7 +475,7 @@ xfs_xlatesb(
* Does the initial read of the superblock. * Does the initial read of the superblock.
*/ */
int int
xfs_readsb(xfs_mount_t *mp) xfs_readsb(xfs_mount_t *mp, int flags)
{ {
unsigned int sector_size; unsigned int sector_size;
unsigned int extra_flags; unsigned int extra_flags;
...@@ -506,7 +497,7 @@ xfs_readsb(xfs_mount_t *mp) ...@@ -506,7 +497,7 @@ xfs_readsb(xfs_mount_t *mp)
bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR, bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR,
BTOBB(sector_size), extra_flags); BTOBB(sector_size), extra_flags);
if (!bp || XFS_BUF_ISERROR(bp)) { if (!bp || XFS_BUF_ISERROR(bp)) {
cmn_err(CE_WARN, "XFS: SB read failed"); xfs_fs_mount_cmn_err(flags, "SB read failed");
error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM; error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM;
goto fail; goto fail;
} }
...@@ -520,9 +511,9 @@ xfs_readsb(xfs_mount_t *mp) ...@@ -520,9 +511,9 @@ xfs_readsb(xfs_mount_t *mp)
sbp = XFS_BUF_TO_SBP(bp); sbp = XFS_BUF_TO_SBP(bp);
xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1, XFS_SB_ALL_BITS); xfs_xlatesb(XFS_BUF_PTR(bp), &(mp->m_sb), 1, XFS_SB_ALL_BITS);
error = xfs_mount_validate_sb(mp, &(mp->m_sb)); error = xfs_mount_validate_sb(mp, &(mp->m_sb), flags);
if (error) { if (error) {
cmn_err(CE_WARN, "XFS: SB validate failed"); xfs_fs_mount_cmn_err(flags, "SB validate failed");
goto fail; goto fail;
} }
...@@ -530,8 +521,8 @@ xfs_readsb(xfs_mount_t *mp) ...@@ -530,8 +521,8 @@ xfs_readsb(xfs_mount_t *mp)
* 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) {
cmn_err(CE_WARN, xfs_fs_mount_cmn_err(flags,
"XFS: device supports only %u byte sectors (not %u)", "device supports only %u byte sectors (not %u)",
sector_size, mp->m_sb.sb_sectsize); sector_size, mp->m_sb.sb_sectsize);
error = ENOSYS; error = ENOSYS;
goto fail; goto fail;
...@@ -548,7 +539,7 @@ xfs_readsb(xfs_mount_t *mp) ...@@ -548,7 +539,7 @@ xfs_readsb(xfs_mount_t *mp)
bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR, bp = xfs_buf_read_flags(mp->m_ddev_targp, XFS_SB_DADDR,
BTOBB(sector_size), extra_flags); BTOBB(sector_size), extra_flags);
if (!bp || XFS_BUF_ISERROR(bp)) { if (!bp || XFS_BUF_ISERROR(bp)) {
cmn_err(CE_WARN, "XFS: SB re-read failed"); xfs_fs_mount_cmn_err(flags, "SB re-read failed");
error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM; error = bp ? XFS_BUF_GETERROR(bp) : ENOMEM;
goto fail; goto fail;
} }
...@@ -678,7 +669,7 @@ xfs_mountfs( ...@@ -678,7 +669,7 @@ xfs_mountfs(
int error = 0; int error = 0;
if (mp->m_sb_bp == NULL) { if (mp->m_sb_bp == NULL) {
if ((error = xfs_readsb(mp))) { if ((error = xfs_readsb(mp, mfsi_flags))) {
return error; return error;
} }
} }
......
...@@ -510,9 +510,12 @@ xfs_preferred_iosize(xfs_mount_t *mp) ...@@ -510,9 +510,12 @@ xfs_preferred_iosize(xfs_mount_t *mp)
*/ */
#define XFS_MFSI_SECOND 0x01 /* Secondary mount -- skip stuff */ #define XFS_MFSI_SECOND 0x01 /* Secondary mount -- skip stuff */
#define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */ #define XFS_MFSI_CLIENT 0x02 /* Is a client -- skip lots of stuff */
/* XFS_MFSI_RRINODES */
#define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */ #define XFS_MFSI_NOUNLINK 0x08 /* Skip unlinked inode processing in */
/* log recovery */ /* log recovery */
#define XFS_MFSI_NO_QUOTACHECK 0x10 /* Skip quotacheck processing */ #define XFS_MFSI_NO_QUOTACHECK 0x10 /* Skip quotacheck processing */
/* XFS_MFSI_CONVERT_SUNIT */
#define XFS_MFSI_QUIET 0x40 /* Be silent if mount errors found */
/* /*
* Macros for getting from mount to vfs and back. * Macros for getting from mount to vfs and back.
...@@ -581,7 +584,7 @@ extern int xfs_mod_incore_sb_unlocked(xfs_mount_t *, xfs_sb_field_t, ...@@ -581,7 +584,7 @@ extern int xfs_mod_incore_sb_unlocked(xfs_mount_t *, xfs_sb_field_t,
extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *, extern int xfs_mod_incore_sb_batch(xfs_mount_t *, xfs_mod_sb_t *,
uint, int); uint, int);
extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int); extern struct xfs_buf *xfs_getsb(xfs_mount_t *, int);
extern int xfs_readsb(xfs_mount_t *mp); extern int xfs_readsb(xfs_mount_t *, int);
extern void xfs_freesb(xfs_mount_t *); extern void xfs_freesb(xfs_mount_t *);
extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int); extern void xfs_do_force_shutdown(bhv_desc_t *, int, char *, int);
extern int xfs_syncsub(xfs_mount_t *, int, int, int *); extern int xfs_syncsub(xfs_mount_t *, int, int, int *);
......
...@@ -442,6 +442,9 @@ xfs_mount( ...@@ -442,6 +442,9 @@ xfs_mount(
p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO); p = vfs_bhv_lookup(vfsp, VFS_POSITION_IO);
mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs; mp->m_io_ops = p ? *(xfs_ioops_t *) vfs_bhv_custom(p) : xfs_iocore_xfs;
if (args->flags & XFSMNT_QUIET)
flags |= XFS_MFSI_QUIET;
/* /*
* Open real time and log devices - order is important. * Open real time and log devices - order is important.
*/ */
...@@ -492,7 +495,7 @@ xfs_mount( ...@@ -492,7 +495,7 @@ xfs_mount(
error = xfs_start_flags(vfsp, args, mp); error = xfs_start_flags(vfsp, args, mp);
if (error) if (error)
goto error1; goto error1;
error = xfs_readsb(mp); error = xfs_readsb(mp, flags);
if (error) if (error)
goto error1; goto error1;
error = xfs_finish_flags(vfsp, args, mp); error = xfs_finish_flags(vfsp, args, mp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment