diff options
author | Christoph Hellwig <hch@lst.de> | 2009-06-08 09:33:32 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@brick.lst.de> | 2009-06-08 09:33:32 -0400 |
commit | 7d095257e321214e4cf359abd131ba1f09c60cba (patch) | |
tree | 3f71e2650651616f8ba168b64a82ab48aedef14c /fs/xfs/xfs_mount.c | |
parent | 0c5e1ce89f1eacc366ec421c0f5f681159479c28 (diff) |
xfs: kill xfs_qmops
Kill the quota ops function vector and replace it with direct calls or
stubs in the CONFIG_XFS_QUOTA=n case.
Make sure we check XFS_IS_QUOTA_RUNNING in the right spots. We can remove
the number of those checks because the XFS_TRANS_DQ_DIRTY flag can't be set
otherwise.
This brings us back closer to the way this code worked in IRIX and earlier
Linux versions, but we keep a lot of the more useful factoring of common
code.
Eventually we should also kill xfs_qm_bhv.c, but that's left for a later
patch.
Reduces the size of the source code by about 250 lines and the size of
XFS module by about 1.5 kilobytes with quotas enabled:
text data bss dec hex filename
615957 2960 3848 622765 980ad fs/xfs/xfs.o
617231 3152 3848 624231 98667 fs/xfs/xfs.o.old
Fallout:
- xfs_qm_dqattach is split into xfs_qm_dqattach_locked which expects
the inode locked and xfs_qm_dqattach which does the locking around it,
thus removing XFS_QMOPT_ILOCKED.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Eric Sandeen <sandeen@sandeen.net>
Diffstat (limited to 'fs/xfs/xfs_mount.c')
-rw-r--r-- | fs/xfs/xfs_mount.c | 103 |
1 files changed, 86 insertions, 17 deletions
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 65a99725d0cc..b659db5e7165 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c | |||
@@ -960,6 +960,53 @@ xfs_check_sizes(xfs_mount_t *mp) | |||
960 | } | 960 | } |
961 | 961 | ||
962 | /* | 962 | /* |
963 | * Clear the quotaflags in memory and in the superblock. | ||
964 | */ | ||
965 | int | ||
966 | xfs_mount_reset_sbqflags( | ||
967 | struct xfs_mount *mp) | ||
968 | { | ||
969 | int error; | ||
970 | struct xfs_trans *tp; | ||
971 | |||
972 | mp->m_qflags = 0; | ||
973 | |||
974 | /* | ||
975 | * It is OK to look at sb_qflags here in mount path, | ||
976 | * without m_sb_lock. | ||
977 | */ | ||
978 | if (mp->m_sb.sb_qflags == 0) | ||
979 | return 0; | ||
980 | spin_lock(&mp->m_sb_lock); | ||
981 | mp->m_sb.sb_qflags = 0; | ||
982 | spin_unlock(&mp->m_sb_lock); | ||
983 | |||
984 | /* | ||
985 | * If the fs is readonly, let the incore superblock run | ||
986 | * with quotas off but don't flush the update out to disk | ||
987 | */ | ||
988 | if (mp->m_flags & XFS_MOUNT_RDONLY) | ||
989 | return 0; | ||
990 | |||
991 | #ifdef QUOTADEBUG | ||
992 | xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); | ||
993 | #endif | ||
994 | |||
995 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | ||
996 | error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | ||
997 | XFS_DEFAULT_LOG_COUNT); | ||
998 | if (error) { | ||
999 | xfs_trans_cancel(tp, 0); | ||
1000 | xfs_fs_cmn_err(CE_ALERT, mp, | ||
1001 | "xfs_mount_reset_sbqflags: Superblock update failed!"); | ||
1002 | return error; | ||
1003 | } | ||
1004 | |||
1005 | xfs_mod_sb(tp, XFS_SB_QFLAGS); | ||
1006 | return xfs_trans_commit(tp, 0); | ||
1007 | } | ||
1008 | |||
1009 | /* | ||
963 | * This function does the following on an initial mount of a file system: | 1010 | * This function does the following on an initial mount of a file system: |
964 | * - reads the superblock from disk and init the mount struct | 1011 | * - reads the superblock from disk and init the mount struct |
965 | * - if we're a 32-bit kernel, do a size check on the superblock | 1012 | * - if we're a 32-bit kernel, do a size check on the superblock |
@@ -976,7 +1023,8 @@ xfs_mountfs( | |||
976 | xfs_sb_t *sbp = &(mp->m_sb); | 1023 | xfs_sb_t *sbp = &(mp->m_sb); |
977 | xfs_inode_t *rip; | 1024 | xfs_inode_t *rip; |
978 | __uint64_t resblks; | 1025 | __uint64_t resblks; |
979 | uint quotamount, quotaflags; | 1026 | uint quotamount = 0; |
1027 | uint quotaflags = 0; | ||
980 | int error = 0; | 1028 | int error = 0; |
981 | 1029 | ||
982 | xfs_mount_common(mp, sbp); | 1030 | xfs_mount_common(mp, sbp); |
@@ -1210,9 +1258,28 @@ xfs_mountfs( | |||
1210 | /* | 1258 | /* |
1211 | * Initialise the XFS quota management subsystem for this mount | 1259 | * Initialise the XFS quota management subsystem for this mount |
1212 | */ | 1260 | */ |
1213 | error = XFS_QM_INIT(mp, "amount, "aflags); | 1261 | if (XFS_IS_QUOTA_RUNNING(mp)) { |
1214 | if (error) | 1262 | error = xfs_qm_newmount(mp, "amount, "aflags); |
1215 | goto out_rtunmount; | 1263 | if (error) |
1264 | goto out_rtunmount; | ||
1265 | } else { | ||
1266 | ASSERT(!XFS_IS_QUOTA_ON(mp)); | ||
1267 | |||
1268 | /* | ||
1269 | * If a file system had quotas running earlier, but decided to | ||
1270 | * mount without -o uquota/pquota/gquota options, revoke the | ||
1271 | * quotachecked license. | ||
1272 | */ | ||
1273 | if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) { | ||
1274 | cmn_err(CE_NOTE, | ||
1275 | "XFS: resetting qflags for filesystem %s", | ||
1276 | mp->m_fsname); | ||
1277 | |||
1278 | error = xfs_mount_reset_sbqflags(mp); | ||
1279 | if (error) | ||
1280 | return error; | ||
1281 | } | ||
1282 | } | ||
1216 | 1283 | ||
1217 | /* | 1284 | /* |
1218 | * Finish recovering the file system. This part needed to be | 1285 | * Finish recovering the file system. This part needed to be |
@@ -1228,9 +1295,19 @@ xfs_mountfs( | |||
1228 | /* | 1295 | /* |
1229 | * Complete the quota initialisation, post-log-replay component. | 1296 | * Complete the quota initialisation, post-log-replay component. |
1230 | */ | 1297 | */ |
1231 | error = XFS_QM_MOUNT(mp, quotamount, quotaflags); | 1298 | if (quotamount) { |
1232 | if (error) | 1299 | ASSERT(mp->m_qflags == 0); |
1233 | goto out_rtunmount; | 1300 | mp->m_qflags = quotaflags; |
1301 | |||
1302 | xfs_qm_mount_quotas(mp); | ||
1303 | } | ||
1304 | |||
1305 | #if defined(DEBUG) && defined(XFS_LOUD_RECOVERY) | ||
1306 | if (XFS_IS_QUOTA_ON(mp)) | ||
1307 | xfs_fs_cmn_err(CE_NOTE, mp, "Disk quotas turned on"); | ||
1308 | else | ||
1309 | xfs_fs_cmn_err(CE_NOTE, mp, "Disk quotas not turned on"); | ||
1310 | #endif | ||
1234 | 1311 | ||
1235 | /* | 1312 | /* |
1236 | * Now we are mounted, reserve a small amount of unused space for | 1313 | * Now we are mounted, reserve a small amount of unused space for |
@@ -1279,12 +1356,7 @@ xfs_unmountfs( | |||
1279 | __uint64_t resblks; | 1356 | __uint64_t resblks; |
1280 | int error; | 1357 | int error; |
1281 | 1358 | ||
1282 | /* | 1359 | xfs_qm_unmount_quotas(mp); |
1283 | * Release dquot that rootinode, rbmino and rsumino might be holding, | ||
1284 | * and release the quota inodes. | ||
1285 | */ | ||
1286 | XFS_QM_UNMOUNT(mp); | ||
1287 | |||
1288 | xfs_rtunmount_inodes(mp); | 1360 | xfs_rtunmount_inodes(mp); |
1289 | IRELE(mp->m_rootip); | 1361 | IRELE(mp->m_rootip); |
1290 | 1362 | ||
@@ -1301,10 +1373,7 @@ xfs_unmountfs( | |||
1301 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC); | 1373 | xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE | XFS_LOG_SYNC); |
1302 | xfs_reclaim_inodes(mp, 0, XFS_IFLUSH_ASYNC); | 1374 | xfs_reclaim_inodes(mp, 0, XFS_IFLUSH_ASYNC); |
1303 | 1375 | ||
1304 | XFS_QM_DQPURGEALL(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING); | 1376 | xfs_qm_unmount(mp); |
1305 | |||
1306 | if (mp->m_quotainfo) | ||
1307 | XFS_QM_DONE(mp); | ||
1308 | 1377 | ||
1309 | /* | 1378 | /* |
1310 | * Flush out the log synchronously so that we know for sure | 1379 | * Flush out the log synchronously so that we know for sure |