diff options
Diffstat (limited to 'fs/xfs/xfs_qmops.c')
-rw-r--r-- | fs/xfs/xfs_qmops.c | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c index 0d594ed7efef..c266a0184b42 100644 --- a/fs/xfs/xfs_qmops.c +++ b/fs/xfs/xfs_qmops.c | |||
@@ -28,6 +28,8 @@ | |||
28 | #include "xfs_mount.h" | 28 | #include "xfs_mount.h" |
29 | #include "xfs_quota.h" | 29 | #include "xfs_quota.h" |
30 | #include "xfs_error.h" | 30 | #include "xfs_error.h" |
31 | #include "xfs_clnt.h" | ||
32 | |||
31 | 33 | ||
32 | STATIC struct xfs_dquot * | 34 | STATIC struct xfs_dquot * |
33 | xfs_dqvopchown_default( | 35 | xfs_dqvopchown_default( |
@@ -64,7 +66,7 @@ xfs_mount_reset_sbqflags(xfs_mount_t *mp) | |||
64 | * if the fs is readonly, let the incore superblock run | 66 | * if the fs is readonly, let the incore superblock run |
65 | * 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 |
66 | */ | 68 | */ |
67 | if (XFS_MTOVFS(mp)->vfs_flag & VFS_RDONLY) | 69 | if (mp->m_flags & XFS_MOUNT_RDONLY) |
68 | return 0; | 70 | return 0; |
69 | #ifdef QUOTADEBUG | 71 | #ifdef QUOTADEBUG |
70 | xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); | 72 | xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); |
@@ -110,7 +112,7 @@ xfs_noquota_init( | |||
110 | return error; | 112 | return error; |
111 | } | 113 | } |
112 | 114 | ||
113 | xfs_qmops_t xfs_qmcore_stub = { | 115 | static struct xfs_qmops xfs_qmcore_stub = { |
114 | .xfs_qminit = (xfs_qminit_t) xfs_noquota_init, | 116 | .xfs_qminit = (xfs_qminit_t) xfs_noquota_init, |
115 | .xfs_qmdone = (xfs_qmdone_t) fs_noerr, | 117 | .xfs_qmdone = (xfs_qmdone_t) fs_noerr, |
116 | .xfs_qmmount = (xfs_qmmount_t) fs_noerr, | 118 | .xfs_qmmount = (xfs_qmmount_t) fs_noerr, |
@@ -124,4 +126,38 @@ xfs_qmops_t xfs_qmcore_stub = { | |||
124 | .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr, | 126 | .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr, |
125 | .xfs_dqvopchown = xfs_dqvopchown_default, | 127 | .xfs_dqvopchown = xfs_dqvopchown_default, |
126 | .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr, | 128 | .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr, |
129 | .xfs_dqstatvfs = (xfs_dqstatvfs_t) fs_noval, | ||
130 | .xfs_dqsync = (xfs_dqsync_t) fs_noerr, | ||
131 | .xfs_quotactl = (xfs_quotactl_t) fs_nosys, | ||
127 | }; | 132 | }; |
133 | |||
134 | int | ||
135 | xfs_qmops_get(struct xfs_mount *mp, struct xfs_mount_args *args) | ||
136 | { | ||
137 | if (args->flags & (XFSMNT_UQUOTA | XFSMNT_PQUOTA | XFSMNT_GQUOTA)) { | ||
138 | struct xfs_qmops *ops; | ||
139 | |||
140 | ops = symbol_get(xfs_qmcore_xfs); | ||
141 | if (!ops) { | ||
142 | request_module("xfs_quota"); | ||
143 | ops = symbol_get(xfs_qmcore_xfs); | ||
144 | } | ||
145 | |||
146 | if (!ops) { | ||
147 | cmn_err(CE_WARN, "XFS: no quota support available."); | ||
148 | return EINVAL; | ||
149 | } | ||
150 | mp->m_qm_ops = ops; | ||
151 | } else { | ||
152 | mp->m_qm_ops = &xfs_qmcore_stub; | ||
153 | } | ||
154 | |||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | void | ||
159 | xfs_qmops_put(struct xfs_mount *mp) | ||
160 | { | ||
161 | if (mp->m_qm_ops != &xfs_qmcore_stub) | ||
162 | symbol_put(xfs_qmcore_xfs); | ||
163 | } | ||