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/linux-2.6/xfs_ioctl.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/linux-2.6/xfs_ioctl.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 24 |
1 files changed, 13 insertions, 11 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); |