aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2009-06-08 09:33:32 -0400
committerChristoph Hellwig <hch@brick.lst.de>2009-06-08 09:33:32 -0400
commit7d095257e321214e4cf359abd131ba1f09c60cba (patch)
tree3f71e2650651616f8ba168b64a82ab48aedef14c /fs/xfs/linux-2.6
parent0c5e1ce89f1eacc366ec421c0f5f681159479c28 (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/linux-2.6')
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl.c24
-rw-r--r--fs/xfs/linux-2.6/xfs_super.c22
-rw-r--r--fs/xfs/linux-2.6/xfs_sync.c7
3 files changed, 31 insertions, 22 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl.c b/fs/xfs/linux-2.6/xfs_ioctl.c
index d0b499418a7d..c7d684f02f89 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl.c
@@ -908,7 +908,8 @@ xfs_ioctl_setattr(
908 struct xfs_mount *mp = ip->i_mount; 908 struct xfs_mount *mp = ip->i_mount;
909 struct xfs_trans *tp; 909 struct xfs_trans *tp;
910 unsigned int lock_flags = 0; 910 unsigned int lock_flags = 0;
911 struct xfs_dquot *udqp = NULL, *gdqp = NULL; 911 struct xfs_dquot *udqp = NULL;
912 struct xfs_dquot *gdqp = NULL;
912 struct xfs_dquot *olddquot = NULL; 913 struct xfs_dquot *olddquot = NULL;
913 int code; 914 int code;
914 915
@@ -928,7 +929,7 @@ xfs_ioctl_setattr(
928 * because the i_*dquot fields will get updated anyway. 929 * because the i_*dquot fields will get updated anyway.
929 */ 930 */
930 if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) { 931 if (XFS_IS_QUOTA_ON(mp) && (mask & FSX_PROJID)) {
931 code = XFS_QM_DQVOPALLOC(mp, ip, ip->i_d.di_uid, 932 code = xfs_qm_vop_dqalloc(ip, ip->i_d.di_uid,
932 ip->i_d.di_gid, fa->fsx_projid, 933 ip->i_d.di_gid, fa->fsx_projid,
933 XFS_QMOPT_PQUOTA, &udqp, &gdqp); 934 XFS_QMOPT_PQUOTA, &udqp, &gdqp);
934 if (code) 935 if (code)
@@ -963,10 +964,11 @@ xfs_ioctl_setattr(
963 * Do a quota reservation only if projid is actually going to change. 964 * Do a quota reservation only if projid is actually going to change.
964 */ 965 */
965 if (mask & FSX_PROJID) { 966 if (mask & FSX_PROJID) {
966 if (XFS_IS_PQUOTA_ON(mp) && 967 if (XFS_IS_QUOTA_RUNNING(mp) &&
968 XFS_IS_PQUOTA_ON(mp) &&
967 ip->i_d.di_projid != fa->fsx_projid) { 969 ip->i_d.di_projid != fa->fsx_projid) {
968 ASSERT(tp); 970 ASSERT(tp);
969 code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp, 971 code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
970 capable(CAP_FOWNER) ? 972 capable(CAP_FOWNER) ?
971 XFS_QMOPT_FORCE_RES : 0); 973 XFS_QMOPT_FORCE_RES : 0);
972 if (code) /* out of quota */ 974 if (code) /* out of quota */
@@ -1068,8 +1070,8 @@ xfs_ioctl_setattr(
1068 * in the transaction. 1070 * in the transaction.
1069 */ 1071 */
1070 if (ip->i_d.di_projid != fa->fsx_projid) { 1072 if (ip->i_d.di_projid != fa->fsx_projid) {
1071 if (XFS_IS_PQUOTA_ON(mp)) { 1073 if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_PQUOTA_ON(mp)) {
1072 olddquot = XFS_QM_DQVOPCHOWN(mp, tp, ip, 1074 olddquot = xfs_qm_vop_chown(tp, ip,
1073 &ip->i_gdquot, gdqp); 1075 &ip->i_gdquot, gdqp);
1074 } 1076 }
1075 ip->i_d.di_projid = fa->fsx_projid; 1077 ip->i_d.di_projid = fa->fsx_projid;
@@ -1115,9 +1117,9 @@ xfs_ioctl_setattr(
1115 /* 1117 /*
1116 * Release any dquot(s) the inode had kept before chown. 1118 * Release any dquot(s) the inode had kept before chown.
1117 */ 1119 */
1118 XFS_QM_DQRELE(mp, olddquot); 1120 xfs_qm_dqrele(olddquot);
1119 XFS_QM_DQRELE(mp, udqp); 1121 xfs_qm_dqrele(udqp);
1120 XFS_QM_DQRELE(mp, gdqp); 1122 xfs_qm_dqrele(gdqp);
1121 1123
1122 if (code) 1124 if (code)
1123 return code; 1125 return code;
@@ -1131,8 +1133,8 @@ xfs_ioctl_setattr(
1131 return 0; 1133 return 0;
1132 1134
1133 error_return: 1135 error_return:
1134 XFS_QM_DQRELE(mp, udqp); 1136 xfs_qm_dqrele(udqp);
1135 XFS_QM_DQRELE(mp, gdqp); 1137 xfs_qm_dqrele(gdqp);
1136 xfs_trans_cancel(tp, 0); 1138 xfs_trans_cancel(tp, 0);
1137 if (lock_flags) 1139 if (lock_flags)
1138 xfs_iunlock(ip, lock_flags); 1140 xfs_iunlock(ip, lock_flags);
diff --git a/fs/xfs/linux-2.6/xfs_super.c b/fs/xfs/linux-2.6/xfs_super.c
index bb685269f832..0d9b64b219e0 100644
--- a/fs/xfs/linux-2.6/xfs_super.c
+++ b/fs/xfs/linux-2.6/xfs_super.c
@@ -405,6 +405,14 @@ xfs_parseargs(
405 return EINVAL; 405 return EINVAL;
406 } 406 }
407 407
408#ifndef CONFIG_XFS_QUOTA
409 if (XFS_IS_QUOTA_RUNNING(mp)) {
410 cmn_err(CE_WARN,
411 "XFS: quota support not available in this kernel.");
412 return EINVAL;
413 }
414#endif
415
408 if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) && 416 if ((mp->m_qflags & (XFS_GQUOTA_ACCT | XFS_GQUOTA_ACTIVE)) &&
409 (mp->m_qflags & (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE))) { 417 (mp->m_qflags & (XFS_PQUOTA_ACCT | XFS_PQUOTA_ACTIVE))) {
410 cmn_err(CE_WARN, 418 cmn_err(CE_WARN,
@@ -1098,7 +1106,6 @@ xfs_fs_put_super(
1098 xfs_freesb(mp); 1106 xfs_freesb(mp);
1099 xfs_icsb_destroy_counters(mp); 1107 xfs_icsb_destroy_counters(mp);
1100 xfs_close_devices(mp); 1108 xfs_close_devices(mp);
1101 xfs_qmops_put(mp);
1102 xfs_dmops_put(mp); 1109 xfs_dmops_put(mp);
1103 xfs_free_fsname(mp); 1110 xfs_free_fsname(mp);
1104 kfree(mp); 1111 kfree(mp);
@@ -1168,6 +1175,7 @@ xfs_fs_statfs(
1168{ 1175{
1169 struct xfs_mount *mp = XFS_M(dentry->d_sb); 1176 struct xfs_mount *mp = XFS_M(dentry->d_sb);
1170 xfs_sb_t *sbp = &mp->m_sb; 1177 xfs_sb_t *sbp = &mp->m_sb;
1178 struct xfs_inode *ip = XFS_I(dentry->d_inode);
1171 __uint64_t fakeinos, id; 1179 __uint64_t fakeinos, id;
1172 xfs_extlen_t lsize; 1180 xfs_extlen_t lsize;
1173 1181
@@ -1196,7 +1204,10 @@ xfs_fs_statfs(
1196 statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree); 1204 statp->f_ffree = statp->f_files - (sbp->sb_icount - sbp->sb_ifree);
1197 spin_unlock(&mp->m_sb_lock); 1205 spin_unlock(&mp->m_sb_lock);
1198 1206
1199 XFS_QM_DQSTATVFS(XFS_I(dentry->d_inode), statp); 1207 if ((ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) ||
1208 ((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))) ==
1209 (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))
1210 xfs_qm_statvfs(ip, statp);
1200 return 0; 1211 return 0;
1201} 1212}
1202 1213
@@ -1404,16 +1415,13 @@ xfs_fs_fill_super(
1404 error = xfs_dmops_get(mp); 1415 error = xfs_dmops_get(mp);
1405 if (error) 1416 if (error)
1406 goto out_free_fsname; 1417 goto out_free_fsname;
1407 error = xfs_qmops_get(mp);
1408 if (error)
1409 goto out_put_dmops;
1410 1418
1411 if (silent) 1419 if (silent)
1412 flags |= XFS_MFSI_QUIET; 1420 flags |= XFS_MFSI_QUIET;
1413 1421
1414 error = xfs_open_devices(mp); 1422 error = xfs_open_devices(mp);
1415 if (error) 1423 if (error)
1416 goto out_put_qmops; 1424 goto out_put_dmops;
1417 1425
1418 if (xfs_icsb_init_counters(mp)) 1426 if (xfs_icsb_init_counters(mp))
1419 mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB; 1427 mp->m_flags |= XFS_MOUNT_NO_PERCPU_SB;
@@ -1482,8 +1490,6 @@ xfs_fs_fill_super(
1482 out_destroy_counters: 1490 out_destroy_counters:
1483 xfs_icsb_destroy_counters(mp); 1491 xfs_icsb_destroy_counters(mp);
1484 xfs_close_devices(mp); 1492 xfs_close_devices(mp);
1485 out_put_qmops:
1486 xfs_qmops_put(mp);
1487 out_put_dmops: 1493 out_put_dmops:
1488 xfs_dmops_put(mp); 1494 xfs_dmops_put(mp);
1489 out_free_fsname: 1495 out_free_fsname:
diff --git a/fs/xfs/linux-2.6/xfs_sync.c b/fs/xfs/linux-2.6/xfs_sync.c
index f7ba76633c29..b06b95c154cc 100644
--- a/fs/xfs/linux-2.6/xfs_sync.c
+++ b/fs/xfs/linux-2.6/xfs_sync.c
@@ -43,6 +43,7 @@
43#include "xfs_buf_item.h" 43#include "xfs_buf_item.h"
44#include "xfs_inode_item.h" 44#include "xfs_inode_item.h"
45#include "xfs_rw.h" 45#include "xfs_rw.h"
46#include "xfs_quota.h"
46 47
47#include <linux/kthread.h> 48#include <linux/kthread.h>
48#include <linux/freezer.h> 49#include <linux/freezer.h>
@@ -317,12 +318,12 @@ xfs_quiesce_data(
317 318
318 /* push non-blocking */ 319 /* push non-blocking */
319 xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_BDFLUSH); 320 xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_BDFLUSH);
320 XFS_QM_DQSYNC(mp, SYNC_BDFLUSH); 321 xfs_qm_sync(mp, SYNC_BDFLUSH);
321 xfs_filestream_flush(mp); 322 xfs_filestream_flush(mp);
322 323
323 /* push and block */ 324 /* push and block */
324 xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_WAIT|SYNC_IOWAIT); 325 xfs_sync_inodes(mp, SYNC_DELWRI|SYNC_WAIT|SYNC_IOWAIT);
325 XFS_QM_DQSYNC(mp, SYNC_WAIT); 326 xfs_qm_sync(mp, SYNC_WAIT);
326 327
327 /* write superblock and hoover up shutdown errors */ 328 /* write superblock and hoover up shutdown errors */
328 error = xfs_sync_fsdata(mp, 0); 329 error = xfs_sync_fsdata(mp, 0);
@@ -467,7 +468,7 @@ xfs_sync_worker(
467 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE); 468 xfs_log_force(mp, (xfs_lsn_t)0, XFS_LOG_FORCE);
468 xfs_reclaim_inodes(mp, 0, XFS_IFLUSH_DELWRI_ELSE_ASYNC); 469 xfs_reclaim_inodes(mp, 0, XFS_IFLUSH_DELWRI_ELSE_ASYNC);
469 /* dgc: errors ignored here */ 470 /* dgc: errors ignored here */
470 error = XFS_QM_DQSYNC(mp, SYNC_BDFLUSH); 471 error = xfs_qm_sync(mp, SYNC_BDFLUSH);
471 error = xfs_sync_fsdata(mp, SYNC_BDFLUSH); 472 error = xfs_sync_fsdata(mp, SYNC_BDFLUSH);
472 if (xfs_log_need_covered(mp)) 473 if (xfs_log_need_covered(mp))
473 error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE); 474 error = xfs_commit_dummy_trans(mp, XFS_LOG_FORCE);