aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@infradead.org>2007-08-30 03:21:12 -0400
committerTim Shimmin <tes@chook.melbourne.sgi.com>2007-10-15 21:45:57 -0400
commitbd186aa901c183d6e25257711b6c64b42a90dde0 (patch)
treea84157145a249923a79276d7bc9170701b100c43 /fs/xfs
parent0ce4cfd4f7dde5891d5b3e3c1a28ff7a7b4d36b3 (diff)
[XFS] kill the vfs_flags member in struct bhv_vfs
All flags are added to xfs_mount's m_flag instead. Note that the 32bit inode flag was duplicated in both of them, but only cleared in the mount when it was not nessecary due to the filesystem beeing small enough. Two flags are still required here - one to indicate the mount option setting, and one to indicate if it applies or not. SGI-PV: 969608 SGI-Modid: xfs-linux-melb:xfs-kern:29507a Signed-off-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: David Chinner <dgc@sgi.com> Signed-off-by: Tim Shimmin <tes@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/linux-2.6/xfs_export.c4
-rw-r--r--fs/xfs/linux-2.6/xfs_file.c14
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c5
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.c3
-rw-r--r--fs/xfs/linux-2.6/xfs_vfs.h8
-rw-r--r--fs/xfs/quota/xfs_qm.c3
-rw-r--r--fs/xfs/quota/xfs_qm_syscalls.c16
-rw-r--r--fs/xfs/xfs_dmapi.h2
-rw-r--r--fs/xfs/xfs_inode.c2
-rw-r--r--fs/xfs/xfs_inode.h5
-rw-r--r--fs/xfs/xfs_log.c13
-rw-r--r--fs/xfs/xfs_mount.c8
-rw-r--r--fs/xfs/xfs_mount.h8
-rw-r--r--fs/xfs/xfs_qmops.c2
-rw-r--r--fs/xfs/xfs_vfsops.c36
-rw-r--r--fs/xfs/xfs_vnodeops.c6
16 files changed, 59 insertions, 76 deletions
diff --git a/fs/xfs/linux-2.6/xfs_export.c b/fs/xfs/linux-2.6/xfs_export.c
index 4ed28a6767bb..726449d4fd22 100644
--- a/fs/xfs/linux-2.6/xfs_export.c
+++ b/fs/xfs/linux-2.6/xfs_export.c
@@ -102,9 +102,7 @@ xfs_fs_encode_fh(
102 int len; 102 int len;
103 int is64 = 0; 103 int is64 = 0;
104#if XFS_BIG_INUMS 104#if XFS_BIG_INUMS
105 bhv_vfs_t *vfs = vfs_from_sb(inode->i_sb); 105 if (!(XFS_M(inode->i_sb)->m_flags & XFS_MOUNT_SMALL_INUMS)) {
106
107 if (!(vfs->vfs_flag & VFS_32BITINODES)) {
108 /* filesystem may contain 64bit inode numbers */ 106 /* filesystem may contain 64bit inode numbers */
109 is64 = XFS_FILEID_TYPE_64FLAG; 107 is64 = XFS_FILEID_TYPE_64FLAG;
110 } 108 }
diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c
index 123659e74b53..fb8dd34041eb 100644
--- a/fs/xfs/linux-2.6/xfs_file.c
+++ b/fs/xfs/linux-2.6/xfs_file.c
@@ -259,7 +259,7 @@ xfs_file_mmap(
259 vma->vm_flags |= VM_CAN_NONLINEAR; 259 vma->vm_flags |= VM_CAN_NONLINEAR;
260 260
261#ifdef CONFIG_XFS_DMAPI 261#ifdef CONFIG_XFS_DMAPI
262 if (vfs_from_sb(filp->f_path.dentry->d_inode->i_sb)->vfs_flag & VFS_DMI) 262 if (XFS_M(filp->f_path.dentry->d_inode->i_sb)->m_flags & XFS_MOUNT_DMAPI)
263 vma->vm_ops = &xfs_dmapi_file_vm_ops; 263 vma->vm_ops = &xfs_dmapi_file_vm_ops;
264#endif /* CONFIG_XFS_DMAPI */ 264#endif /* CONFIG_XFS_DMAPI */
265 265
@@ -317,13 +317,13 @@ xfs_vm_mprotect(
317 unsigned int newflags) 317 unsigned int newflags)
318{ 318{
319 struct inode *inode = vma->vm_file->f_path.dentry->d_inode; 319 struct inode *inode = vma->vm_file->f_path.dentry->d_inode;
320 bhv_vfs_t *vfsp = vfs_from_sb(inode->i_sb); 320 struct xfs_mount *mp = XFS_M(inode->i_sb);
321 int error = 0; 321 int error = 0;
322 322
323 if (vfsp->vfs_flag & VFS_DMI) { 323 if (mp->m_flags & XFS_MOUNT_DMAPI) {
324 if ((vma->vm_flags & VM_MAYSHARE) && 324 if ((vma->vm_flags & VM_MAYSHARE) &&
325 (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE)) 325 (newflags & VM_WRITE) && !(vma->vm_flags & VM_WRITE))
326 error = XFS_SEND_MMAP(XFS_VFSTOM(vfsp), vma, VM_WRITE); 326 error = XFS_SEND_MMAP(mp, vma, VM_WRITE);
327 } 327 }
328 return error; 328 return error;
329} 329}
@@ -340,13 +340,13 @@ STATIC int
340xfs_file_open_exec( 340xfs_file_open_exec(
341 struct inode *inode) 341 struct inode *inode)
342{ 342{
343 bhv_vfs_t *vfsp = vfs_from_sb(inode->i_sb); 343 struct xfs_mount *mp = XFS_M(inode->i_sb);
344 344
345 if (unlikely(vfsp->vfs_flag & VFS_DMI)) { 345 if (unlikely(mp->m_flags & XFS_MOUNT_DMAPI)) {
346 if (DM_EVENT_ENABLED(XFS_I(inode), DM_EVENT_READ)) { 346 if (DM_EVENT_ENABLED(XFS_I(inode), DM_EVENT_READ)) {
347 bhv_vnode_t *vp = vn_from_inode(inode); 347 bhv_vnode_t *vp = vn_from_inode(inode);
348 348
349 return -XFS_SEND_DATA(XFS_VFSTOM(vfsp), DM_EVENT_READ, 349 return -XFS_SEND_DATA(mp, DM_EVENT_READ,
350 vp, 0, 0, 0, NULL); 350 vp, 0, 0, 0, NULL);
351 } 351 }
352 } 352 }
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index 24bc0afb003c..e275b7a82bc1 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -534,7 +534,7 @@ vfs_sync_worker(
534{ 534{
535 int error; 535 int error;
536 536
537 if (!(vfsp->vfs_flag & VFS_RDONLY)) 537 if (!(XFS_VFSTOM(vfsp)->m_flags & XFS_MOUNT_RDONLY))
538 error = xfs_sync(XFS_VFSTOM(vfsp), SYNC_FSDATA | SYNC_BDFLUSH | \ 538 error = xfs_sync(XFS_VFSTOM(vfsp), SYNC_FSDATA | SYNC_BDFLUSH | \
539 SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER); 539 SYNC_ATTR | SYNC_REFCACHE | SYNC_SUPER);
540 vfsp->vfs_sync_seq++; 540 vfsp->vfs_sync_seq++;
@@ -793,6 +793,9 @@ xfs_fs_fill_super(
793 mp->m_vfsp = vfsp; 793 mp->m_vfsp = vfsp;
794 vfsp->vfs_mount = mp; 794 vfsp->vfs_mount = mp;
795 795
796 if (sb->s_flags & MS_RDONLY)
797 mp->m_flags |= XFS_MOUNT_RDONLY;
798
796 error = xfs_parseargs(mp, (char *)data, args, 0); 799 error = xfs_parseargs(mp, (char *)data, args, 0);
797 if (error) 800 if (error)
798 goto fail_vfsop; 801 goto fail_vfsop;
diff --git a/fs/xfs/linux-2.6/xfs_vfs.c b/fs/xfs/linux-2.6/xfs_vfs.c
index 573e52a24072..b098e0903353 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.c
+++ b/fs/xfs/linux-2.6/xfs_vfs.c
@@ -211,9 +211,6 @@ vfs_allocate(
211 vfsp->vfs_super = sb; 211 vfsp->vfs_super = sb;
212 sb->s_fs_info = vfsp; 212 sb->s_fs_info = vfsp;
213 213
214 if (sb->s_flags & MS_RDONLY)
215 vfsp->vfs_flag |= VFS_RDONLY;
216
217 return vfsp; 214 return vfsp;
218} 215}
219 216
diff --git a/fs/xfs/linux-2.6/xfs_vfs.h b/fs/xfs/linux-2.6/xfs_vfs.h
index 943f581bdb47..5c4996356226 100644
--- a/fs/xfs/linux-2.6/xfs_vfs.h
+++ b/fs/xfs/linux-2.6/xfs_vfs.h
@@ -43,7 +43,6 @@ typedef struct bhv_vfs_sync_work {
43 43
44typedef struct bhv_vfs { 44typedef struct bhv_vfs {
45 struct xfs_mount *vfs_mount; 45 struct xfs_mount *vfs_mount;
46 u_int vfs_flag; /* flags */
47 struct super_block *vfs_super; /* generic superblock pointer */ 46 struct super_block *vfs_super; /* generic superblock pointer */
48 struct task_struct *vfs_sync_task; /* generalised sync thread */ 47 struct task_struct *vfs_sync_task; /* generalised sync thread */
49 bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */ 48 bhv_vfs_sync_work_t vfs_sync_work; /* work item for VFS_SYNC */
@@ -53,13 +52,6 @@ typedef struct bhv_vfs {
53 wait_queue_head_t vfs_wait_single_sync_task; 52 wait_queue_head_t vfs_wait_single_sync_task;
54} bhv_vfs_t; 53} bhv_vfs_t;
55 54
56#define VFS_RDONLY 0x0001 /* read-only vfs */
57#define VFS_GRPID 0x0002 /* group-ID assigned from directory */
58#define VFS_DMI 0x0004 /* filesystem has the DMI enabled */
59/* ---- VFS_UMOUNT ---- 0x0008 -- unneeded, fixed via kthread APIs */
60#define VFS_32BITINODES 0x0010 /* do not use inums above 32 bits */
61#define VFS_END 0x0010 /* max flag */
62
63#define SYNC_ATTR 0x0001 /* sync attributes */ 55#define SYNC_ATTR 0x0001 /* sync attributes */
64#define SYNC_CLOSE 0x0002 /* close file system down */ 56#define SYNC_CLOSE 0x0002 /* close file system down */
65#define SYNC_DELWRI 0x0004 /* look at delayed writes */ 57#define SYNC_DELWRI 0x0004 /* look at delayed writes */
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c
index 8f5a43669297..b5f91281b707 100644
--- a/fs/xfs/quota/xfs_qm.c
+++ b/fs/xfs/quota/xfs_qm.c
@@ -2417,8 +2417,7 @@ xfs_qm_vop_dqalloc(
2417 lockflags = XFS_ILOCK_EXCL; 2417 lockflags = XFS_ILOCK_EXCL;
2418 xfs_ilock(ip, lockflags); 2418 xfs_ilock(ip, lockflags);
2419 2419
2420 if ((flags & XFS_QMOPT_INHERIT) && 2420 if ((flags & XFS_QMOPT_INHERIT) && XFS_INHERIT_GID(ip))
2421 XFS_INHERIT_GID(ip, XFS_MTOVFS(mp)))
2422 gid = ip->i_d.di_gid; 2421 gid = ip->i_d.di_gid;
2423 2422
2424 /* 2423 /*
diff --git a/fs/xfs/quota/xfs_qm_syscalls.c b/fs/xfs/quota/xfs_qm_syscalls.c
index e0d024e73453..ad5579d4eac4 100644
--- a/fs/xfs/quota/xfs_qm_syscalls.c
+++ b/fs/xfs/quota/xfs_qm_syscalls.c
@@ -86,10 +86,8 @@ xfs_qm_quotactl(
86 int id, 86 int id,
87 xfs_caddr_t addr) 87 xfs_caddr_t addr)
88{ 88{
89 bhv_vfs_t *vfsp = XFS_MTOVFS(mp);
90 int error; 89 int error;
91 90
92
93 ASSERT(addr != NULL || cmd == Q_XQUOTASYNC); 91 ASSERT(addr != NULL || cmd == Q_XQUOTASYNC);
94 92
95 /* 93 /*
@@ -102,7 +100,7 @@ xfs_qm_quotactl(
102 */ 100 */
103 if (XFS_IS_QUOTA_ON(mp)) 101 if (XFS_IS_QUOTA_ON(mp))
104 return XFS_ERROR(EINVAL); 102 return XFS_ERROR(EINVAL);
105 if (vfsp->vfs_flag & VFS_RDONLY) 103 if (mp->m_flags & XFS_MOUNT_RDONLY)
106 return XFS_ERROR(EROFS); 104 return XFS_ERROR(EROFS);
107 return (xfs_qm_scall_trunc_qfiles(mp, 105 return (xfs_qm_scall_trunc_qfiles(mp,
108 xfs_qm_import_qtype_flags(*(uint *)addr))); 106 xfs_qm_import_qtype_flags(*(uint *)addr)));
@@ -118,13 +116,13 @@ xfs_qm_quotactl(
118 * QUOTAON - enabling quota enforcement. 116 * QUOTAON - enabling quota enforcement.
119 * Quota accounting must be turned on at mount time. 117 * Quota accounting must be turned on at mount time.
120 */ 118 */
121 if (vfsp->vfs_flag & VFS_RDONLY) 119 if (mp->m_flags & XFS_MOUNT_RDONLY)
122 return XFS_ERROR(EROFS); 120 return XFS_ERROR(EROFS);
123 return (xfs_qm_scall_quotaon(mp, 121 return (xfs_qm_scall_quotaon(mp,
124 xfs_qm_import_flags(*(uint *)addr))); 122 xfs_qm_import_flags(*(uint *)addr)));
125 123
126 case Q_XQUOTAOFF: 124 case Q_XQUOTAOFF:
127 if (vfsp->vfs_flag & VFS_RDONLY) 125 if (mp->m_flags & XFS_MOUNT_RDONLY)
128 return XFS_ERROR(EROFS); 126 return XFS_ERROR(EROFS);
129 break; 127 break;
130 128
@@ -140,7 +138,7 @@ xfs_qm_quotactl(
140 138
141 switch (cmd) { 139 switch (cmd) {
142 case Q_XQUOTAOFF: 140 case Q_XQUOTAOFF:
143 if (vfsp->vfs_flag & VFS_RDONLY) 141 if (mp->m_flags & XFS_MOUNT_RDONLY)
144 return XFS_ERROR(EROFS); 142 return XFS_ERROR(EROFS);
145 error = xfs_qm_scall_quotaoff(mp, 143 error = xfs_qm_scall_quotaoff(mp,
146 xfs_qm_import_flags(*(uint *)addr), 144 xfs_qm_import_flags(*(uint *)addr),
@@ -161,19 +159,19 @@ xfs_qm_quotactl(
161 break; 159 break;
162 160
163 case Q_XSETQLIM: 161 case Q_XSETQLIM:
164 if (vfsp->vfs_flag & VFS_RDONLY) 162 if (mp->m_flags & XFS_MOUNT_RDONLY)
165 return XFS_ERROR(EROFS); 163 return XFS_ERROR(EROFS);
166 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER, 164 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_USER,
167 (fs_disk_quota_t *)addr); 165 (fs_disk_quota_t *)addr);
168 break; 166 break;
169 case Q_XSETGQLIM: 167 case Q_XSETGQLIM:
170 if (vfsp->vfs_flag & VFS_RDONLY) 168 if (mp->m_flags & XFS_MOUNT_RDONLY)
171 return XFS_ERROR(EROFS); 169 return XFS_ERROR(EROFS);
172 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP, 170 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_GROUP,
173 (fs_disk_quota_t *)addr); 171 (fs_disk_quota_t *)addr);
174 break; 172 break;
175 case Q_XSETPQLIM: 173 case Q_XSETPQLIM:
176 if (vfsp->vfs_flag & VFS_RDONLY) 174 if (mp->m_flags & XFS_MOUNT_RDONLY)
177 return XFS_ERROR(EROFS); 175 return XFS_ERROR(EROFS);
178 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ, 176 error = xfs_qm_scall_setqlim(mp, (xfs_dqid_t)id, XFS_DQ_PROJ,
179 (fs_disk_quota_t *)addr); 177 (fs_disk_quota_t *)addr);
diff --git a/fs/xfs/xfs_dmapi.h b/fs/xfs/xfs_dmapi.h
index 029f96d7d3a0..f71784ab6a60 100644
--- a/fs/xfs/xfs_dmapi.h
+++ b/fs/xfs/xfs_dmapi.h
@@ -69,7 +69,7 @@ typedef enum {
69/* Defines for determining if an event message should be sent. */ 69/* Defines for determining if an event message should be sent. */
70#ifdef HAVE_DMAPI 70#ifdef HAVE_DMAPI
71#define DM_EVENT_ENABLED(ip, event) ( \ 71#define DM_EVENT_ENABLED(ip, event) ( \
72 unlikely (XFS_MTOVFS((ip)->i_mount)->vfs_flag & VFS_DMI) && \ 72 unlikely ((ip)->i_mount->m_flags & XFS_MOUNT_DMAPI) && \
73 ( ((ip)->i_d.di_dmevmask & (1 << event)) || \ 73 ( ((ip)->i_d.di_dmevmask & (1 << event)) || \
74 ((ip)->i_mount->m_dmevmask & (1 << event)) ) \ 74 ((ip)->i_mount->m_dmevmask & (1 << event)) ) \
75 ) 75 )
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index 0c376bd9e173..3d8ba8fec191 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -1158,7 +1158,7 @@ xfs_ialloc(
1158 if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1)) 1158 if ((prid != 0) && (ip->i_d.di_version == XFS_DINODE_VERSION_1))
1159 xfs_bump_ino_vers2(tp, ip); 1159 xfs_bump_ino_vers2(tp, ip);
1160 1160
1161 if (pip && XFS_INHERIT_GID(pip, XFS_MTOVFS(pip->i_mount))) { 1161 if (pip && XFS_INHERIT_GID(pip)) {
1162 ip->i_d.di_gid = pip->i_d.di_gid; 1162 ip->i_d.di_gid = pip->i_d.di_gid;
1163 if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) { 1163 if ((pip->i_d.di_mode & S_ISGID) && (mode & S_IFMT) == S_IFDIR) {
1164 ip->i_d.di_mode |= S_ISGID; 1164 ip->i_d.di_mode |= S_ISGID;
diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
index 10eaee77379f..e5aff929cc65 100644
--- a/fs/xfs/xfs_inode.h
+++ b/fs/xfs/xfs_inode.h
@@ -492,8 +492,9 @@ xfs_iflags_test_and_clear(xfs_inode_t *ip, unsigned short flags)
492 * directory, group of new file is set to that of the parent, and 492 * directory, group of new file is set to that of the parent, and
493 * new subdirectory gets S_ISGID bit from parent. 493 * new subdirectory gets S_ISGID bit from parent.
494 */ 494 */
495#define XFS_INHERIT_GID(pip, vfsp) \ 495#define XFS_INHERIT_GID(pip) \
496 (((vfsp)->vfs_flag & VFS_GRPID) || ((pip)->i_d.di_mode & S_ISGID)) 496 (((pip)->i_mount->m_flags & XFS_MOUNT_GRPID) || \
497 ((pip)->i_d.di_mode & S_ISGID))
497 498
498/* 499/*
499 * Flags for xfs_iget() 500 * Flags for xfs_iget()
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 4f4d20b2721c..d170fffd7402 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -486,7 +486,7 @@ xfs_log_mount(xfs_mount_t *mp,
486 cmn_err(CE_NOTE, 486 cmn_err(CE_NOTE,
487 "!Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent.", 487 "!Mounting filesystem \"%s\" in no-recovery mode. Filesystem will be inconsistent.",
488 mp->m_fsname); 488 mp->m_fsname);
489 ASSERT(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY); 489 ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
490 } 490 }
491 491
492 mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks); 492 mp->m_log = xlog_alloc_log(mp, log_target, blk_offset, num_bblks);
@@ -496,16 +496,15 @@ xfs_log_mount(xfs_mount_t *mp,
496 * just worked. 496 * just worked.
497 */ 497 */
498 if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) { 498 if (!(mp->m_flags & XFS_MOUNT_NORECOVERY)) {
499 bhv_vfs_t *vfsp = XFS_MTOVFS(mp); 499 int error, readonly = (mp->m_flags & XFS_MOUNT_RDONLY);
500 int error, readonly = (vfsp->vfs_flag & VFS_RDONLY);
501 500
502 if (readonly) 501 if (readonly)
503 vfsp->vfs_flag &= ~VFS_RDONLY; 502 mp->m_flags &= ~XFS_MOUNT_RDONLY;
504 503
505 error = xlog_recover(mp->m_log); 504 error = xlog_recover(mp->m_log);
506 505
507 if (readonly) 506 if (readonly)
508 vfsp->vfs_flag |= VFS_RDONLY; 507 mp->m_flags |= XFS_MOUNT_RDONLY;
509 if (error) { 508 if (error) {
510 cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error); 509 cmn_err(CE_WARN, "XFS: log mount/recovery failed: error %d", error);
511 xlog_dealloc_log(mp->m_log); 510 xlog_dealloc_log(mp->m_log);
@@ -537,7 +536,7 @@ xfs_log_mount_finish(xfs_mount_t *mp, int mfsi_flags)
537 error = xlog_recover_finish(mp->m_log, mfsi_flags); 536 error = xlog_recover_finish(mp->m_log, mfsi_flags);
538 else { 537 else {
539 error = 0; 538 error = 0;
540 ASSERT(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY); 539 ASSERT(mp->m_flags & XFS_MOUNT_RDONLY);
541 } 540 }
542 541
543 return error; 542 return error;
@@ -597,7 +596,7 @@ xfs_log_unmount_write(xfs_mount_t *mp)
597 * Don't write out unmount record on read-only mounts. 596 * Don't write out unmount record on read-only mounts.
598 * Or, if we are doing a forced umount (typically because of IO errors). 597 * Or, if we are doing a forced umount (typically because of IO errors).
599 */ 598 */
600 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 599 if (mp->m_flags & XFS_MOUNT_RDONLY)
601 return 0; 600 return 0;
602 601
603 xfs_log_force(mp, 0, XFS_LOG_FORCE|XFS_LOG_SYNC); 602 xfs_log_force(mp, 0, XFS_LOG_FORCE|XFS_LOG_SYNC);
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c
index 87bc9280b786..6b1aa7d6f434 100644
--- a/fs/xfs/xfs_mount.c
+++ b/fs/xfs/xfs_mount.c
@@ -359,7 +359,7 @@ xfs_initialize_perag(
359 /* Clear the mount flag if no inode can overflow 32 bits 359 /* Clear the mount flag if no inode can overflow 32 bits
360 * on this filesystem, or if specifically requested.. 360 * on this filesystem, or if specifically requested..
361 */ 361 */
362 if ((vfs->vfs_flag & VFS_32BITINODES) && ino > max_inum) { 362 if ((mp->m_flags & XFS_MOUNT_SMALL_INUMS) && ino > max_inum) {
363 mp->m_flags |= XFS_MOUNT_32BITINODES; 363 mp->m_flags |= XFS_MOUNT_32BITINODES;
364 } else { 364 } else {
365 mp->m_flags &= ~XFS_MOUNT_32BITINODES; 365 mp->m_flags &= ~XFS_MOUNT_32BITINODES;
@@ -1116,7 +1116,7 @@ xfs_mountfs(
1116 * If fs is not mounted readonly, then update the superblock 1116 * If fs is not mounted readonly, then update the superblock
1117 * unit and width changes. 1117 * unit and width changes.
1118 */ 1118 */
1119 if (update_flags && !(vfsp->vfs_flag & VFS_RDONLY)) 1119 if (update_flags && !(mp->m_flags & XFS_MOUNT_RDONLY))
1120 xfs_mount_log_sbunit(mp, update_flags); 1120 xfs_mount_log_sbunit(mp, update_flags);
1121 1121
1122 /* 1122 /*
@@ -1289,7 +1289,7 @@ xfs_fs_writable(xfs_mount_t *mp)
1289 bhv_vfs_t *vfsp = XFS_MTOVFS(mp); 1289 bhv_vfs_t *vfsp = XFS_MTOVFS(mp);
1290 1290
1291 return !(vfs_test_for_freeze(vfsp) || XFS_FORCED_SHUTDOWN(mp) || 1291 return !(vfs_test_for_freeze(vfsp) || XFS_FORCED_SHUTDOWN(mp) ||
1292 (vfsp->vfs_flag & VFS_RDONLY)); 1292 (mp->m_flags & XFS_MOUNT_RDONLY));
1293} 1293}
1294 1294
1295/* 1295/*
@@ -1367,7 +1367,7 @@ xfs_unmountfs_writesb(xfs_mount_t *mp)
1367 * skip superblock write if fs is read-only, or 1367 * skip superblock write if fs is read-only, or
1368 * if we are doing a forced umount. 1368 * if we are doing a forced umount.
1369 */ 1369 */
1370 if (!(XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY || 1370 if (!((mp->m_flags & XFS_MOUNT_RDONLY) ||
1371 XFS_FORCED_SHUTDOWN(mp))) { 1371 XFS_FORCED_SHUTDOWN(mp))) {
1372 1372
1373 sbp = xfs_getsb(mp, 0); 1373 sbp = xfs_getsb(mp, 0);
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h
index 8fefad022ae6..f37060bcde53 100644
--- a/fs/xfs/xfs_mount.h
+++ b/fs/xfs/xfs_mount.h
@@ -442,7 +442,7 @@ typedef struct xfs_mount {
442 must be synchronous except 442 must be synchronous except
443 for space allocations */ 443 for space allocations */
444#define XFS_MOUNT_INO64 (1ULL << 1) 444#define XFS_MOUNT_INO64 (1ULL << 1)
445 /* (1ULL << 2) -- currently unused */ 445#define XFS_MOUNT_DMAPI (1ULL << 2) /* dmapi is enabled */
446#define XFS_MOUNT_WAS_CLEAN (1ULL << 3) 446#define XFS_MOUNT_WAS_CLEAN (1ULL << 3)
447#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesystem 447#define XFS_MOUNT_FS_SHUTDOWN (1ULL << 4) /* atomic stop of all filesystem
448 operations, typically for 448 operations, typically for
@@ -452,7 +452,7 @@ typedef struct xfs_mount {
452#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment 452#define XFS_MOUNT_NOALIGN (1ULL << 7) /* turn off stripe alignment
453 allocations */ 453 allocations */
454#define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */ 454#define XFS_MOUNT_ATTR2 (1ULL << 8) /* allow use of attr2 format */
455 /* (1ULL << 9) -- currently unused */ 455#define XFS_MOUNT_GRPID (1ULL << 9) /* group-ID assigned from directory */
456#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */ 456#define XFS_MOUNT_NORECOVERY (1ULL << 10) /* no recovery - dirty fs */
457#define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */ 457#define XFS_MOUNT_SHARED (1ULL << 11) /* shared mount */
458#define XFS_MOUNT_DFLT_IOSIZE (1ULL << 12) /* set default i/o size */ 458#define XFS_MOUNT_DFLT_IOSIZE (1ULL << 12) /* set default i/o size */
@@ -460,13 +460,13 @@ typedef struct xfs_mount {
460 /* osyncisdsync is now default*/ 460 /* osyncisdsync is now default*/
461#define XFS_MOUNT_32BITINODES (1ULL << 14) /* do not create inodes above 461#define XFS_MOUNT_32BITINODES (1ULL << 14) /* do not create inodes above
462 * 32 bits in size */ 462 * 32 bits in size */
463 /* (1ULL << 15) -- currently unused */ 463#define XFS_MOUNT_SMALL_INUMS (1ULL << 15) /* users wants 32bit inodes */
464#define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */ 464#define XFS_MOUNT_NOUUID (1ULL << 16) /* ignore uuid during mount */
465#define XFS_MOUNT_BARRIER (1ULL << 17) 465#define XFS_MOUNT_BARRIER (1ULL << 17)
466#define XFS_MOUNT_IDELETE (1ULL << 18) /* delete empty inode clusters*/ 466#define XFS_MOUNT_IDELETE (1ULL << 18) /* delete empty inode clusters*/
467#define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width 467#define XFS_MOUNT_SWALLOC (1ULL << 19) /* turn on stripe width
468 * allocation */ 468 * allocation */
469 /* (1ULL << 20) -- currently unused */ 469#define XFS_MOUNT_RDONLY (1ULL << 20) /* read-only fs */
470#define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */ 470#define XFS_MOUNT_DIRSYNC (1ULL << 21) /* synchronous directory ops */
471#define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report large preferred 471#define XFS_MOUNT_COMPAT_IOSIZE (1ULL << 22) /* don't report large preferred
472 * I/O size in stat() */ 472 * I/O size in stat() */
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c
index ea08bd8e8b80..c266a0184b42 100644
--- a/fs/xfs/xfs_qmops.c
+++ b/fs/xfs/xfs_qmops.c
@@ -66,7 +66,7 @@ xfs_mount_reset_sbqflags(xfs_mount_t *mp)
66 * if the fs is readonly, let the incore superblock run 66 * if the fs is readonly, let the incore superblock run
67 * with quotas off but don't flush the update out to disk 67 * with quotas off but don't flush the update out to disk
68 */ 68 */
69 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 69 if (mp->m_flags & XFS_MOUNT_RDONLY)
70 return 0; 70 return 0;
71#ifdef QUOTADEBUG 71#ifdef QUOTADEBUG
72 xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); 72 xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes");
diff --git a/fs/xfs/xfs_vfsops.c b/fs/xfs/xfs_vfsops.c
index 593e6e2b3921..febfd8367e13 100644
--- a/fs/xfs/xfs_vfsops.c
+++ b/fs/xfs/xfs_vfsops.c
@@ -307,7 +307,7 @@ xfs_start_flags(
307 * no recovery flag requires a read-only mount 307 * no recovery flag requires a read-only mount
308 */ 308 */
309 if (ap->flags & XFSMNT_NORECOVERY) { 309 if (ap->flags & XFSMNT_NORECOVERY) {
310 if (!(vfs->vfs_flag & VFS_RDONLY)) { 310 if (!(mp->m_flags & XFS_MOUNT_RDONLY)) {
311 cmn_err(CE_WARN, 311 cmn_err(CE_WARN,
312 "XFS: tried to mount a FS read-write without recovery!"); 312 "XFS: tried to mount a FS read-write without recovery!");
313 return XFS_ERROR(EINVAL); 313 return XFS_ERROR(EINVAL);
@@ -326,7 +326,7 @@ xfs_start_flags(
326 mp->m_flags |= XFS_MOUNT_FILESTREAMS; 326 mp->m_flags |= XFS_MOUNT_FILESTREAMS;
327 327
328 if (ap->flags & XFSMNT_DMAPI) 328 if (ap->flags & XFSMNT_DMAPI)
329 vfs->vfs_flag |= VFS_DMI; 329 mp->m_flags |= XFS_MOUNT_DMAPI;
330 return 0; 330 return 0;
331} 331}
332 332
@@ -340,7 +340,7 @@ xfs_finish_flags(
340 struct xfs_mount_args *ap, 340 struct xfs_mount_args *ap,
341 struct xfs_mount *mp) 341 struct xfs_mount *mp)
342{ 342{
343 int ronly = (vfs->vfs_flag & VFS_RDONLY); 343 int ronly = (mp->m_flags & XFS_MOUNT_RDONLY);
344 344
345 /* Fail a mount where the logbuf is smaller then the log stripe */ 345 /* Fail a mount where the logbuf is smaller then the log stripe */
346 if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) { 346 if (XFS_SB_VERSION_HASLOGV2(&mp->m_sb)) {
@@ -589,7 +589,7 @@ xfs_unmount(
589 rvp = XFS_ITOV(rip); 589 rvp = XFS_ITOV(rip);
590 590
591#ifdef HAVE_DMAPI 591#ifdef HAVE_DMAPI
592 if (vfsp->vfs_flag & VFS_DMI) { 592 if (mp->m_flags & XFS_MOUNT_DMAPI) {
593 error = XFS_SEND_PREUNMOUNT(mp, vfsp, 593 error = XFS_SEND_PREUNMOUNT(mp, vfsp,
594 rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL, 594 rvp, DM_RIGHT_NULL, rvp, DM_RIGHT_NULL,
595 NULL, NULL, 0, 0, 595 NULL, NULL, 0, 0,
@@ -723,22 +723,20 @@ xfs_mntupdate(
723 int *flags, 723 int *flags,
724 struct xfs_mount_args *args) 724 struct xfs_mount_args *args)
725{ 725{
726 struct bhv_vfs *vfsp = XFS_MTOVFS(mp);
727
728 if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */ 726 if (!(*flags & MS_RDONLY)) { /* rw/ro -> rw */
729 if (vfsp->vfs_flag & VFS_RDONLY) 727 if (mp->m_flags & XFS_MOUNT_RDONLY)
730 vfsp->vfs_flag &= ~VFS_RDONLY; 728 mp->m_flags &= ~XFS_MOUNT_RDONLY;
731 if (args->flags & XFSMNT_BARRIER) { 729 if (args->flags & XFSMNT_BARRIER) {
732 mp->m_flags |= XFS_MOUNT_BARRIER; 730 mp->m_flags |= XFS_MOUNT_BARRIER;
733 xfs_mountfs_check_barriers(mp); 731 xfs_mountfs_check_barriers(mp);
734 } else { 732 } else {
735 mp->m_flags &= ~XFS_MOUNT_BARRIER; 733 mp->m_flags &= ~XFS_MOUNT_BARRIER;
736 } 734 }
737 } else if (!(vfsp->vfs_flag & VFS_RDONLY)) { /* rw -> ro */ 735 } else if (!(mp->m_flags & XFS_MOUNT_RDONLY)) { /* rw -> ro */
738 xfs_filestream_flush(mp); 736 xfs_filestream_flush(mp);
739 xfs_sync(mp, SYNC_DATA_QUIESCE); 737 xfs_sync(mp, SYNC_DATA_QUIESCE);
740 xfs_attr_quiesce(mp); 738 xfs_attr_quiesce(mp);
741 vfsp->vfs_flag |= VFS_RDONLY; 739 mp->m_flags |= XFS_MOUNT_RDONLY;
742 } 740 }
743 return 0; 741 return 0;
744} 742}
@@ -1053,7 +1051,7 @@ xfs_sync_inodes(
1053 1051
1054 if (bypassed) 1052 if (bypassed)
1055 *bypassed = 0; 1053 *bypassed = 0;
1056 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 1054 if (mp->m_flags & XFS_MOUNT_RDONLY)
1057 return 0; 1055 return 0;
1058 error = 0; 1056 error = 0;
1059 last_error = 0; 1057 last_error = 0;
@@ -1766,7 +1764,6 @@ xfs_parseargs(
1766 struct xfs_mount_args *args, 1764 struct xfs_mount_args *args,
1767 int update) 1765 int update)
1768{ 1766{
1769 bhv_vfs_t *vfsp = XFS_MTOVFS(mp);
1770 char *this_char, *value, *eov; 1767 char *this_char, *value, *eov;
1771 int dsunit, dswidth, vol_dsunit, vol_dswidth; 1768 int dsunit, dswidth, vol_dsunit, vol_dswidth;
1772 int iosize; 1769 int iosize;
@@ -1859,10 +1856,10 @@ xfs_parseargs(
1859 args->iosizelog = ffs(iosize) - 1; 1856 args->iosizelog = ffs(iosize) - 1;
1860 } else if (!strcmp(this_char, MNTOPT_GRPID) || 1857 } else if (!strcmp(this_char, MNTOPT_GRPID) ||
1861 !strcmp(this_char, MNTOPT_BSDGROUPS)) { 1858 !strcmp(this_char, MNTOPT_BSDGROUPS)) {
1862 vfsp->vfs_flag |= VFS_GRPID; 1859 mp->m_flags |= XFS_MOUNT_GRPID;
1863 } else if (!strcmp(this_char, MNTOPT_NOGRPID) || 1860 } else if (!strcmp(this_char, MNTOPT_NOGRPID) ||
1864 !strcmp(this_char, MNTOPT_SYSVGROUPS)) { 1861 !strcmp(this_char, MNTOPT_SYSVGROUPS)) {
1865 vfsp->vfs_flag &= ~VFS_GRPID; 1862 mp->m_flags &= ~XFS_MOUNT_GRPID;
1866 } else if (!strcmp(this_char, MNTOPT_WSYNC)) { 1863 } else if (!strcmp(this_char, MNTOPT_WSYNC)) {
1867 args->flags |= XFSMNT_WSYNC; 1864 args->flags |= XFSMNT_WSYNC;
1868 } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) { 1865 } else if (!strcmp(this_char, MNTOPT_OSYNCISOSYNC)) {
@@ -1972,7 +1969,7 @@ xfs_parseargs(
1972 } 1969 }
1973 1970
1974 if (args->flags & XFSMNT_NORECOVERY) { 1971 if (args->flags & XFSMNT_NORECOVERY) {
1975 if ((vfsp->vfs_flag & VFS_RDONLY) == 0) { 1972 if ((mp->m_flags & XFS_MOUNT_RDONLY) == 0) {
1976 cmn_err(CE_WARN, 1973 cmn_err(CE_WARN,
1977 "XFS: no-recovery mounts must be read-only."); 1974 "XFS: no-recovery mounts must be read-only.");
1978 return EINVAL; 1975 return EINVAL;
@@ -2025,7 +2022,7 @@ xfs_parseargs(
2025 2022
2026done: 2023done:
2027 if (args->flags & XFSMNT_32BITINODES) 2024 if (args->flags & XFSMNT_32BITINODES)
2028 vfsp->vfs_flag |= VFS_32BITINODES; 2025 mp->m_flags |= XFS_MOUNT_SMALL_INUMS;
2029 if (args->flags2) 2026 if (args->flags2)
2030 args->flags |= XFSMNT_FLAGS2; 2027 args->flags |= XFSMNT_FLAGS2;
2031 return 0; 2028 return 0;
@@ -2051,7 +2048,6 @@ xfs_showargs(
2051 { 0, NULL } 2048 { 0, NULL }
2052 }; 2049 };
2053 struct proc_xfs_info *xfs_infop; 2050 struct proc_xfs_info *xfs_infop;
2054 struct bhv_vfs *vfsp = XFS_MTOVFS(mp);
2055 2051
2056 for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) { 2052 for (xfs_infop = xfs_info; xfs_infop->flag; xfs_infop++) {
2057 if (mp->m_flags & xfs_infop->flag) 2053 if (mp->m_flags & xfs_infop->flag)
@@ -2084,9 +2080,9 @@ xfs_showargs(
2084 if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE)) 2080 if (!(mp->m_flags & XFS_MOUNT_COMPAT_IOSIZE))
2085 seq_printf(m, "," MNTOPT_LARGEIO); 2081 seq_printf(m, "," MNTOPT_LARGEIO);
2086 2082
2087 if (!(vfsp->vfs_flag & VFS_32BITINODES)) 2083 if (!(mp->m_flags & XFS_MOUNT_SMALL_INUMS))
2088 seq_printf(m, "," MNTOPT_64BITINODE); 2084 seq_printf(m, "," MNTOPT_64BITINODE);
2089 if (vfsp->vfs_flag & VFS_GRPID) 2085 if (mp->m_flags & XFS_MOUNT_GRPID)
2090 seq_printf(m, "," MNTOPT_GRPID); 2086 seq_printf(m, "," MNTOPT_GRPID);
2091 2087
2092 if (mp->m_qflags & XFS_UQUOTA_ACCT) { 2088 if (mp->m_qflags & XFS_UQUOTA_ACCT) {
@@ -2113,7 +2109,7 @@ xfs_showargs(
2113 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT)) 2109 if (!(mp->m_qflags & XFS_ALL_QUOTA_ACCT))
2114 seq_puts(m, "," MNTOPT_NOQUOTA); 2110 seq_puts(m, "," MNTOPT_NOQUOTA);
2115 2111
2116 if (vfsp->vfs_flag & VFS_DMI) 2112 if (mp->m_flags & XFS_MOUNT_DMAPI)
2117 seq_puts(m, "," MNTOPT_DMAPI); 2113 seq_puts(m, "," MNTOPT_DMAPI);
2118 return 0; 2114 return 0;
2119} 2115}
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c
index 98653793b34a..83cc1cb4089a 100644
--- a/fs/xfs/xfs_vnodeops.c
+++ b/fs/xfs/xfs_vnodeops.c
@@ -230,7 +230,7 @@ xfs_setattr(
230 230
231 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address); 231 vn_trace_entry(ip, __FUNCTION__, (inst_t *)__return_address);
232 232
233 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 233 if (mp->m_flags & XFS_MOUNT_RDONLY)
234 return XFS_ERROR(EROFS); 234 return XFS_ERROR(EROFS);
235 235
236 /* 236 /*
@@ -1515,7 +1515,7 @@ xfs_release(
1515 return 0; 1515 return 0;
1516 1516
1517 /* If this is a read-only mount, don't do this (would generate I/O) */ 1517 /* If this is a read-only mount, don't do this (would generate I/O) */
1518 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 1518 if (mp->m_flags & XFS_MOUNT_RDONLY)
1519 return 0; 1519 return 0;
1520 1520
1521 if (!XFS_FORCED_SHUTDOWN(mp)) { 1521 if (!XFS_FORCED_SHUTDOWN(mp)) {
@@ -1624,7 +1624,7 @@ xfs_inactive(
1624 error = 0; 1624 error = 0;
1625 1625
1626 /* If this is a read-only mount, don't do this (would generate I/O) */ 1626 /* If this is a read-only mount, don't do this (would generate I/O) */
1627 if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) 1627 if (mp->m_flags & XFS_MOUNT_RDONLY)
1628 goto out; 1628 goto out;
1629 1629
1630 if (ip->i_d.di_nlink != 0) { 1630 if (ip->i_d.di_nlink != 0) {