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 | |
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')
-rw-r--r-- | fs/xfs/Makefile | 3 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl.c | 24 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_super.c | 22 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/xfs_sync.c | 7 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 4 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_dquot.h | 1 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.c | 139 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm.h | 21 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_qm_bhv.c | 76 | ||||
-rw-r--r-- | fs/xfs/quota/xfs_trans_dquot.c | 65 | ||||
-rw-r--r-- | fs/xfs/xfs_attr.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap.c | 33 | ||||
-rw-r--r-- | fs/xfs/xfs_bmap_btree.c | 4 | ||||
-rw-r--r-- | fs/xfs/xfs_iget.c | 5 | ||||
-rw-r--r-- | fs/xfs/xfs_iomap.c | 12 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.c | 103 | ||||
-rw-r--r-- | fs/xfs/xfs_mount.h | 84 | ||||
-rw-r--r-- | fs/xfs/xfs_qmops.c | 152 | ||||
-rw-r--r-- | fs/xfs/xfs_quota.h | 122 | ||||
-rw-r--r-- | fs/xfs/xfs_rename.c | 3 | ||||
-rw-r--r-- | fs/xfs/xfs_trans.c | 15 | ||||
-rw-r--r-- | fs/xfs/xfs_utils.c | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_vnodeops.c | 99 |
23 files changed, 380 insertions, 628 deletions
diff --git a/fs/xfs/Makefile b/fs/xfs/Makefile index 60f107e47fe9..222c59e541ce 100644 --- a/fs/xfs/Makefile +++ b/fs/xfs/Makefile | |||
@@ -88,8 +88,7 @@ xfs-y += xfs_alloc.o \ | |||
88 | xfs_utils.o \ | 88 | xfs_utils.o \ |
89 | xfs_vnodeops.o \ | 89 | xfs_vnodeops.o \ |
90 | xfs_rw.o \ | 90 | xfs_rw.o \ |
91 | xfs_dmops.o \ | 91 | xfs_dmops.o |
92 | xfs_qmops.o | ||
93 | 92 | ||
94 | xfs-$(CONFIG_XFS_TRACE) += xfs_btree_trace.o \ | 93 | xfs-$(CONFIG_XFS_TRACE) += xfs_btree_trace.o \ |
95 | xfs_dir2_trace.o | 94 | xfs_dir2_trace.o |
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); |
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index e4babcc63423..4d6d051ee56e 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -1194,7 +1194,9 @@ void | |||
1194 | xfs_qm_dqrele( | 1194 | xfs_qm_dqrele( |
1195 | xfs_dquot_t *dqp) | 1195 | xfs_dquot_t *dqp) |
1196 | { | 1196 | { |
1197 | ASSERT(dqp); | 1197 | if (!dqp) |
1198 | return; | ||
1199 | |||
1198 | xfs_dqtrace_entry(dqp, "DQRELE"); | 1200 | xfs_dqtrace_entry(dqp, "DQRELE"); |
1199 | 1201 | ||
1200 | xfs_dqlock(dqp); | 1202 | xfs_dqlock(dqp); |
diff --git a/fs/xfs/quota/xfs_dquot.h b/fs/xfs/quota/xfs_dquot.h index de0f402ddb4c..6533ead9b889 100644 --- a/fs/xfs/quota/xfs_dquot.h +++ b/fs/xfs/quota/xfs_dquot.h | |||
@@ -181,7 +181,6 @@ extern void xfs_qm_adjust_dqlimits(xfs_mount_t *, | |||
181 | extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *, | 181 | extern int xfs_qm_dqget(xfs_mount_t *, xfs_inode_t *, |
182 | xfs_dqid_t, uint, uint, xfs_dquot_t **); | 182 | xfs_dqid_t, uint, uint, xfs_dquot_t **); |
183 | extern void xfs_qm_dqput(xfs_dquot_t *); | 183 | extern void xfs_qm_dqput(xfs_dquot_t *); |
184 | extern void xfs_qm_dqrele(xfs_dquot_t *); | ||
185 | extern void xfs_dqlock(xfs_dquot_t *); | 184 | extern void xfs_dqlock(xfs_dquot_t *); |
186 | extern void xfs_dqlock2(xfs_dquot_t *, xfs_dquot_t *); | 185 | extern void xfs_dqlock2(xfs_dquot_t *, xfs_dquot_t *); |
187 | extern void xfs_dqunlock(xfs_dquot_t *); | 186 | extern void xfs_dqunlock(xfs_dquot_t *); |
diff --git a/fs/xfs/quota/xfs_qm.c b/fs/xfs/quota/xfs_qm.c index 5b6695049e00..aa5d8212661c 100644 --- a/fs/xfs/quota/xfs_qm.c +++ b/fs/xfs/quota/xfs_qm.c | |||
@@ -287,11 +287,13 @@ xfs_qm_rele_quotafs_ref( | |||
287 | * Just destroy the quotainfo structure. | 287 | * Just destroy the quotainfo structure. |
288 | */ | 288 | */ |
289 | void | 289 | void |
290 | xfs_qm_unmount_quotadestroy( | 290 | xfs_qm_unmount( |
291 | xfs_mount_t *mp) | 291 | struct xfs_mount *mp) |
292 | { | 292 | { |
293 | if (mp->m_quotainfo) | 293 | if (mp->m_quotainfo) { |
294 | xfs_qm_dqpurge_all(mp, XFS_QMOPT_QUOTALL | XFS_QMOPT_UMOUNTING); | ||
294 | xfs_qm_destroy_quotainfo(mp); | 295 | xfs_qm_destroy_quotainfo(mp); |
296 | } | ||
295 | } | 297 | } |
296 | 298 | ||
297 | 299 | ||
@@ -385,8 +387,13 @@ xfs_qm_mount_quotas( | |||
385 | if (error) { | 387 | if (error) { |
386 | xfs_fs_cmn_err(CE_WARN, mp, | 388 | xfs_fs_cmn_err(CE_WARN, mp, |
387 | "Failed to initialize disk quotas."); | 389 | "Failed to initialize disk quotas."); |
390 | return; | ||
388 | } | 391 | } |
389 | return; | 392 | |
393 | #ifdef QUOTADEBUG | ||
394 | if (XFS_IS_QUOTA_ON(mp)) | ||
395 | xfs_qm_internalqcheck(mp); | ||
396 | #endif | ||
390 | } | 397 | } |
391 | 398 | ||
392 | /* | 399 | /* |
@@ -774,12 +781,11 @@ xfs_qm_dqattach_grouphint( | |||
774 | * Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON | 781 | * Given a locked inode, attach dquot(s) to it, taking U/G/P-QUOTAON |
775 | * into account. | 782 | * into account. |
776 | * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed. | 783 | * If XFS_QMOPT_DQALLOC, the dquot(s) will be allocated if needed. |
777 | * If XFS_QMOPT_ILOCKED, then inode sent is already locked EXCL. | ||
778 | * Inode may get unlocked and relocked in here, and the caller must deal with | 784 | * Inode may get unlocked and relocked in here, and the caller must deal with |
779 | * the consequences. | 785 | * the consequences. |
780 | */ | 786 | */ |
781 | int | 787 | int |
782 | xfs_qm_dqattach( | 788 | xfs_qm_dqattach_locked( |
783 | xfs_inode_t *ip, | 789 | xfs_inode_t *ip, |
784 | uint flags) | 790 | uint flags) |
785 | { | 791 | { |
@@ -787,17 +793,14 @@ xfs_qm_dqattach( | |||
787 | uint nquotas = 0; | 793 | uint nquotas = 0; |
788 | int error = 0; | 794 | int error = 0; |
789 | 795 | ||
790 | if ((! XFS_IS_QUOTA_ON(mp)) || | 796 | if (!XFS_IS_QUOTA_RUNNING(mp) || |
791 | (! XFS_NOT_DQATTACHED(mp, ip)) || | 797 | !XFS_IS_QUOTA_ON(mp) || |
792 | (ip->i_ino == mp->m_sb.sb_uquotino) || | 798 | !XFS_NOT_DQATTACHED(mp, ip) || |
793 | (ip->i_ino == mp->m_sb.sb_gquotino)) | 799 | ip->i_ino == mp->m_sb.sb_uquotino || |
800 | ip->i_ino == mp->m_sb.sb_gquotino) | ||
794 | return 0; | 801 | return 0; |
795 | 802 | ||
796 | ASSERT((flags & XFS_QMOPT_ILOCKED) == 0 || | 803 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
797 | xfs_isilocked(ip, XFS_ILOCK_EXCL)); | ||
798 | |||
799 | if (! (flags & XFS_QMOPT_ILOCKED)) | ||
800 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
801 | 804 | ||
802 | if (XFS_IS_UQUOTA_ON(mp)) { | 805 | if (XFS_IS_UQUOTA_ON(mp)) { |
803 | error = xfs_qm_dqattach_one(ip, ip->i_d.di_uid, XFS_DQ_USER, | 806 | error = xfs_qm_dqattach_one(ip, ip->i_d.di_uid, XFS_DQ_USER, |
@@ -849,8 +852,7 @@ xfs_qm_dqattach( | |||
849 | xfs_qm_dqattach_grouphint(ip->i_udquot, ip->i_gdquot); | 852 | xfs_qm_dqattach_grouphint(ip->i_udquot, ip->i_gdquot); |
850 | } | 853 | } |
851 | 854 | ||
852 | done: | 855 | done: |
853 | |||
854 | #ifdef QUOTADEBUG | 856 | #ifdef QUOTADEBUG |
855 | if (! error) { | 857 | if (! error) { |
856 | if (XFS_IS_UQUOTA_ON(mp)) | 858 | if (XFS_IS_UQUOTA_ON(mp)) |
@@ -858,15 +860,22 @@ xfs_qm_dqattach( | |||
858 | if (XFS_IS_OQUOTA_ON(mp)) | 860 | if (XFS_IS_OQUOTA_ON(mp)) |
859 | ASSERT(ip->i_gdquot); | 861 | ASSERT(ip->i_gdquot); |
860 | } | 862 | } |
863 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | ||
861 | #endif | 864 | #endif |
865 | return error; | ||
866 | } | ||
862 | 867 | ||
863 | if (! (flags & XFS_QMOPT_ILOCKED)) | 868 | int |
864 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | 869 | xfs_qm_dqattach( |
870 | struct xfs_inode *ip, | ||
871 | uint flags) | ||
872 | { | ||
873 | int error; | ||
874 | |||
875 | xfs_ilock(ip, XFS_ILOCK_EXCL); | ||
876 | error = xfs_qm_dqattach_locked(ip, flags); | ||
877 | xfs_iunlock(ip, XFS_ILOCK_EXCL); | ||
865 | 878 | ||
866 | #ifdef QUOTADEBUG | ||
867 | else | ||
868 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | ||
869 | #endif | ||
870 | return error; | 879 | return error; |
871 | } | 880 | } |
872 | 881 | ||
@@ -912,7 +921,7 @@ xfs_qm_sync( | |||
912 | boolean_t nowait; | 921 | boolean_t nowait; |
913 | int error; | 922 | int error; |
914 | 923 | ||
915 | if (! XFS_IS_QUOTA_ON(mp)) | 924 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
916 | return 0; | 925 | return 0; |
917 | 926 | ||
918 | restarts = 0; | 927 | restarts = 0; |
@@ -2319,20 +2328,20 @@ xfs_qm_write_sb_changes( | |||
2319 | */ | 2328 | */ |
2320 | int | 2329 | int |
2321 | xfs_qm_vop_dqalloc( | 2330 | xfs_qm_vop_dqalloc( |
2322 | xfs_mount_t *mp, | 2331 | struct xfs_inode *ip, |
2323 | xfs_inode_t *ip, | 2332 | uid_t uid, |
2324 | uid_t uid, | 2333 | gid_t gid, |
2325 | gid_t gid, | 2334 | prid_t prid, |
2326 | prid_t prid, | 2335 | uint flags, |
2327 | uint flags, | 2336 | struct xfs_dquot **O_udqpp, |
2328 | xfs_dquot_t **O_udqpp, | 2337 | struct xfs_dquot **O_gdqpp) |
2329 | xfs_dquot_t **O_gdqpp) | ||
2330 | { | 2338 | { |
2331 | int error; | 2339 | struct xfs_mount *mp = ip->i_mount; |
2332 | xfs_dquot_t *uq, *gq; | 2340 | struct xfs_dquot *uq, *gq; |
2333 | uint lockflags; | 2341 | int error; |
2342 | uint lockflags; | ||
2334 | 2343 | ||
2335 | if (!XFS_IS_QUOTA_ON(mp)) | 2344 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
2336 | return 0; | 2345 | return 0; |
2337 | 2346 | ||
2338 | lockflags = XFS_ILOCK_EXCL; | 2347 | lockflags = XFS_ILOCK_EXCL; |
@@ -2346,8 +2355,8 @@ xfs_qm_vop_dqalloc( | |||
2346 | * if necessary. The dquot(s) will not be locked. | 2355 | * if necessary. The dquot(s) will not be locked. |
2347 | */ | 2356 | */ |
2348 | if (XFS_NOT_DQATTACHED(mp, ip)) { | 2357 | if (XFS_NOT_DQATTACHED(mp, ip)) { |
2349 | if ((error = xfs_qm_dqattach(ip, XFS_QMOPT_DQALLOC | | 2358 | error = xfs_qm_dqattach_locked(ip, XFS_QMOPT_DQALLOC); |
2350 | XFS_QMOPT_ILOCKED))) { | 2359 | if (error) { |
2351 | xfs_iunlock(ip, lockflags); | 2360 | xfs_iunlock(ip, lockflags); |
2352 | return error; | 2361 | return error; |
2353 | } | 2362 | } |
@@ -2469,6 +2478,7 @@ xfs_qm_vop_chown( | |||
2469 | uint bfield = XFS_IS_REALTIME_INODE(ip) ? | 2478 | uint bfield = XFS_IS_REALTIME_INODE(ip) ? |
2470 | XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT; | 2479 | XFS_TRANS_DQ_RTBCOUNT : XFS_TRANS_DQ_BCOUNT; |
2471 | 2480 | ||
2481 | |||
2472 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | 2482 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
2473 | ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); | 2483 | ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); |
2474 | 2484 | ||
@@ -2508,13 +2518,13 @@ xfs_qm_vop_chown_reserve( | |||
2508 | xfs_dquot_t *gdqp, | 2518 | xfs_dquot_t *gdqp, |
2509 | uint flags) | 2519 | uint flags) |
2510 | { | 2520 | { |
2511 | int error; | 2521 | xfs_mount_t *mp = ip->i_mount; |
2512 | xfs_mount_t *mp; | ||
2513 | uint delblks, blkflags, prjflags = 0; | 2522 | uint delblks, blkflags, prjflags = 0; |
2514 | xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; | 2523 | xfs_dquot_t *unresudq, *unresgdq, *delblksudq, *delblksgdq; |
2524 | int error; | ||
2525 | |||
2515 | 2526 | ||
2516 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); | 2527 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED)); |
2517 | mp = ip->i_mount; | ||
2518 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | 2528 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
2519 | 2529 | ||
2520 | delblks = ip->i_delayed_blks; | 2530 | delblks = ip->i_delayed_blks; |
@@ -2582,28 +2592,23 @@ xfs_qm_vop_chown_reserve( | |||
2582 | 2592 | ||
2583 | int | 2593 | int |
2584 | xfs_qm_vop_rename_dqattach( | 2594 | xfs_qm_vop_rename_dqattach( |
2585 | xfs_inode_t **i_tab) | 2595 | struct xfs_inode **i_tab) |
2586 | { | 2596 | { |
2587 | xfs_inode_t *ip; | 2597 | struct xfs_mount *mp = i_tab[0]->i_mount; |
2588 | int i; | 2598 | int i; |
2589 | int error; | ||
2590 | |||
2591 | ip = i_tab[0]; | ||
2592 | 2599 | ||
2593 | if (! XFS_IS_QUOTA_ON(ip->i_mount)) | 2600 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
2594 | return 0; | 2601 | return 0; |
2595 | 2602 | ||
2596 | if (XFS_NOT_DQATTACHED(ip->i_mount, ip)) { | 2603 | for (i = 0; (i < 4 && i_tab[i]); i++) { |
2597 | error = xfs_qm_dqattach(ip, 0); | 2604 | struct xfs_inode *ip = i_tab[i]; |
2598 | if (error) | 2605 | int error; |
2599 | return error; | 2606 | |
2600 | } | ||
2601 | for (i = 1; (i < 4 && i_tab[i]); i++) { | ||
2602 | /* | 2607 | /* |
2603 | * Watch out for duplicate entries in the table. | 2608 | * Watch out for duplicate entries in the table. |
2604 | */ | 2609 | */ |
2605 | if ((ip = i_tab[i]) != i_tab[i-1]) { | 2610 | if (i == 0 || ip != i_tab[i-1]) { |
2606 | if (XFS_NOT_DQATTACHED(ip->i_mount, ip)) { | 2611 | if (XFS_NOT_DQATTACHED(mp, ip)) { |
2607 | error = xfs_qm_dqattach(ip, 0); | 2612 | error = xfs_qm_dqattach(ip, 0); |
2608 | if (error) | 2613 | if (error) |
2609 | return error; | 2614 | return error; |
@@ -2614,17 +2619,19 @@ xfs_qm_vop_rename_dqattach( | |||
2614 | } | 2619 | } |
2615 | 2620 | ||
2616 | void | 2621 | void |
2617 | xfs_qm_vop_dqattach_and_dqmod_newinode( | 2622 | xfs_qm_vop_create_dqattach( |
2618 | xfs_trans_t *tp, | 2623 | struct xfs_trans *tp, |
2619 | xfs_inode_t *ip, | 2624 | struct xfs_inode *ip, |
2620 | xfs_dquot_t *udqp, | 2625 | struct xfs_dquot *udqp, |
2621 | xfs_dquot_t *gdqp) | 2626 | struct xfs_dquot *gdqp) |
2622 | { | 2627 | { |
2623 | if (!XFS_IS_QUOTA_ON(tp->t_mountp)) | 2628 | struct xfs_mount *mp = tp->t_mountp; |
2629 | |||
2630 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) | ||
2624 | return; | 2631 | return; |
2625 | 2632 | ||
2626 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | 2633 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
2627 | ASSERT(XFS_IS_QUOTA_RUNNING(tp->t_mountp)); | 2634 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
2628 | 2635 | ||
2629 | if (udqp) { | 2636 | if (udqp) { |
2630 | xfs_dqlock(udqp); | 2637 | xfs_dqlock(udqp); |
@@ -2632,7 +2639,7 @@ xfs_qm_vop_dqattach_and_dqmod_newinode( | |||
2632 | xfs_dqunlock(udqp); | 2639 | xfs_dqunlock(udqp); |
2633 | ASSERT(ip->i_udquot == NULL); | 2640 | ASSERT(ip->i_udquot == NULL); |
2634 | ip->i_udquot = udqp; | 2641 | ip->i_udquot = udqp; |
2635 | ASSERT(XFS_IS_UQUOTA_ON(tp->t_mountp)); | 2642 | ASSERT(XFS_IS_UQUOTA_ON(mp)); |
2636 | ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id)); | 2643 | ASSERT(ip->i_d.di_uid == be32_to_cpu(udqp->q_core.d_id)); |
2637 | xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); | 2644 | xfs_trans_mod_dquot(tp, udqp, XFS_TRANS_DQ_ICOUNT, 1); |
2638 | } | 2645 | } |
@@ -2642,8 +2649,8 @@ xfs_qm_vop_dqattach_and_dqmod_newinode( | |||
2642 | xfs_dqunlock(gdqp); | 2649 | xfs_dqunlock(gdqp); |
2643 | ASSERT(ip->i_gdquot == NULL); | 2650 | ASSERT(ip->i_gdquot == NULL); |
2644 | ip->i_gdquot = gdqp; | 2651 | ip->i_gdquot = gdqp; |
2645 | ASSERT(XFS_IS_OQUOTA_ON(tp->t_mountp)); | 2652 | ASSERT(XFS_IS_OQUOTA_ON(mp)); |
2646 | ASSERT((XFS_IS_GQUOTA_ON(tp->t_mountp) ? | 2653 | ASSERT((XFS_IS_GQUOTA_ON(mp) ? |
2647 | ip->i_d.di_gid : ip->i_d.di_projid) == | 2654 | ip->i_d.di_gid : ip->i_d.di_projid) == |
2648 | be32_to_cpu(gdqp->q_core.d_id)); | 2655 | be32_to_cpu(gdqp->q_core.d_id)); |
2649 | xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); | 2656 | xfs_trans_mod_dquot(tp, gdqp, XFS_TRANS_DQ_ICOUNT, 1); |
diff --git a/fs/xfs/quota/xfs_qm.h b/fs/xfs/quota/xfs_qm.h index a371954cae1b..495564b8af38 100644 --- a/fs/xfs/quota/xfs_qm.h +++ b/fs/xfs/quota/xfs_qm.h | |||
@@ -127,8 +127,6 @@ typedef struct xfs_quotainfo { | |||
127 | } xfs_quotainfo_t; | 127 | } xfs_quotainfo_t; |
128 | 128 | ||
129 | 129 | ||
130 | extern xfs_dqtrxops_t xfs_trans_dquot_ops; | ||
131 | |||
132 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); | 130 | extern void xfs_trans_mod_dquot(xfs_trans_t *, xfs_dquot_t *, uint, long); |
133 | extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, | 131 | extern int xfs_trans_reserve_quota_bydquots(xfs_trans_t *, xfs_mount_t *, |
134 | xfs_dquot_t *, xfs_dquot_t *, long, long, uint); | 132 | xfs_dquot_t *, xfs_dquot_t *, long, long, uint); |
@@ -159,17 +157,11 @@ typedef struct xfs_dquot_acct { | |||
159 | #define XFS_QM_RTBWARNLIMIT 5 | 157 | #define XFS_QM_RTBWARNLIMIT 5 |
160 | 158 | ||
161 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); | 159 | extern void xfs_qm_destroy_quotainfo(xfs_mount_t *); |
162 | extern void xfs_qm_mount_quotas(xfs_mount_t *); | ||
163 | extern int xfs_qm_quotacheck(xfs_mount_t *); | 160 | extern int xfs_qm_quotacheck(xfs_mount_t *); |
164 | extern void xfs_qm_unmount_quotadestroy(xfs_mount_t *); | ||
165 | extern void xfs_qm_unmount_quotas(xfs_mount_t *); | ||
166 | extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); | 161 | extern int xfs_qm_write_sb_changes(xfs_mount_t *, __int64_t); |
167 | extern int xfs_qm_sync(xfs_mount_t *, int); | ||
168 | 162 | ||
169 | /* dquot stuff */ | 163 | /* dquot stuff */ |
170 | extern boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **); | 164 | extern boolean_t xfs_qm_dqalloc_incore(xfs_dquot_t **); |
171 | extern int xfs_qm_dqattach(xfs_inode_t *, uint); | ||
172 | extern void xfs_qm_dqdetach(xfs_inode_t *); | ||
173 | extern int xfs_qm_dqpurge_all(xfs_mount_t *, uint); | 165 | extern int xfs_qm_dqpurge_all(xfs_mount_t *, uint); |
174 | extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); | 166 | extern void xfs_qm_dqrele_all_inodes(xfs_mount_t *, uint); |
175 | 167 | ||
@@ -183,19 +175,6 @@ extern int xfs_qm_scall_getqstat(xfs_mount_t *, fs_quota_stat_t *); | |||
183 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); | 175 | extern int xfs_qm_scall_quotaon(xfs_mount_t *, uint); |
184 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); | 176 | extern int xfs_qm_scall_quotaoff(xfs_mount_t *, uint); |
185 | 177 | ||
186 | /* vop stuff */ | ||
187 | extern int xfs_qm_vop_dqalloc(xfs_mount_t *, xfs_inode_t *, | ||
188 | uid_t, gid_t, prid_t, uint, | ||
189 | xfs_dquot_t **, xfs_dquot_t **); | ||
190 | extern void xfs_qm_vop_dqattach_and_dqmod_newinode( | ||
191 | xfs_trans_t *, xfs_inode_t *, | ||
192 | xfs_dquot_t *, xfs_dquot_t *); | ||
193 | extern int xfs_qm_vop_rename_dqattach(xfs_inode_t **); | ||
194 | extern xfs_dquot_t * xfs_qm_vop_chown(xfs_trans_t *, xfs_inode_t *, | ||
195 | xfs_dquot_t **, xfs_dquot_t *); | ||
196 | extern int xfs_qm_vop_chown_reserve(xfs_trans_t *, xfs_inode_t *, | ||
197 | xfs_dquot_t *, xfs_dquot_t *, uint); | ||
198 | |||
199 | /* list stuff */ | 178 | /* list stuff */ |
200 | extern void xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *); | 179 | extern void xfs_qm_freelist_append(xfs_frlist_t *, xfs_dquot_t *); |
201 | extern void xfs_qm_freelist_unlink(xfs_dquot_t *); | 180 | extern void xfs_qm_freelist_unlink(xfs_dquot_t *); |
diff --git a/fs/xfs/quota/xfs_qm_bhv.c b/fs/xfs/quota/xfs_qm_bhv.c index 63037c689a4b..56a5965f3c8b 100644 --- a/fs/xfs/quota/xfs_qm_bhv.c +++ b/fs/xfs/quota/xfs_qm_bhv.c | |||
@@ -84,7 +84,7 @@ xfs_fill_statvfs_from_dquot( | |||
84 | * return a statvfs of the project, not the entire filesystem. | 84 | * return a statvfs of the project, not the entire filesystem. |
85 | * This makes such trees appear as if they are filesystems in themselves. | 85 | * This makes such trees appear as if they are filesystems in themselves. |
86 | */ | 86 | */ |
87 | STATIC void | 87 | void |
88 | xfs_qm_statvfs( | 88 | xfs_qm_statvfs( |
89 | xfs_inode_t *ip, | 89 | xfs_inode_t *ip, |
90 | struct kstatfs *statp) | 90 | struct kstatfs *statp) |
@@ -92,20 +92,13 @@ xfs_qm_statvfs( | |||
92 | xfs_mount_t *mp = ip->i_mount; | 92 | xfs_mount_t *mp = ip->i_mount; |
93 | xfs_dquot_t *dqp; | 93 | xfs_dquot_t *dqp; |
94 | 94 | ||
95 | if (!(ip->i_d.di_flags & XFS_DIFLAG_PROJINHERIT) || | ||
96 | !((mp->m_qflags & (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD))) == | ||
97 | (XFS_PQUOTA_ACCT|XFS_OQUOTA_ENFD)) | ||
98 | return; | ||
99 | |||
100 | if (!xfs_qm_dqget(mp, NULL, ip->i_d.di_projid, XFS_DQ_PROJ, 0, &dqp)) { | 95 | if (!xfs_qm_dqget(mp, NULL, ip->i_d.di_projid, XFS_DQ_PROJ, 0, &dqp)) { |
101 | xfs_disk_dquot_t *dp = &dqp->q_core; | 96 | xfs_fill_statvfs_from_dquot(statp, &dqp->q_core); |
102 | |||
103 | xfs_fill_statvfs_from_dquot(statp, dp); | ||
104 | xfs_qm_dqput(dqp); | 97 | xfs_qm_dqput(dqp); |
105 | } | 98 | } |
106 | } | 99 | } |
107 | 100 | ||
108 | STATIC int | 101 | int |
109 | xfs_qm_newmount( | 102 | xfs_qm_newmount( |
110 | xfs_mount_t *mp, | 103 | xfs_mount_t *mp, |
111 | uint *needquotamount, | 104 | uint *needquotamount, |
@@ -114,9 +107,6 @@ xfs_qm_newmount( | |||
114 | uint quotaondisk; | 107 | uint quotaondisk; |
115 | uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0; | 108 | uint uquotaondisk = 0, gquotaondisk = 0, pquotaondisk = 0; |
116 | 109 | ||
117 | *quotaflags = 0; | ||
118 | *needquotamount = B_FALSE; | ||
119 | |||
120 | quotaondisk = xfs_sb_version_hasquota(&mp->m_sb) && | 110 | quotaondisk = xfs_sb_version_hasquota(&mp->m_sb) && |
121 | (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT); | 111 | (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT); |
122 | 112 | ||
@@ -179,66 +169,6 @@ xfs_qm_newmount( | |||
179 | return 0; | 169 | return 0; |
180 | } | 170 | } |
181 | 171 | ||
182 | STATIC int | ||
183 | xfs_qm_endmount( | ||
184 | xfs_mount_t *mp, | ||
185 | uint needquotamount, | ||
186 | uint quotaflags) | ||
187 | { | ||
188 | if (needquotamount) { | ||
189 | ASSERT(mp->m_qflags == 0); | ||
190 | mp->m_qflags = quotaflags; | ||
191 | xfs_qm_mount_quotas(mp); | ||
192 | } | ||
193 | |||
194 | #if defined(DEBUG) && defined(XFS_LOUD_RECOVERY) | ||
195 | if (! (XFS_IS_QUOTA_ON(mp))) | ||
196 | xfs_fs_cmn_err(CE_NOTE, mp, "Disk quotas not turned on"); | ||
197 | else | ||
198 | xfs_fs_cmn_err(CE_NOTE, mp, "Disk quotas turned on"); | ||
199 | #endif | ||
200 | |||
201 | #ifdef QUOTADEBUG | ||
202 | if (XFS_IS_QUOTA_ON(mp) && xfs_qm_internalqcheck(mp)) | ||
203 | cmn_err(CE_WARN, "XFS: mount internalqcheck failed"); | ||
204 | #endif | ||
205 | |||
206 | return 0; | ||
207 | } | ||
208 | |||
209 | STATIC void | ||
210 | xfs_qm_dqrele_null( | ||
211 | xfs_dquot_t *dq) | ||
212 | { | ||
213 | /* | ||
214 | * Called from XFS, where we always check first for a NULL dquot. | ||
215 | */ | ||
216 | if (!dq) | ||
217 | return; | ||
218 | xfs_qm_dqrele(dq); | ||
219 | } | ||
220 | |||
221 | |||
222 | struct xfs_qmops xfs_qmcore_xfs = { | ||
223 | .xfs_qminit = xfs_qm_newmount, | ||
224 | .xfs_qmdone = xfs_qm_unmount_quotadestroy, | ||
225 | .xfs_qmmount = xfs_qm_endmount, | ||
226 | .xfs_qmunmount = xfs_qm_unmount_quotas, | ||
227 | .xfs_dqrele = xfs_qm_dqrele_null, | ||
228 | .xfs_dqattach = xfs_qm_dqattach, | ||
229 | .xfs_dqdetach = xfs_qm_dqdetach, | ||
230 | .xfs_dqpurgeall = xfs_qm_dqpurge_all, | ||
231 | .xfs_dqvopalloc = xfs_qm_vop_dqalloc, | ||
232 | .xfs_dqvopcreate = xfs_qm_vop_dqattach_and_dqmod_newinode, | ||
233 | .xfs_dqvoprename = xfs_qm_vop_rename_dqattach, | ||
234 | .xfs_dqvopchown = xfs_qm_vop_chown, | ||
235 | .xfs_dqvopchownresv = xfs_qm_vop_chown_reserve, | ||
236 | .xfs_dqstatvfs = xfs_qm_statvfs, | ||
237 | .xfs_dqsync = xfs_qm_sync, | ||
238 | .xfs_dqtrxops = &xfs_trans_dquot_ops, | ||
239 | }; | ||
240 | EXPORT_SYMBOL(xfs_qmcore_xfs); | ||
241 | |||
242 | void __init | 172 | void __init |
243 | xfs_qm_init(void) | 173 | xfs_qm_init(void) |
244 | { | 174 | { |
diff --git a/fs/xfs/quota/xfs_trans_dquot.c b/fs/xfs/quota/xfs_trans_dquot.c index 447173bcf96d..eafa7ab34085 100644 --- a/fs/xfs/quota/xfs_trans_dquot.c +++ b/fs/xfs/quota/xfs_trans_dquot.c | |||
@@ -111,7 +111,7 @@ xfs_trans_log_dquot( | |||
111 | * Carry forward whatever is left of the quota blk reservation to | 111 | * Carry forward whatever is left of the quota blk reservation to |
112 | * the spanky new transaction | 112 | * the spanky new transaction |
113 | */ | 113 | */ |
114 | STATIC void | 114 | void |
115 | xfs_trans_dup_dqinfo( | 115 | xfs_trans_dup_dqinfo( |
116 | xfs_trans_t *otp, | 116 | xfs_trans_t *otp, |
117 | xfs_trans_t *ntp) | 117 | xfs_trans_t *ntp) |
@@ -167,19 +167,17 @@ xfs_trans_dup_dqinfo( | |||
167 | /* | 167 | /* |
168 | * Wrap around mod_dquot to account for both user and group quotas. | 168 | * Wrap around mod_dquot to account for both user and group quotas. |
169 | */ | 169 | */ |
170 | STATIC void | 170 | void |
171 | xfs_trans_mod_dquot_byino( | 171 | xfs_trans_mod_dquot_byino( |
172 | xfs_trans_t *tp, | 172 | xfs_trans_t *tp, |
173 | xfs_inode_t *ip, | 173 | xfs_inode_t *ip, |
174 | uint field, | 174 | uint field, |
175 | long delta) | 175 | long delta) |
176 | { | 176 | { |
177 | xfs_mount_t *mp; | 177 | xfs_mount_t *mp = tp->t_mountp; |
178 | |||
179 | ASSERT(tp); | ||
180 | mp = tp->t_mountp; | ||
181 | 178 | ||
182 | if (!XFS_IS_QUOTA_ON(mp) || | 179 | if (!XFS_IS_QUOTA_RUNNING(mp) || |
180 | !XFS_IS_QUOTA_ON(mp) || | ||
183 | ip->i_ino == mp->m_sb.sb_uquotino || | 181 | ip->i_ino == mp->m_sb.sb_uquotino || |
184 | ip->i_ino == mp->m_sb.sb_gquotino) | 182 | ip->i_ino == mp->m_sb.sb_gquotino) |
185 | return; | 183 | return; |
@@ -229,6 +227,7 @@ xfs_trans_mod_dquot( | |||
229 | xfs_dqtrx_t *qtrx; | 227 | xfs_dqtrx_t *qtrx; |
230 | 228 | ||
231 | ASSERT(tp); | 229 | ASSERT(tp); |
230 | ASSERT(XFS_IS_QUOTA_RUNNING(tp->t_mountp)); | ||
232 | qtrx = NULL; | 231 | qtrx = NULL; |
233 | 232 | ||
234 | if (tp->t_dqinfo == NULL) | 233 | if (tp->t_dqinfo == NULL) |
@@ -346,7 +345,7 @@ xfs_trans_dqlockedjoin( | |||
346 | * Unreserve just the reservations done by this transaction. | 345 | * Unreserve just the reservations done by this transaction. |
347 | * dquot is still left locked at exit. | 346 | * dquot is still left locked at exit. |
348 | */ | 347 | */ |
349 | STATIC void | 348 | void |
350 | xfs_trans_apply_dquot_deltas( | 349 | xfs_trans_apply_dquot_deltas( |
351 | xfs_trans_t *tp) | 350 | xfs_trans_t *tp) |
352 | { | 351 | { |
@@ -357,7 +356,7 @@ xfs_trans_apply_dquot_deltas( | |||
357 | long totalbdelta; | 356 | long totalbdelta; |
358 | long totalrtbdelta; | 357 | long totalrtbdelta; |
359 | 358 | ||
360 | if (! (tp->t_flags & XFS_TRANS_DQ_DIRTY)) | 359 | if (!(tp->t_flags & XFS_TRANS_DQ_DIRTY)) |
361 | return; | 360 | return; |
362 | 361 | ||
363 | ASSERT(tp->t_dqinfo); | 362 | ASSERT(tp->t_dqinfo); |
@@ -531,7 +530,7 @@ xfs_trans_apply_dquot_deltas( | |||
531 | * we simply throw those away, since that's the expected behavior | 530 | * we simply throw those away, since that's the expected behavior |
532 | * when a transaction is curtailed without a commit. | 531 | * when a transaction is curtailed without a commit. |
533 | */ | 532 | */ |
534 | STATIC void | 533 | void |
535 | xfs_trans_unreserve_and_mod_dquots( | 534 | xfs_trans_unreserve_and_mod_dquots( |
536 | xfs_trans_t *tp) | 535 | xfs_trans_t *tp) |
537 | { | 536 | { |
@@ -768,7 +767,7 @@ xfs_trans_reserve_quota_bydquots( | |||
768 | { | 767 | { |
769 | int resvd = 0, error; | 768 | int resvd = 0, error; |
770 | 769 | ||
771 | if (!XFS_IS_QUOTA_ON(mp)) | 770 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
772 | return 0; | 771 | return 0; |
773 | 772 | ||
774 | if (tp && tp->t_dqinfo == NULL) | 773 | if (tp && tp->t_dqinfo == NULL) |
@@ -811,18 +810,17 @@ xfs_trans_reserve_quota_bydquots( | |||
811 | * This doesn't change the actual usage, just the reservation. | 810 | * This doesn't change the actual usage, just the reservation. |
812 | * The inode sent in is locked. | 811 | * The inode sent in is locked. |
813 | */ | 812 | */ |
814 | STATIC int | 813 | int |
815 | xfs_trans_reserve_quota_nblks( | 814 | xfs_trans_reserve_quota_nblks( |
816 | xfs_trans_t *tp, | 815 | struct xfs_trans *tp, |
817 | xfs_mount_t *mp, | 816 | struct xfs_inode *ip, |
818 | xfs_inode_t *ip, | 817 | long nblks, |
819 | long nblks, | 818 | long ninos, |
820 | long ninos, | 819 | uint flags) |
821 | uint flags) | ||
822 | { | 820 | { |
823 | int error; | 821 | struct xfs_mount *mp = ip->i_mount; |
824 | 822 | ||
825 | if (!XFS_IS_QUOTA_ON(mp)) | 823 | if (!XFS_IS_QUOTA_RUNNING(mp) || !XFS_IS_QUOTA_ON(mp)) |
826 | return 0; | 824 | return 0; |
827 | if (XFS_IS_PQUOTA_ON(mp)) | 825 | if (XFS_IS_PQUOTA_ON(mp)) |
828 | flags |= XFS_QMOPT_ENOSPC; | 826 | flags |= XFS_QMOPT_ENOSPC; |
@@ -831,7 +829,6 @@ xfs_trans_reserve_quota_nblks( | |||
831 | ASSERT(ip->i_ino != mp->m_sb.sb_gquotino); | 829 | ASSERT(ip->i_ino != mp->m_sb.sb_gquotino); |
832 | 830 | ||
833 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); | 831 | ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL)); |
834 | ASSERT(XFS_IS_QUOTA_RUNNING(ip->i_mount)); | ||
835 | ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == | 832 | ASSERT((flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == |
836 | XFS_TRANS_DQ_RES_RTBLKS || | 833 | XFS_TRANS_DQ_RES_RTBLKS || |
837 | (flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == | 834 | (flags & ~(XFS_QMOPT_FORCE_RES | XFS_QMOPT_ENOSPC)) == |
@@ -840,11 +837,9 @@ xfs_trans_reserve_quota_nblks( | |||
840 | /* | 837 | /* |
841 | * Reserve nblks against these dquots, with trans as the mediator. | 838 | * Reserve nblks against these dquots, with trans as the mediator. |
842 | */ | 839 | */ |
843 | error = xfs_trans_reserve_quota_bydquots(tp, mp, | 840 | return xfs_trans_reserve_quota_bydquots(tp, mp, |
844 | ip->i_udquot, ip->i_gdquot, | 841 | ip->i_udquot, ip->i_gdquot, |
845 | nblks, ninos, | 842 | nblks, ninos, flags); |
846 | flags); | ||
847 | return error; | ||
848 | } | 843 | } |
849 | 844 | ||
850 | /* | 845 | /* |
@@ -895,25 +890,15 @@ STATIC void | |||
895 | xfs_trans_alloc_dqinfo( | 890 | xfs_trans_alloc_dqinfo( |
896 | xfs_trans_t *tp) | 891 | xfs_trans_t *tp) |
897 | { | 892 | { |
898 | (tp)->t_dqinfo = kmem_zone_zalloc(xfs_Gqm->qm_dqtrxzone, KM_SLEEP); | 893 | tp->t_dqinfo = kmem_zone_zalloc(xfs_Gqm->qm_dqtrxzone, KM_SLEEP); |
899 | } | 894 | } |
900 | 895 | ||
901 | STATIC void | 896 | void |
902 | xfs_trans_free_dqinfo( | 897 | xfs_trans_free_dqinfo( |
903 | xfs_trans_t *tp) | 898 | xfs_trans_t *tp) |
904 | { | 899 | { |
905 | if (!tp->t_dqinfo) | 900 | if (!tp->t_dqinfo) |
906 | return; | 901 | return; |
907 | kmem_zone_free(xfs_Gqm->qm_dqtrxzone, (tp)->t_dqinfo); | 902 | kmem_zone_free(xfs_Gqm->qm_dqtrxzone, tp->t_dqinfo); |
908 | (tp)->t_dqinfo = NULL; | 903 | tp->t_dqinfo = NULL; |
909 | } | 904 | } |
910 | |||
911 | xfs_dqtrxops_t xfs_trans_dquot_ops = { | ||
912 | .qo_dup_dqinfo = xfs_trans_dup_dqinfo, | ||
913 | .qo_free_dqinfo = xfs_trans_free_dqinfo, | ||
914 | .qo_mod_dquot_byino = xfs_trans_mod_dquot_byino, | ||
915 | .qo_apply_dquot_deltas = xfs_trans_apply_dquot_deltas, | ||
916 | .qo_reserve_quota_nblks = xfs_trans_reserve_quota_nblks, | ||
917 | .qo_reserve_quota_bydquots = xfs_trans_reserve_quota_bydquots, | ||
918 | .qo_unreserve_and_mod_dquots = xfs_trans_unreserve_and_mod_dquots, | ||
919 | }; | ||
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 5fde1654b430..cd1008b1c4cd 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -249,8 +249,9 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name, | |||
249 | /* | 249 | /* |
250 | * Attach the dquots to the inode. | 250 | * Attach the dquots to the inode. |
251 | */ | 251 | */ |
252 | if ((error = XFS_QM_DQATTACH(mp, dp, 0))) | 252 | error = xfs_qm_dqattach(dp, 0); |
253 | return (error); | 253 | if (error) |
254 | return error; | ||
254 | 255 | ||
255 | /* | 256 | /* |
256 | * If the inode doesn't have an attribute fork, add one. | 257 | * If the inode doesn't have an attribute fork, add one. |
@@ -311,7 +312,7 @@ xfs_attr_set_int(xfs_inode_t *dp, struct xfs_name *name, | |||
311 | } | 312 | } |
312 | xfs_ilock(dp, XFS_ILOCK_EXCL); | 313 | xfs_ilock(dp, XFS_ILOCK_EXCL); |
313 | 314 | ||
314 | error = XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, args.trans, dp, args.total, 0, | 315 | error = xfs_trans_reserve_quota_nblks(args.trans, dp, args.total, 0, |
315 | rsvd ? XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES : | 316 | rsvd ? XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES : |
316 | XFS_QMOPT_RES_REGBLKS); | 317 | XFS_QMOPT_RES_REGBLKS); |
317 | if (error) { | 318 | if (error) { |
@@ -501,8 +502,9 @@ xfs_attr_remove_int(xfs_inode_t *dp, struct xfs_name *name, int flags) | |||
501 | /* | 502 | /* |
502 | * Attach the dquots to the inode. | 503 | * Attach the dquots to the inode. |
503 | */ | 504 | */ |
504 | if ((error = XFS_QM_DQATTACH(mp, dp, 0))) | 505 | error = xfs_qm_dqattach(dp, 0); |
505 | return (error); | 506 | if (error) |
507 | return error; | ||
506 | 508 | ||
507 | /* | 509 | /* |
508 | * Start our first transaction of the day. | 510 | * Start our first transaction of the day. |
diff --git a/fs/xfs/xfs_bmap.c b/fs/xfs/xfs_bmap.c index ca7c6005a487..4b0f6efb046c 100644 --- a/fs/xfs/xfs_bmap.c +++ b/fs/xfs/xfs_bmap.c | |||
@@ -2691,7 +2691,7 @@ xfs_bmap_rtalloc( | |||
2691 | * Adjust the disk quota also. This was reserved | 2691 | * Adjust the disk quota also. This was reserved |
2692 | * earlier. | 2692 | * earlier. |
2693 | */ | 2693 | */ |
2694 | XFS_TRANS_MOD_DQUOT_BYINO(mp, ap->tp, ap->ip, | 2694 | xfs_trans_mod_dquot_byino(ap->tp, ap->ip, |
2695 | ap->wasdel ? XFS_TRANS_DQ_DELRTBCOUNT : | 2695 | ap->wasdel ? XFS_TRANS_DQ_DELRTBCOUNT : |
2696 | XFS_TRANS_DQ_RTBCOUNT, (long) ralen); | 2696 | XFS_TRANS_DQ_RTBCOUNT, (long) ralen); |
2697 | } else { | 2697 | } else { |
@@ -2995,7 +2995,7 @@ xfs_bmap_btalloc( | |||
2995 | * Adjust the disk quota also. This was reserved | 2995 | * Adjust the disk quota also. This was reserved |
2996 | * earlier. | 2996 | * earlier. |
2997 | */ | 2997 | */ |
2998 | XFS_TRANS_MOD_DQUOT_BYINO(mp, ap->tp, ap->ip, | 2998 | xfs_trans_mod_dquot_byino(ap->tp, ap->ip, |
2999 | ap->wasdel ? XFS_TRANS_DQ_DELBCOUNT : | 2999 | ap->wasdel ? XFS_TRANS_DQ_DELBCOUNT : |
3000 | XFS_TRANS_DQ_BCOUNT, | 3000 | XFS_TRANS_DQ_BCOUNT, |
3001 | (long) args.len); | 3001 | (long) args.len); |
@@ -3066,7 +3066,7 @@ xfs_bmap_btree_to_extents( | |||
3066 | return error; | 3066 | return error; |
3067 | xfs_bmap_add_free(cbno, 1, cur->bc_private.b.flist, mp); | 3067 | xfs_bmap_add_free(cbno, 1, cur->bc_private.b.flist, mp); |
3068 | ip->i_d.di_nblocks--; | 3068 | ip->i_d.di_nblocks--; |
3069 | XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); | 3069 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); |
3070 | xfs_trans_binval(tp, cbp); | 3070 | xfs_trans_binval(tp, cbp); |
3071 | if (cur->bc_bufs[0] == cbp) | 3071 | if (cur->bc_bufs[0] == cbp) |
3072 | cur->bc_bufs[0] = NULL; | 3072 | cur->bc_bufs[0] = NULL; |
@@ -3386,7 +3386,7 @@ xfs_bmap_del_extent( | |||
3386 | * Adjust quota data. | 3386 | * Adjust quota data. |
3387 | */ | 3387 | */ |
3388 | if (qfield) | 3388 | if (qfield) |
3389 | XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, qfield, (long)-nblks); | 3389 | xfs_trans_mod_dquot_byino(tp, ip, qfield, (long)-nblks); |
3390 | 3390 | ||
3391 | /* | 3391 | /* |
3392 | * Account for change in delayed indirect blocks. | 3392 | * Account for change in delayed indirect blocks. |
@@ -3523,7 +3523,7 @@ xfs_bmap_extents_to_btree( | |||
3523 | *firstblock = cur->bc_private.b.firstblock = args.fsbno; | 3523 | *firstblock = cur->bc_private.b.firstblock = args.fsbno; |
3524 | cur->bc_private.b.allocated++; | 3524 | cur->bc_private.b.allocated++; |
3525 | ip->i_d.di_nblocks++; | 3525 | ip->i_d.di_nblocks++; |
3526 | XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, XFS_TRANS_DQ_BCOUNT, 1L); | 3526 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, 1L); |
3527 | abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0); | 3527 | abp = xfs_btree_get_bufl(mp, tp, args.fsbno, 0); |
3528 | /* | 3528 | /* |
3529 | * Fill in the child block. | 3529 | * Fill in the child block. |
@@ -3690,7 +3690,7 @@ xfs_bmap_local_to_extents( | |||
3690 | XFS_BMAP_TRACE_POST_UPDATE("new", ip, 0, whichfork); | 3690 | XFS_BMAP_TRACE_POST_UPDATE("new", ip, 0, whichfork); |
3691 | XFS_IFORK_NEXT_SET(ip, whichfork, 1); | 3691 | XFS_IFORK_NEXT_SET(ip, whichfork, 1); |
3692 | ip->i_d.di_nblocks = 1; | 3692 | ip->i_d.di_nblocks = 1; |
3693 | XFS_TRANS_MOD_DQUOT_BYINO(args.mp, tp, ip, | 3693 | xfs_trans_mod_dquot_byino(tp, ip, |
3694 | XFS_TRANS_DQ_BCOUNT, 1L); | 3694 | XFS_TRANS_DQ_BCOUNT, 1L); |
3695 | flags |= xfs_ilog_fext(whichfork); | 3695 | flags |= xfs_ilog_fext(whichfork); |
3696 | } else { | 3696 | } else { |
@@ -4048,7 +4048,7 @@ xfs_bmap_add_attrfork( | |||
4048 | XFS_TRANS_PERM_LOG_RES, XFS_ADDAFORK_LOG_COUNT))) | 4048 | XFS_TRANS_PERM_LOG_RES, XFS_ADDAFORK_LOG_COUNT))) |
4049 | goto error0; | 4049 | goto error0; |
4050 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 4050 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
4051 | error = XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, blks, 0, rsvd ? | 4051 | error = xfs_trans_reserve_quota_nblks(tp, ip, blks, 0, rsvd ? |
4052 | XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES : | 4052 | XFS_QMOPT_RES_REGBLKS | XFS_QMOPT_FORCE_RES : |
4053 | XFS_QMOPT_RES_REGBLKS); | 4053 | XFS_QMOPT_RES_REGBLKS); |
4054 | if (error) { | 4054 | if (error) { |
@@ -4983,10 +4983,11 @@ xfs_bmapi( | |||
4983 | * adjusted later. We return if we haven't | 4983 | * adjusted later. We return if we haven't |
4984 | * allocated blocks already inside this loop. | 4984 | * allocated blocks already inside this loop. |
4985 | */ | 4985 | */ |
4986 | if ((error = XFS_TRANS_RESERVE_QUOTA_NBLKS( | 4986 | error = xfs_trans_reserve_quota_nblks( |
4987 | mp, NULL, ip, (long)alen, 0, | 4987 | NULL, ip, (long)alen, 0, |
4988 | rt ? XFS_QMOPT_RES_RTBLKS : | 4988 | rt ? XFS_QMOPT_RES_RTBLKS : |
4989 | XFS_QMOPT_RES_REGBLKS))) { | 4989 | XFS_QMOPT_RES_REGBLKS); |
4990 | if (error) { | ||
4990 | if (n == 0) { | 4991 | if (n == 0) { |
4991 | *nmap = 0; | 4992 | *nmap = 0; |
4992 | ASSERT(cur == NULL); | 4993 | ASSERT(cur == NULL); |
@@ -5035,8 +5036,8 @@ xfs_bmapi( | |||
5035 | if (XFS_IS_QUOTA_ON(mp)) | 5036 | if (XFS_IS_QUOTA_ON(mp)) |
5036 | /* unreserve the blocks now */ | 5037 | /* unreserve the blocks now */ |
5037 | (void) | 5038 | (void) |
5038 | XFS_TRANS_UNRESERVE_QUOTA_NBLKS( | 5039 | xfs_trans_unreserve_quota_nblks( |
5039 | mp, NULL, ip, | 5040 | NULL, ip, |
5040 | (long)alen, 0, rt ? | 5041 | (long)alen, 0, rt ? |
5041 | XFS_QMOPT_RES_RTBLKS : | 5042 | XFS_QMOPT_RES_RTBLKS : |
5042 | XFS_QMOPT_RES_REGBLKS); | 5043 | XFS_QMOPT_RES_REGBLKS); |
@@ -5691,14 +5692,14 @@ xfs_bunmapi( | |||
5691 | do_div(rtexts, mp->m_sb.sb_rextsize); | 5692 | do_div(rtexts, mp->m_sb.sb_rextsize); |
5692 | xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS, | 5693 | xfs_mod_incore_sb(mp, XFS_SBS_FREXTENTS, |
5693 | (int64_t)rtexts, rsvd); | 5694 | (int64_t)rtexts, rsvd); |
5694 | (void)XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, | 5695 | (void)xfs_trans_reserve_quota_nblks(NULL, |
5695 | NULL, ip, -((long)del.br_blockcount), 0, | 5696 | ip, -((long)del.br_blockcount), 0, |
5696 | XFS_QMOPT_RES_RTBLKS); | 5697 | XFS_QMOPT_RES_RTBLKS); |
5697 | } else { | 5698 | } else { |
5698 | xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, | 5699 | xfs_mod_incore_sb(mp, XFS_SBS_FDBLOCKS, |
5699 | (int64_t)del.br_blockcount, rsvd); | 5700 | (int64_t)del.br_blockcount, rsvd); |
5700 | (void)XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, | 5701 | (void)xfs_trans_reserve_quota_nblks(NULL, |
5701 | NULL, ip, -((long)del.br_blockcount), 0, | 5702 | ip, -((long)del.br_blockcount), 0, |
5702 | XFS_QMOPT_RES_REGBLKS); | 5703 | XFS_QMOPT_RES_REGBLKS); |
5703 | } | 5704 | } |
5704 | ip->i_delayed_blks -= del.br_blockcount; | 5705 | ip->i_delayed_blks -= del.br_blockcount; |
diff --git a/fs/xfs/xfs_bmap_btree.c b/fs/xfs/xfs_bmap_btree.c index 0760d352586f..5c1ade06578e 100644 --- a/fs/xfs/xfs_bmap_btree.c +++ b/fs/xfs/xfs_bmap_btree.c | |||
@@ -590,7 +590,7 @@ xfs_bmbt_alloc_block( | |||
590 | cur->bc_private.b.allocated++; | 590 | cur->bc_private.b.allocated++; |
591 | cur->bc_private.b.ip->i_d.di_nblocks++; | 591 | cur->bc_private.b.ip->i_d.di_nblocks++; |
592 | xfs_trans_log_inode(args.tp, cur->bc_private.b.ip, XFS_ILOG_CORE); | 592 | xfs_trans_log_inode(args.tp, cur->bc_private.b.ip, XFS_ILOG_CORE); |
593 | XFS_TRANS_MOD_DQUOT_BYINO(args.mp, args.tp, cur->bc_private.b.ip, | 593 | xfs_trans_mod_dquot_byino(args.tp, cur->bc_private.b.ip, |
594 | XFS_TRANS_DQ_BCOUNT, 1L); | 594 | XFS_TRANS_DQ_BCOUNT, 1L); |
595 | 595 | ||
596 | new->l = cpu_to_be64(args.fsbno); | 596 | new->l = cpu_to_be64(args.fsbno); |
@@ -618,7 +618,7 @@ xfs_bmbt_free_block( | |||
618 | ip->i_d.di_nblocks--; | 618 | ip->i_d.di_nblocks--; |
619 | 619 | ||
620 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); | 620 | xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); |
621 | XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); | 621 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_BCOUNT, -1L); |
622 | xfs_trans_binval(tp, bp); | 622 | xfs_trans_binval(tp, bp); |
623 | return 0; | 623 | return 0; |
624 | } | 624 | } |
diff --git a/fs/xfs/xfs_iget.c b/fs/xfs/xfs_iget.c index 89b81eedce6a..73e1c0d767ac 100644 --- a/fs/xfs/xfs_iget.c +++ b/fs/xfs/xfs_iget.c | |||
@@ -500,10 +500,7 @@ xfs_ireclaim( | |||
500 | * ilock one but will still hold the iolock. | 500 | * ilock one but will still hold the iolock. |
501 | */ | 501 | */ |
502 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 502 | xfs_ilock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
503 | /* | 503 | xfs_qm_dqdetach(ip); |
504 | * Release dquots (and their references) if any. | ||
505 | */ | ||
506 | XFS_QM_DQDETACH(ip->i_mount, ip); | ||
507 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | 504 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); |
508 | 505 | ||
509 | switch (ip->i_d.di_mode & S_IFMT) { | 506 | switch (ip->i_d.di_mode & S_IFMT) { |
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c index 5aaa2d7ec155..feb30a92549b 100644 --- a/fs/xfs/xfs_iomap.c +++ b/fs/xfs/xfs_iomap.c | |||
@@ -385,7 +385,7 @@ xfs_iomap_write_direct( | |||
385 | * Make sure that the dquots are there. This doesn't hold | 385 | * Make sure that the dquots are there. This doesn't hold |
386 | * the ilock across a disk read. | 386 | * the ilock across a disk read. |
387 | */ | 387 | */ |
388 | error = XFS_QM_DQATTACH(ip->i_mount, ip, XFS_QMOPT_ILOCKED); | 388 | error = xfs_qm_dqattach_locked(ip, 0); |
389 | if (error) | 389 | if (error) |
390 | return XFS_ERROR(error); | 390 | return XFS_ERROR(error); |
391 | 391 | ||
@@ -444,8 +444,7 @@ xfs_iomap_write_direct( | |||
444 | if (error) | 444 | if (error) |
445 | goto error_out; | 445 | goto error_out; |
446 | 446 | ||
447 | error = XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, | 447 | error = xfs_trans_reserve_quota_nblks(tp, ip, qblocks, 0, quota_flag); |
448 | qblocks, 0, quota_flag); | ||
449 | if (error) | 448 | if (error) |
450 | goto error1; | 449 | goto error1; |
451 | 450 | ||
@@ -495,7 +494,7 @@ xfs_iomap_write_direct( | |||
495 | 494 | ||
496 | error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ | 495 | error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ |
497 | xfs_bmap_cancel(&free_list); | 496 | xfs_bmap_cancel(&free_list); |
498 | XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, qblocks, 0, quota_flag); | 497 | xfs_trans_unreserve_quota_nblks(tp, ip, qblocks, 0, quota_flag); |
499 | 498 | ||
500 | error1: /* Just cancel transaction */ | 499 | error1: /* Just cancel transaction */ |
501 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); | 500 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); |
@@ -582,7 +581,7 @@ xfs_iomap_write_delay( | |||
582 | * Make sure that the dquots are there. This doesn't hold | 581 | * Make sure that the dquots are there. This doesn't hold |
583 | * the ilock across a disk read. | 582 | * the ilock across a disk read. |
584 | */ | 583 | */ |
585 | error = XFS_QM_DQATTACH(mp, ip, XFS_QMOPT_ILOCKED); | 584 | error = xfs_qm_dqattach_locked(ip, 0); |
586 | if (error) | 585 | if (error) |
587 | return XFS_ERROR(error); | 586 | return XFS_ERROR(error); |
588 | 587 | ||
@@ -684,7 +683,8 @@ xfs_iomap_write_allocate( | |||
684 | /* | 683 | /* |
685 | * Make sure that the dquots are there. | 684 | * Make sure that the dquots are there. |
686 | */ | 685 | */ |
687 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 686 | error = xfs_qm_dqattach(ip, 0); |
687 | if (error) | ||
688 | return XFS_ERROR(error); | 688 | return XFS_ERROR(error); |
689 | 689 | ||
690 | offset_fsb = XFS_B_TO_FSBT(mp, offset); | 690 | offset_fsb = XFS_B_TO_FSBT(mp, offset); |
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 |
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index d6a64392f983..a5122382afde 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h | |||
@@ -64,6 +64,8 @@ struct xfs_swapext; | |||
64 | struct xfs_mru_cache; | 64 | struct xfs_mru_cache; |
65 | struct xfs_nameops; | 65 | struct xfs_nameops; |
66 | struct xfs_ail; | 66 | struct xfs_ail; |
67 | struct xfs_quotainfo; | ||
68 | |||
67 | 69 | ||
68 | /* | 70 | /* |
69 | * Prototypes and functions for the Data Migration subsystem. | 71 | * Prototypes and functions for the Data Migration subsystem. |
@@ -107,86 +109,6 @@ typedef struct xfs_dmops { | |||
107 | (*(mp)->m_dm_ops->xfs_send_unmount)(mp,ip,right,mode,rval,fl) | 109 | (*(mp)->m_dm_ops->xfs_send_unmount)(mp,ip,right,mode,rval,fl) |
108 | 110 | ||
109 | 111 | ||
110 | /* | ||
111 | * Prototypes and functions for the Quota Management subsystem. | ||
112 | */ | ||
113 | |||
114 | struct xfs_dquot; | ||
115 | struct xfs_dqtrxops; | ||
116 | struct xfs_quotainfo; | ||
117 | |||
118 | typedef int (*xfs_qminit_t)(struct xfs_mount *, uint *, uint *); | ||
119 | typedef int (*xfs_qmmount_t)(struct xfs_mount *, uint, uint); | ||
120 | typedef void (*xfs_qmunmount_t)(struct xfs_mount *); | ||
121 | typedef void (*xfs_qmdone_t)(struct xfs_mount *); | ||
122 | typedef void (*xfs_dqrele_t)(struct xfs_dquot *); | ||
123 | typedef int (*xfs_dqattach_t)(struct xfs_inode *, uint); | ||
124 | typedef void (*xfs_dqdetach_t)(struct xfs_inode *); | ||
125 | typedef int (*xfs_dqpurgeall_t)(struct xfs_mount *, uint); | ||
126 | typedef int (*xfs_dqvopalloc_t)(struct xfs_mount *, | ||
127 | struct xfs_inode *, uid_t, gid_t, prid_t, uint, | ||
128 | struct xfs_dquot **, struct xfs_dquot **); | ||
129 | typedef void (*xfs_dqvopcreate_t)(struct xfs_trans *, struct xfs_inode *, | ||
130 | struct xfs_dquot *, struct xfs_dquot *); | ||
131 | typedef int (*xfs_dqvoprename_t)(struct xfs_inode **); | ||
132 | typedef struct xfs_dquot * (*xfs_dqvopchown_t)( | ||
133 | struct xfs_trans *, struct xfs_inode *, | ||
134 | struct xfs_dquot **, struct xfs_dquot *); | ||
135 | typedef int (*xfs_dqvopchownresv_t)(struct xfs_trans *, struct xfs_inode *, | ||
136 | struct xfs_dquot *, struct xfs_dquot *, uint); | ||
137 | typedef void (*xfs_dqstatvfs_t)(struct xfs_inode *, struct kstatfs *); | ||
138 | typedef int (*xfs_dqsync_t)(struct xfs_mount *, int flags); | ||
139 | |||
140 | typedef struct xfs_qmops { | ||
141 | xfs_qminit_t xfs_qminit; | ||
142 | xfs_qmdone_t xfs_qmdone; | ||
143 | xfs_qmmount_t xfs_qmmount; | ||
144 | xfs_qmunmount_t xfs_qmunmount; | ||
145 | xfs_dqrele_t xfs_dqrele; | ||
146 | xfs_dqattach_t xfs_dqattach; | ||
147 | xfs_dqdetach_t xfs_dqdetach; | ||
148 | xfs_dqpurgeall_t xfs_dqpurgeall; | ||
149 | xfs_dqvopalloc_t xfs_dqvopalloc; | ||
150 | xfs_dqvopcreate_t xfs_dqvopcreate; | ||
151 | xfs_dqvoprename_t xfs_dqvoprename; | ||
152 | xfs_dqvopchown_t xfs_dqvopchown; | ||
153 | xfs_dqvopchownresv_t xfs_dqvopchownresv; | ||
154 | xfs_dqstatvfs_t xfs_dqstatvfs; | ||
155 | xfs_dqsync_t xfs_dqsync; | ||
156 | struct xfs_dqtrxops *xfs_dqtrxops; | ||
157 | } xfs_qmops_t; | ||
158 | |||
159 | #define XFS_QM_INIT(mp, mnt, fl) \ | ||
160 | (*(mp)->m_qm_ops->xfs_qminit)(mp, mnt, fl) | ||
161 | #define XFS_QM_MOUNT(mp, mnt, fl) \ | ||
162 | (*(mp)->m_qm_ops->xfs_qmmount)(mp, mnt, fl) | ||
163 | #define XFS_QM_UNMOUNT(mp) \ | ||
164 | (*(mp)->m_qm_ops->xfs_qmunmount)(mp) | ||
165 | #define XFS_QM_DONE(mp) \ | ||
166 | (*(mp)->m_qm_ops->xfs_qmdone)(mp) | ||
167 | #define XFS_QM_DQRELE(mp, dq) \ | ||
168 | (*(mp)->m_qm_ops->xfs_dqrele)(dq) | ||
169 | #define XFS_QM_DQATTACH(mp, ip, fl) \ | ||
170 | (*(mp)->m_qm_ops->xfs_dqattach)(ip, fl) | ||
171 | #define XFS_QM_DQDETACH(mp, ip) \ | ||
172 | (*(mp)->m_qm_ops->xfs_dqdetach)(ip) | ||
173 | #define XFS_QM_DQPURGEALL(mp, fl) \ | ||
174 | (*(mp)->m_qm_ops->xfs_dqpurgeall)(mp, fl) | ||
175 | #define XFS_QM_DQVOPALLOC(mp, ip, uid, gid, prid, fl, dq1, dq2) \ | ||
176 | (*(mp)->m_qm_ops->xfs_dqvopalloc)(mp, ip, uid, gid, prid, fl, dq1, dq2) | ||
177 | #define XFS_QM_DQVOPCREATE(mp, tp, ip, dq1, dq2) \ | ||
178 | (*(mp)->m_qm_ops->xfs_dqvopcreate)(tp, ip, dq1, dq2) | ||
179 | #define XFS_QM_DQVOPRENAME(mp, ip) \ | ||
180 | (*(mp)->m_qm_ops->xfs_dqvoprename)(ip) | ||
181 | #define XFS_QM_DQVOPCHOWN(mp, tp, ip, dqp, dq) \ | ||
182 | (*(mp)->m_qm_ops->xfs_dqvopchown)(tp, ip, dqp, dq) | ||
183 | #define XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, dq1, dq2, fl) \ | ||
184 | (*(mp)->m_qm_ops->xfs_dqvopchownresv)(tp, ip, dq1, dq2, fl) | ||
185 | #define XFS_QM_DQSTATVFS(ip, statp) \ | ||
186 | (*(ip)->i_mount->m_qm_ops->xfs_dqstatvfs)(ip, statp) | ||
187 | #define XFS_QM_DQSYNC(mp, flags) \ | ||
188 | (*(mp)->m_qm_ops->xfs_dqsync)(mp, flags) | ||
189 | |||
190 | #ifdef HAVE_PERCPU_SB | 112 | #ifdef HAVE_PERCPU_SB |
191 | 113 | ||
192 | /* | 114 | /* |
@@ -510,8 +432,6 @@ extern int xfs_sb_validate_fsb_count(struct xfs_sb *, __uint64_t); | |||
510 | 432 | ||
511 | extern int xfs_dmops_get(struct xfs_mount *); | 433 | extern int xfs_dmops_get(struct xfs_mount *); |
512 | extern void xfs_dmops_put(struct xfs_mount *); | 434 | extern void xfs_dmops_put(struct xfs_mount *); |
513 | extern int xfs_qmops_get(struct xfs_mount *); | ||
514 | extern void xfs_qmops_put(struct xfs_mount *); | ||
515 | 435 | ||
516 | extern struct xfs_dmops xfs_dmcore_xfs; | 436 | extern struct xfs_dmops xfs_dmcore_xfs; |
517 | 437 | ||
diff --git a/fs/xfs/xfs_qmops.c b/fs/xfs/xfs_qmops.c deleted file mode 100644 index e101790ea8e7..000000000000 --- a/fs/xfs/xfs_qmops.c +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2000-2005 Silicon Graphics, Inc. | ||
3 | * All Rights Reserved. | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or | ||
6 | * modify it under the terms of the GNU General Public License as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope that it would be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write the Free Software Foundation, | ||
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
17 | */ | ||
18 | #include "xfs.h" | ||
19 | #include "xfs_fs.h" | ||
20 | #include "xfs_types.h" | ||
21 | #include "xfs_log.h" | ||
22 | #include "xfs_inum.h" | ||
23 | #include "xfs_trans.h" | ||
24 | #include "xfs_sb.h" | ||
25 | #include "xfs_ag.h" | ||
26 | #include "xfs_dir2.h" | ||
27 | #include "xfs_dmapi.h" | ||
28 | #include "xfs_mount.h" | ||
29 | #include "xfs_quota.h" | ||
30 | #include "xfs_error.h" | ||
31 | |||
32 | |||
33 | STATIC struct xfs_dquot * | ||
34 | xfs_dqvopchown_default( | ||
35 | struct xfs_trans *tp, | ||
36 | struct xfs_inode *ip, | ||
37 | struct xfs_dquot **dqp, | ||
38 | struct xfs_dquot *dq) | ||
39 | { | ||
40 | return NULL; | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Clear the quotaflags in memory and in the superblock. | ||
45 | */ | ||
46 | int | ||
47 | xfs_mount_reset_sbqflags(xfs_mount_t *mp) | ||
48 | { | ||
49 | int error; | ||
50 | xfs_trans_t *tp; | ||
51 | |||
52 | mp->m_qflags = 0; | ||
53 | /* | ||
54 | * It is OK to look at sb_qflags here in mount path, | ||
55 | * without m_sb_lock. | ||
56 | */ | ||
57 | if (mp->m_sb.sb_qflags == 0) | ||
58 | return 0; | ||
59 | spin_lock(&mp->m_sb_lock); | ||
60 | mp->m_sb.sb_qflags = 0; | ||
61 | spin_unlock(&mp->m_sb_lock); | ||
62 | |||
63 | /* | ||
64 | * if the fs is readonly, let the incore superblock run | ||
65 | * with quotas off but don't flush the update out to disk | ||
66 | */ | ||
67 | if (mp->m_flags & XFS_MOUNT_RDONLY) | ||
68 | return 0; | ||
69 | #ifdef QUOTADEBUG | ||
70 | xfs_fs_cmn_err(CE_NOTE, mp, "Writing superblock quota changes"); | ||
71 | #endif | ||
72 | tp = xfs_trans_alloc(mp, XFS_TRANS_QM_SBCHANGE); | ||
73 | if ((error = xfs_trans_reserve(tp, 0, mp->m_sb.sb_sectsize + 128, 0, 0, | ||
74 | XFS_DEFAULT_LOG_COUNT))) { | ||
75 | xfs_trans_cancel(tp, 0); | ||
76 | xfs_fs_cmn_err(CE_ALERT, mp, | ||
77 | "xfs_mount_reset_sbqflags: Superblock update failed!"); | ||
78 | return error; | ||
79 | } | ||
80 | xfs_mod_sb(tp, XFS_SB_QFLAGS); | ||
81 | error = xfs_trans_commit(tp, 0); | ||
82 | return error; | ||
83 | } | ||
84 | |||
85 | STATIC int | ||
86 | xfs_noquota_init( | ||
87 | xfs_mount_t *mp, | ||
88 | uint *needquotamount, | ||
89 | uint *quotaflags) | ||
90 | { | ||
91 | int error = 0; | ||
92 | |||
93 | *quotaflags = 0; | ||
94 | *needquotamount = B_FALSE; | ||
95 | |||
96 | ASSERT(!XFS_IS_QUOTA_ON(mp)); | ||
97 | |||
98 | /* | ||
99 | * If a file system had quotas running earlier, but decided to | ||
100 | * mount without -o uquota/pquota/gquota options, revoke the | ||
101 | * quotachecked license. | ||
102 | */ | ||
103 | if (mp->m_sb.sb_qflags & XFS_ALL_QUOTA_ACCT) { | ||
104 | cmn_err(CE_NOTE, | ||
105 | "XFS resetting qflags for filesystem %s", | ||
106 | mp->m_fsname); | ||
107 | |||
108 | error = xfs_mount_reset_sbqflags(mp); | ||
109 | } | ||
110 | return error; | ||
111 | } | ||
112 | |||
113 | static struct xfs_qmops xfs_qmcore_stub = { | ||
114 | .xfs_qminit = (xfs_qminit_t) xfs_noquota_init, | ||
115 | .xfs_qmdone = (xfs_qmdone_t) fs_noerr, | ||
116 | .xfs_qmmount = (xfs_qmmount_t) fs_noerr, | ||
117 | .xfs_qmunmount = (xfs_qmunmount_t) fs_noerr, | ||
118 | .xfs_dqrele = (xfs_dqrele_t) fs_noerr, | ||
119 | .xfs_dqattach = (xfs_dqattach_t) fs_noerr, | ||
120 | .xfs_dqdetach = (xfs_dqdetach_t) fs_noerr, | ||
121 | .xfs_dqpurgeall = (xfs_dqpurgeall_t) fs_noerr, | ||
122 | .xfs_dqvopalloc = (xfs_dqvopalloc_t) fs_noerr, | ||
123 | .xfs_dqvopcreate = (xfs_dqvopcreate_t) fs_noerr, | ||
124 | .xfs_dqvoprename = (xfs_dqvoprename_t) fs_noerr, | ||
125 | .xfs_dqvopchown = xfs_dqvopchown_default, | ||
126 | .xfs_dqvopchownresv = (xfs_dqvopchownresv_t) fs_noerr, | ||
127 | .xfs_dqstatvfs = (xfs_dqstatvfs_t) fs_noval, | ||
128 | .xfs_dqsync = (xfs_dqsync_t) fs_noerr, | ||
129 | }; | ||
130 | |||
131 | int | ||
132 | xfs_qmops_get(struct xfs_mount *mp) | ||
133 | { | ||
134 | if (XFS_IS_QUOTA_RUNNING(mp)) { | ||
135 | #ifdef CONFIG_XFS_QUOTA | ||
136 | mp->m_qm_ops = &xfs_qmcore_xfs; | ||
137 | #else | ||
138 | cmn_err(CE_WARN, | ||
139 | "XFS: qouta support not available in this kernel."); | ||
140 | return EINVAL; | ||
141 | #endif | ||
142 | } else { | ||
143 | mp->m_qm_ops = &xfs_qmcore_stub; | ||
144 | } | ||
145 | |||
146 | return 0; | ||
147 | } | ||
148 | |||
149 | void | ||
150 | xfs_qmops_put(struct xfs_mount *mp) | ||
151 | { | ||
152 | } | ||
diff --git a/fs/xfs/xfs_quota.h b/fs/xfs/xfs_quota.h index f5d1202dde25..079d2e61c626 100644 --- a/fs/xfs/xfs_quota.h +++ b/fs/xfs/xfs_quota.h | |||
@@ -197,7 +197,6 @@ typedef struct xfs_qoff_logformat { | |||
197 | #define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */ | 197 | #define XFS_QMOPT_UMOUNTING 0x0000100 /* filesys is being unmounted */ |
198 | #define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quotacheck) */ | 198 | #define XFS_QMOPT_DOLOG 0x0000200 /* log buf changes (in quotacheck) */ |
199 | #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ | 199 | #define XFS_QMOPT_DOWARN 0x0000400 /* increase warning cnt if needed */ |
200 | #define XFS_QMOPT_ILOCKED 0x0000800 /* inode is already locked (excl) */ | ||
201 | #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ | 200 | #define XFS_QMOPT_DQREPAIR 0x0001000 /* repair dquot if damaged */ |
202 | #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ | 201 | #define XFS_QMOPT_GQUOTA 0x0002000 /* group dquot requested */ |
203 | #define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */ | 202 | #define XFS_QMOPT_ENOSPC 0x0004000 /* enospc instead of edquot (prj) */ |
@@ -302,69 +301,72 @@ typedef struct xfs_dqtrx { | |||
302 | long qt_delrtb_delta; /* delayed RT blk count changes */ | 301 | long qt_delrtb_delta; /* delayed RT blk count changes */ |
303 | } xfs_dqtrx_t; | 302 | } xfs_dqtrx_t; |
304 | 303 | ||
305 | /* | 304 | #ifdef CONFIG_XFS_QUOTA |
306 | * Dquot transaction functions, used if quota is enabled. | 305 | extern void xfs_trans_dup_dqinfo(struct xfs_trans *, struct xfs_trans *); |
307 | */ | 306 | extern void xfs_trans_free_dqinfo(struct xfs_trans *); |
308 | typedef void (*qo_dup_dqinfo_t)(struct xfs_trans *, struct xfs_trans *); | 307 | extern void xfs_trans_mod_dquot_byino(struct xfs_trans *, struct xfs_inode *, |
309 | typedef void (*qo_mod_dquot_byino_t)(struct xfs_trans *, | 308 | uint, long); |
310 | struct xfs_inode *, uint, long); | 309 | extern void xfs_trans_apply_dquot_deltas(struct xfs_trans *); |
311 | typedef void (*qo_free_dqinfo_t)(struct xfs_trans *); | 310 | extern void xfs_trans_unreserve_and_mod_dquots(struct xfs_trans *); |
312 | typedef void (*qo_apply_dquot_deltas_t)(struct xfs_trans *); | 311 | extern int xfs_trans_reserve_quota_nblks(struct xfs_trans *, |
313 | typedef void (*qo_unreserve_and_mod_dquots_t)(struct xfs_trans *); | 312 | struct xfs_inode *, long, long, uint); |
314 | typedef int (*qo_reserve_quota_nblks_t)( | 313 | extern int xfs_trans_reserve_quota_bydquots(struct xfs_trans *, |
315 | struct xfs_trans *, struct xfs_mount *, | 314 | struct xfs_mount *, struct xfs_dquot *, |
316 | struct xfs_inode *, long, long, uint); | 315 | struct xfs_dquot *, long, long, uint); |
317 | typedef int (*qo_reserve_quota_bydquots_t)( | 316 | |
318 | struct xfs_trans *, struct xfs_mount *, | 317 | extern int xfs_qm_vop_dqalloc(struct xfs_inode *, uid_t, gid_t, prid_t, uint, |
319 | struct xfs_dquot *, struct xfs_dquot *, | 318 | struct xfs_dquot **, struct xfs_dquot **); |
320 | long, long, uint); | 319 | extern void xfs_qm_vop_create_dqattach(struct xfs_trans *, struct xfs_inode *, |
321 | typedef struct xfs_dqtrxops { | 320 | struct xfs_dquot *, struct xfs_dquot *); |
322 | qo_dup_dqinfo_t qo_dup_dqinfo; | 321 | extern int xfs_qm_vop_rename_dqattach(struct xfs_inode **); |
323 | qo_free_dqinfo_t qo_free_dqinfo; | 322 | extern struct xfs_dquot *xfs_qm_vop_chown(struct xfs_trans *, |
324 | qo_mod_dquot_byino_t qo_mod_dquot_byino; | 323 | struct xfs_inode *, struct xfs_dquot **, struct xfs_dquot *); |
325 | qo_apply_dquot_deltas_t qo_apply_dquot_deltas; | 324 | extern int xfs_qm_vop_chown_reserve(struct xfs_trans *, struct xfs_inode *, |
326 | qo_reserve_quota_nblks_t qo_reserve_quota_nblks; | 325 | struct xfs_dquot *, struct xfs_dquot *, uint); |
327 | qo_reserve_quota_bydquots_t qo_reserve_quota_bydquots; | 326 | extern int xfs_qm_dqattach(struct xfs_inode *, uint); |
328 | qo_unreserve_and_mod_dquots_t qo_unreserve_and_mod_dquots; | 327 | extern int xfs_qm_dqattach_locked(struct xfs_inode *, uint); |
329 | } xfs_dqtrxops_t; | 328 | extern void xfs_qm_dqdetach(struct xfs_inode *); |
330 | 329 | extern void xfs_qm_dqrele(struct xfs_dquot *); | |
331 | #define XFS_DQTRXOP(mp, tp, op, args...) \ | 330 | extern void xfs_qm_statvfs(struct xfs_inode *, struct kstatfs *); |
332 | ((mp)->m_qm_ops->xfs_dqtrxops ? \ | 331 | extern int xfs_qm_sync(struct xfs_mount *, int); |
333 | ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : 0) | 332 | extern int xfs_qm_newmount(struct xfs_mount *, uint *, uint *); |
334 | 333 | extern void xfs_qm_mount_quotas(struct xfs_mount *); | |
335 | #define XFS_DQTRXOP_VOID(mp, tp, op, args...) \ | 334 | extern void xfs_qm_unmount(struct xfs_mount *); |
336 | ((mp)->m_qm_ops->xfs_dqtrxops ? \ | 335 | extern void xfs_qm_unmount_quotas(struct xfs_mount *); |
337 | ((mp)->m_qm_ops->xfs_dqtrxops->op)(tp, ## args) : (void)0) | 336 | |
338 | 337 | #else | |
339 | #define XFS_TRANS_DUP_DQINFO(mp, otp, ntp) \ | 338 | #define xfs_trans_dup_dqinfo(tp, tp2) |
340 | XFS_DQTRXOP_VOID(mp, otp, qo_dup_dqinfo, ntp) | 339 | #define xfs_trans_free_dqinfo(tp) |
341 | #define XFS_TRANS_FREE_DQINFO(mp, tp) \ | 340 | #define xfs_trans_mod_dquot_byino(tp, ip, fields, delta) |
342 | XFS_DQTRXOP_VOID(mp, tp, qo_free_dqinfo) | 341 | #define xfs_trans_apply_dquot_deltas(tp) |
343 | #define XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, field, delta) \ | 342 | #define xfs_trans_unreserve_and_mod_dquots(tp) |
344 | XFS_DQTRXOP_VOID(mp, tp, qo_mod_dquot_byino, ip, field, delta) | 343 | #define xfs_trans_reserve_quota_nblks(tp, ip, nblks, ninos, flags) (0) |
345 | #define XFS_TRANS_APPLY_DQUOT_DELTAS(mp, tp) \ | 344 | #define xfs_trans_reserve_quota_bydquots(tp, mp, u, g, nb, ni, fl) (0) |
346 | XFS_DQTRXOP_VOID(mp, tp, qo_apply_dquot_deltas) | 345 | #define xfs_qm_vop_dqalloc(ip, uid, gid, prid, fl, ou, og) (0) |
347 | #define XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, fl) \ | 346 | #define xfs_qm_vop_create_dqattach(tp, ip, u, g) |
348 | XFS_DQTRXOP(mp, tp, qo_reserve_quota_nblks, mp, ip, nblks, ninos, fl) | 347 | #define xfs_qm_vop_rename_dqattach(it) (0) |
349 | #define XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, fl) \ | 348 | #define xfs_qm_vop_chown(tp, ip, old, new) (NULL) |
350 | XFS_DQTRXOP(mp, tp, qo_reserve_quota_bydquots, mp, ud, gd, nb, ni, fl) | 349 | #define xfs_qm_vop_chown_reserve(tp, ip, u, g, fl) (0) |
351 | #define XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp) \ | 350 | #define xfs_qm_dqattach(ip, fl) (0) |
352 | XFS_DQTRXOP_VOID(mp, tp, qo_unreserve_and_mod_dquots) | 351 | #define xfs_qm_dqattach_locked(ip, fl) (0) |
353 | 352 | #define xfs_qm_dqdetach(ip) | |
354 | #define XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, nblks, ninos, flags) \ | 353 | #define xfs_qm_dqrele(d) |
355 | XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, -(nblks), -(ninos), flags) | 354 | #define xfs_qm_statvfs(ip, s) |
356 | #define XFS_TRANS_RESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \ | 355 | #define xfs_qm_sync(mp, fl) (0) |
357 | XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, nb, ni, \ | 356 | #define xfs_qm_newmount(mp, a, b) (0) |
358 | f | XFS_QMOPT_RES_REGBLKS) | 357 | #define xfs_qm_mount_quotas(mp) |
359 | #define XFS_TRANS_UNRESERVE_QUOTA(mp, tp, ud, gd, nb, ni, f) \ | 358 | #define xfs_qm_unmount(mp) |
360 | XFS_TRANS_RESERVE_QUOTA_BYDQUOTS(mp, tp, ud, gd, -(nb), -(ni), \ | 359 | #define xfs_qm_unmount_quotas(mp) (0) |
360 | #endif /* CONFIG_XFS_QUOTA */ | ||
361 | |||
362 | #define xfs_trans_unreserve_quota_nblks(tp, ip, nblks, ninos, flags) \ | ||
363 | xfs_trans_reserve_quota_nblks(tp, ip, -(nblks), -(ninos), flags) | ||
364 | #define xfs_trans_reserve_quota(tp, mp, ud, gd, nb, ni, f) \ | ||
365 | xfs_trans_reserve_quota_bydquots(tp, mp, ud, gd, nb, ni, \ | ||
361 | f | XFS_QMOPT_RES_REGBLKS) | 366 | f | XFS_QMOPT_RES_REGBLKS) |
362 | 367 | ||
363 | extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); | 368 | extern int xfs_qm_dqcheck(xfs_disk_dquot_t *, xfs_dqid_t, uint, uint, char *); |
364 | extern int xfs_mount_reset_sbqflags(struct xfs_mount *); | 369 | extern int xfs_mount_reset_sbqflags(struct xfs_mount *); |
365 | 370 | ||
366 | extern struct xfs_qmops xfs_qmcore_xfs; | ||
367 | |||
368 | #endif /* __KERNEL__ */ | 371 | #endif /* __KERNEL__ */ |
369 | |||
370 | #endif /* __XFS_QUOTA_H__ */ | 372 | #endif /* __XFS_QUOTA_H__ */ |
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c index 58f85e9cd11d..b81deea0ce19 100644 --- a/fs/xfs/xfs_rename.c +++ b/fs/xfs/xfs_rename.c | |||
@@ -166,7 +166,8 @@ xfs_rename( | |||
166 | /* | 166 | /* |
167 | * Attach the dquots to the inodes | 167 | * Attach the dquots to the inodes |
168 | */ | 168 | */ |
169 | if ((error = XFS_QM_DQVOPRENAME(mp, inodes))) { | 169 | error = xfs_qm_vop_rename_dqattach(inodes); |
170 | if (error) { | ||
170 | xfs_trans_cancel(tp, cancel_flags); | 171 | xfs_trans_cancel(tp, cancel_flags); |
171 | goto std_return; | 172 | goto std_return; |
172 | } | 173 | } |
diff --git a/fs/xfs/xfs_trans.c b/fs/xfs/xfs_trans.c index 8570b826fedd..fffabc0aefcb 100644 --- a/fs/xfs/xfs_trans.c +++ b/fs/xfs/xfs_trans.c | |||
@@ -297,7 +297,7 @@ xfs_trans_dup( | |||
297 | tp->t_rtx_res = tp->t_rtx_res_used; | 297 | tp->t_rtx_res = tp->t_rtx_res_used; |
298 | ntp->t_pflags = tp->t_pflags; | 298 | ntp->t_pflags = tp->t_pflags; |
299 | 299 | ||
300 | XFS_TRANS_DUP_DQINFO(tp->t_mountp, tp, ntp); | 300 | xfs_trans_dup_dqinfo(tp, ntp); |
301 | 301 | ||
302 | atomic_inc(&tp->t_mountp->m_active_trans); | 302 | atomic_inc(&tp->t_mountp->m_active_trans); |
303 | return ntp; | 303 | return ntp; |
@@ -831,7 +831,7 @@ shut_us_down: | |||
831 | * means is that we have some (non-persistent) quota | 831 | * means is that we have some (non-persistent) quota |
832 | * reservations that need to be unreserved. | 832 | * reservations that need to be unreserved. |
833 | */ | 833 | */ |
834 | XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp); | 834 | xfs_trans_unreserve_and_mod_dquots(tp); |
835 | if (tp->t_ticket) { | 835 | if (tp->t_ticket) { |
836 | commit_lsn = xfs_log_done(mp, tp->t_ticket, | 836 | commit_lsn = xfs_log_done(mp, tp->t_ticket, |
837 | NULL, log_flags); | 837 | NULL, log_flags); |
@@ -850,10 +850,9 @@ shut_us_down: | |||
850 | /* | 850 | /* |
851 | * If we need to update the superblock, then do it now. | 851 | * If we need to update the superblock, then do it now. |
852 | */ | 852 | */ |
853 | if (tp->t_flags & XFS_TRANS_SB_DIRTY) { | 853 | if (tp->t_flags & XFS_TRANS_SB_DIRTY) |
854 | xfs_trans_apply_sb_deltas(tp); | 854 | xfs_trans_apply_sb_deltas(tp); |
855 | } | 855 | xfs_trans_apply_dquot_deltas(tp); |
856 | XFS_TRANS_APPLY_DQUOT_DELTAS(mp, tp); | ||
857 | 856 | ||
858 | /* | 857 | /* |
859 | * Ask each log item how many log_vector entries it will | 858 | * Ask each log item how many log_vector entries it will |
@@ -1058,7 +1057,7 @@ xfs_trans_uncommit( | |||
1058 | } | 1057 | } |
1059 | 1058 | ||
1060 | xfs_trans_unreserve_and_mod_sb(tp); | 1059 | xfs_trans_unreserve_and_mod_sb(tp); |
1061 | XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(tp->t_mountp, tp); | 1060 | xfs_trans_unreserve_and_mod_dquots(tp); |
1062 | 1061 | ||
1063 | xfs_trans_free_items(tp, flags); | 1062 | xfs_trans_free_items(tp, flags); |
1064 | xfs_trans_free_busy(tp); | 1063 | xfs_trans_free_busy(tp); |
@@ -1183,7 +1182,7 @@ xfs_trans_cancel( | |||
1183 | } | 1182 | } |
1184 | #endif | 1183 | #endif |
1185 | xfs_trans_unreserve_and_mod_sb(tp); | 1184 | xfs_trans_unreserve_and_mod_sb(tp); |
1186 | XFS_TRANS_UNRESERVE_AND_MOD_DQUOTS(mp, tp); | 1185 | xfs_trans_unreserve_and_mod_dquots(tp); |
1187 | 1186 | ||
1188 | if (tp->t_ticket) { | 1187 | if (tp->t_ticket) { |
1189 | if (flags & XFS_TRANS_RELEASE_LOG_RES) { | 1188 | if (flags & XFS_TRANS_RELEASE_LOG_RES) { |
@@ -1213,7 +1212,7 @@ xfs_trans_free( | |||
1213 | xfs_trans_t *tp) | 1212 | xfs_trans_t *tp) |
1214 | { | 1213 | { |
1215 | atomic_dec(&tp->t_mountp->m_active_trans); | 1214 | atomic_dec(&tp->t_mountp->m_active_trans); |
1216 | XFS_TRANS_FREE_DQINFO(tp->t_mountp, tp); | 1215 | xfs_trans_free_dqinfo(tp); |
1217 | kmem_zone_free(xfs_trans_zone, tp); | 1216 | kmem_zone_free(xfs_trans_zone, tp); |
1218 | } | 1217 | } |
1219 | 1218 | ||
diff --git a/fs/xfs/xfs_utils.c b/fs/xfs/xfs_utils.c index 79b9e5ea5359..4d88616bde91 100644 --- a/fs/xfs/xfs_utils.c +++ b/fs/xfs/xfs_utils.c | |||
@@ -166,7 +166,7 @@ xfs_dir_ialloc( | |||
166 | xfs_buf_relse(ialloc_context); | 166 | xfs_buf_relse(ialloc_context); |
167 | if (dqinfo) { | 167 | if (dqinfo) { |
168 | tp->t_dqinfo = dqinfo; | 168 | tp->t_dqinfo = dqinfo; |
169 | XFS_TRANS_FREE_DQINFO(tp->t_mountp, tp); | 169 | xfs_trans_free_dqinfo(tp); |
170 | } | 170 | } |
171 | *tpp = ntp; | 171 | *tpp = ntp; |
172 | *ipp = NULL; | 172 | *ipp = NULL; |
diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 19cf90a9c762..b56321b2b9f0 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c | |||
@@ -118,7 +118,7 @@ xfs_setattr( | |||
118 | */ | 118 | */ |
119 | ASSERT(udqp == NULL); | 119 | ASSERT(udqp == NULL); |
120 | ASSERT(gdqp == NULL); | 120 | ASSERT(gdqp == NULL); |
121 | code = XFS_QM_DQVOPALLOC(mp, ip, uid, gid, ip->i_d.di_projid, | 121 | code = xfs_qm_vop_dqalloc(ip, uid, gid, ip->i_d.di_projid, |
122 | qflags, &udqp, &gdqp); | 122 | qflags, &udqp, &gdqp); |
123 | if (code) | 123 | if (code) |
124 | return code; | 124 | return code; |
@@ -180,10 +180,11 @@ xfs_setattr( | |||
180 | * Do a quota reservation only if uid/gid is actually | 180 | * Do a quota reservation only if uid/gid is actually |
181 | * going to change. | 181 | * going to change. |
182 | */ | 182 | */ |
183 | if ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || | 183 | if (XFS_IS_QUOTA_RUNNING(mp) && |
184 | (XFS_IS_GQUOTA_ON(mp) && igid != gid)) { | 184 | ((XFS_IS_UQUOTA_ON(mp) && iuid != uid) || |
185 | (XFS_IS_GQUOTA_ON(mp) && igid != gid))) { | ||
185 | ASSERT(tp); | 186 | ASSERT(tp); |
186 | code = XFS_QM_DQVOPCHOWNRESV(mp, tp, ip, udqp, gdqp, | 187 | code = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp, |
187 | capable(CAP_FOWNER) ? | 188 | capable(CAP_FOWNER) ? |
188 | XFS_QMOPT_FORCE_RES : 0); | 189 | XFS_QMOPT_FORCE_RES : 0); |
189 | if (code) /* out of quota */ | 190 | if (code) /* out of quota */ |
@@ -217,7 +218,7 @@ xfs_setattr( | |||
217 | /* | 218 | /* |
218 | * Make sure that the dquots are attached to the inode. | 219 | * Make sure that the dquots are attached to the inode. |
219 | */ | 220 | */ |
220 | code = XFS_QM_DQATTACH(mp, ip, XFS_QMOPT_ILOCKED); | 221 | code = xfs_qm_dqattach_locked(ip, 0); |
221 | if (code) | 222 | if (code) |
222 | goto error_return; | 223 | goto error_return; |
223 | 224 | ||
@@ -351,21 +352,21 @@ xfs_setattr( | |||
351 | * in the transaction. | 352 | * in the transaction. |
352 | */ | 353 | */ |
353 | if (iuid != uid) { | 354 | if (iuid != uid) { |
354 | if (XFS_IS_UQUOTA_ON(mp)) { | 355 | if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_UQUOTA_ON(mp)) { |
355 | ASSERT(mask & ATTR_UID); | 356 | ASSERT(mask & ATTR_UID); |
356 | ASSERT(udqp); | 357 | ASSERT(udqp); |
357 | olddquot1 = XFS_QM_DQVOPCHOWN(mp, tp, ip, | 358 | olddquot1 = xfs_qm_vop_chown(tp, ip, |
358 | &ip->i_udquot, udqp); | 359 | &ip->i_udquot, udqp); |
359 | } | 360 | } |
360 | ip->i_d.di_uid = uid; | 361 | ip->i_d.di_uid = uid; |
361 | inode->i_uid = uid; | 362 | inode->i_uid = uid; |
362 | } | 363 | } |
363 | if (igid != gid) { | 364 | if (igid != gid) { |
364 | if (XFS_IS_GQUOTA_ON(mp)) { | 365 | if (XFS_IS_QUOTA_RUNNING(mp) && XFS_IS_GQUOTA_ON(mp)) { |
365 | ASSERT(!XFS_IS_PQUOTA_ON(mp)); | 366 | ASSERT(!XFS_IS_PQUOTA_ON(mp)); |
366 | ASSERT(mask & ATTR_GID); | 367 | ASSERT(mask & ATTR_GID); |
367 | ASSERT(gdqp); | 368 | ASSERT(gdqp); |
368 | olddquot2 = XFS_QM_DQVOPCHOWN(mp, tp, ip, | 369 | olddquot2 = xfs_qm_vop_chown(tp, ip, |
369 | &ip->i_gdquot, gdqp); | 370 | &ip->i_gdquot, gdqp); |
370 | } | 371 | } |
371 | ip->i_d.di_gid = gid; | 372 | ip->i_d.di_gid = gid; |
@@ -461,10 +462,10 @@ xfs_setattr( | |||
461 | /* | 462 | /* |
462 | * Release any dquot(s) the inode had kept before chown. | 463 | * Release any dquot(s) the inode had kept before chown. |
463 | */ | 464 | */ |
464 | XFS_QM_DQRELE(mp, olddquot1); | 465 | xfs_qm_dqrele(olddquot1); |
465 | XFS_QM_DQRELE(mp, olddquot2); | 466 | xfs_qm_dqrele(olddquot2); |
466 | XFS_QM_DQRELE(mp, udqp); | 467 | xfs_qm_dqrele(udqp); |
467 | XFS_QM_DQRELE(mp, gdqp); | 468 | xfs_qm_dqrele(gdqp); |
468 | 469 | ||
469 | if (code) { | 470 | if (code) { |
470 | return code; | 471 | return code; |
@@ -482,8 +483,8 @@ xfs_setattr( | |||
482 | commit_flags |= XFS_TRANS_ABORT; | 483 | commit_flags |= XFS_TRANS_ABORT; |
483 | /* FALLTHROUGH */ | 484 | /* FALLTHROUGH */ |
484 | error_return: | 485 | error_return: |
485 | XFS_QM_DQRELE(mp, udqp); | 486 | xfs_qm_dqrele(udqp); |
486 | XFS_QM_DQRELE(mp, gdqp); | 487 | xfs_qm_dqrele(gdqp); |
487 | if (tp) { | 488 | if (tp) { |
488 | xfs_trans_cancel(tp, commit_flags); | 489 | xfs_trans_cancel(tp, commit_flags); |
489 | } | 490 | } |
@@ -739,7 +740,8 @@ xfs_free_eofblocks( | |||
739 | /* | 740 | /* |
740 | * Attach the dquots to the inode up front. | 741 | * Attach the dquots to the inode up front. |
741 | */ | 742 | */ |
742 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 743 | error = xfs_qm_dqattach(ip, 0); |
744 | if (error) | ||
743 | return error; | 745 | return error; |
744 | 746 | ||
745 | /* | 747 | /* |
@@ -1181,7 +1183,8 @@ xfs_inactive( | |||
1181 | 1183 | ||
1182 | ASSERT(ip->i_d.di_nlink == 0); | 1184 | ASSERT(ip->i_d.di_nlink == 0); |
1183 | 1185 | ||
1184 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 1186 | error = xfs_qm_dqattach(ip, 0); |
1187 | if (error) | ||
1185 | return VN_INACTIVE_CACHE; | 1188 | return VN_INACTIVE_CACHE; |
1186 | 1189 | ||
1187 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); | 1190 | tp = xfs_trans_alloc(mp, XFS_TRANS_INACTIVE); |
@@ -1307,7 +1310,7 @@ xfs_inactive( | |||
1307 | /* | 1310 | /* |
1308 | * Credit the quota account(s). The inode is gone. | 1311 | * Credit the quota account(s). The inode is gone. |
1309 | */ | 1312 | */ |
1310 | XFS_TRANS_MOD_DQUOT_BYINO(mp, tp, ip, XFS_TRANS_DQ_ICOUNT, -1); | 1313 | xfs_trans_mod_dquot_byino(tp, ip, XFS_TRANS_DQ_ICOUNT, -1); |
1311 | 1314 | ||
1312 | /* | 1315 | /* |
1313 | * Just ignore errors at this point. There is nothing we can | 1316 | * Just ignore errors at this point. There is nothing we can |
@@ -1323,11 +1326,11 @@ xfs_inactive( | |||
1323 | xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: " | 1326 | xfs_fs_cmn_err(CE_NOTE, mp, "xfs_inactive: " |
1324 | "xfs_trans_commit() returned error %d", error); | 1327 | "xfs_trans_commit() returned error %d", error); |
1325 | } | 1328 | } |
1329 | |||
1326 | /* | 1330 | /* |
1327 | * Release the dquots held by inode, if any. | 1331 | * Release the dquots held by inode, if any. |
1328 | */ | 1332 | */ |
1329 | XFS_QM_DQDETACH(mp, ip); | 1333 | xfs_qm_dqdetach(ip); |
1330 | |||
1331 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); | 1334 | xfs_iunlock(ip, XFS_IOLOCK_EXCL | XFS_ILOCK_EXCL); |
1332 | 1335 | ||
1333 | out: | 1336 | out: |
@@ -1427,8 +1430,7 @@ xfs_create( | |||
1427 | /* | 1430 | /* |
1428 | * Make sure that we have allocated dquot(s) on disk. | 1431 | * Make sure that we have allocated dquot(s) on disk. |
1429 | */ | 1432 | */ |
1430 | error = XFS_QM_DQVOPALLOC(mp, dp, | 1433 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, |
1431 | current_fsuid(), current_fsgid(), prid, | ||
1432 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); | 1434 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); |
1433 | if (error) | 1435 | if (error) |
1434 | goto std_return; | 1436 | goto std_return; |
@@ -1489,7 +1491,7 @@ xfs_create( | |||
1489 | /* | 1491 | /* |
1490 | * Reserve disk quota and the inode. | 1492 | * Reserve disk quota and the inode. |
1491 | */ | 1493 | */ |
1492 | error = XFS_TRANS_RESERVE_QUOTA(mp, tp, udqp, gdqp, resblks, 1, 0); | 1494 | error = xfs_trans_reserve_quota(tp, mp, udqp, gdqp, resblks, 1, 0); |
1493 | if (error) | 1495 | if (error) |
1494 | goto out_trans_cancel; | 1496 | goto out_trans_cancel; |
1495 | 1497 | ||
@@ -1561,7 +1563,7 @@ xfs_create( | |||
1561 | * These ids of the inode couldn't have changed since the new | 1563 | * These ids of the inode couldn't have changed since the new |
1562 | * inode has been locked ever since it was created. | 1564 | * inode has been locked ever since it was created. |
1563 | */ | 1565 | */ |
1564 | XFS_QM_DQVOPCREATE(mp, tp, ip, udqp, gdqp); | 1566 | xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp); |
1565 | 1567 | ||
1566 | /* | 1568 | /* |
1567 | * xfs_trans_commit normally decrements the vnode ref count | 1569 | * xfs_trans_commit normally decrements the vnode ref count |
@@ -1580,8 +1582,8 @@ xfs_create( | |||
1580 | goto out_dqrele; | 1582 | goto out_dqrele; |
1581 | } | 1583 | } |
1582 | 1584 | ||
1583 | XFS_QM_DQRELE(mp, udqp); | 1585 | xfs_qm_dqrele(udqp); |
1584 | XFS_QM_DQRELE(mp, gdqp); | 1586 | xfs_qm_dqrele(gdqp); |
1585 | 1587 | ||
1586 | *ipp = ip; | 1588 | *ipp = ip; |
1587 | 1589 | ||
@@ -1602,8 +1604,8 @@ xfs_create( | |||
1602 | out_trans_cancel: | 1604 | out_trans_cancel: |
1603 | xfs_trans_cancel(tp, cancel_flags); | 1605 | xfs_trans_cancel(tp, cancel_flags); |
1604 | out_dqrele: | 1606 | out_dqrele: |
1605 | XFS_QM_DQRELE(mp, udqp); | 1607 | xfs_qm_dqrele(udqp); |
1606 | XFS_QM_DQRELE(mp, gdqp); | 1608 | xfs_qm_dqrele(gdqp); |
1607 | 1609 | ||
1608 | if (unlock_dp_on_error) | 1610 | if (unlock_dp_on_error) |
1609 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 1611 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
@@ -1837,11 +1839,11 @@ xfs_remove( | |||
1837 | return error; | 1839 | return error; |
1838 | } | 1840 | } |
1839 | 1841 | ||
1840 | error = XFS_QM_DQATTACH(mp, dp, 0); | 1842 | error = xfs_qm_dqattach(dp, 0); |
1841 | if (error) | 1843 | if (error) |
1842 | goto std_return; | 1844 | goto std_return; |
1843 | 1845 | ||
1844 | error = XFS_QM_DQATTACH(mp, ip, 0); | 1846 | error = xfs_qm_dqattach(ip, 0); |
1845 | if (error) | 1847 | if (error) |
1846 | goto std_return; | 1848 | goto std_return; |
1847 | 1849 | ||
@@ -2028,11 +2030,11 @@ xfs_link( | |||
2028 | 2030 | ||
2029 | /* Return through std_return after this point. */ | 2031 | /* Return through std_return after this point. */ |
2030 | 2032 | ||
2031 | error = XFS_QM_DQATTACH(mp, sip, 0); | 2033 | error = xfs_qm_dqattach(sip, 0); |
2032 | if (error) | 2034 | if (error) |
2033 | goto std_return; | 2035 | goto std_return; |
2034 | 2036 | ||
2035 | error = XFS_QM_DQATTACH(mp, tdp, 0); | 2037 | error = xfs_qm_dqattach(tdp, 0); |
2036 | if (error) | 2038 | if (error) |
2037 | goto std_return; | 2039 | goto std_return; |
2038 | 2040 | ||
@@ -2205,8 +2207,7 @@ xfs_symlink( | |||
2205 | /* | 2207 | /* |
2206 | * Make sure that we have allocated dquot(s) on disk. | 2208 | * Make sure that we have allocated dquot(s) on disk. |
2207 | */ | 2209 | */ |
2208 | error = XFS_QM_DQVOPALLOC(mp, dp, | 2210 | error = xfs_qm_vop_dqalloc(dp, current_fsuid(), current_fsgid(), prid, |
2209 | current_fsuid(), current_fsgid(), prid, | ||
2210 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); | 2211 | XFS_QMOPT_QUOTALL | XFS_QMOPT_INHERIT, &udqp, &gdqp); |
2211 | if (error) | 2212 | if (error) |
2212 | goto std_return; | 2213 | goto std_return; |
@@ -2248,7 +2249,7 @@ xfs_symlink( | |||
2248 | /* | 2249 | /* |
2249 | * Reserve disk quota : blocks and inode. | 2250 | * Reserve disk quota : blocks and inode. |
2250 | */ | 2251 | */ |
2251 | error = XFS_TRANS_RESERVE_QUOTA(mp, tp, udqp, gdqp, resblks, 1, 0); | 2252 | error = xfs_trans_reserve_quota(tp, mp, udqp, gdqp, resblks, 1, 0); |
2252 | if (error) | 2253 | if (error) |
2253 | goto error_return; | 2254 | goto error_return; |
2254 | 2255 | ||
@@ -2288,7 +2289,7 @@ xfs_symlink( | |||
2288 | /* | 2289 | /* |
2289 | * Also attach the dquot(s) to it, if applicable. | 2290 | * Also attach the dquot(s) to it, if applicable. |
2290 | */ | 2291 | */ |
2291 | XFS_QM_DQVOPCREATE(mp, tp, ip, udqp, gdqp); | 2292 | xfs_qm_vop_create_dqattach(tp, ip, udqp, gdqp); |
2292 | 2293 | ||
2293 | if (resblks) | 2294 | if (resblks) |
2294 | resblks -= XFS_IALLOC_SPACE_RES(mp); | 2295 | resblks -= XFS_IALLOC_SPACE_RES(mp); |
@@ -2376,8 +2377,8 @@ xfs_symlink( | |||
2376 | goto error2; | 2377 | goto error2; |
2377 | } | 2378 | } |
2378 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); | 2379 | error = xfs_trans_commit(tp, XFS_TRANS_RELEASE_LOG_RES); |
2379 | XFS_QM_DQRELE(mp, udqp); | 2380 | xfs_qm_dqrele(udqp); |
2380 | XFS_QM_DQRELE(mp, gdqp); | 2381 | xfs_qm_dqrele(gdqp); |
2381 | 2382 | ||
2382 | /* Fall through to std_return with error = 0 or errno from | 2383 | /* Fall through to std_return with error = 0 or errno from |
2383 | * xfs_trans_commit */ | 2384 | * xfs_trans_commit */ |
@@ -2401,8 +2402,8 @@ std_return: | |||
2401 | cancel_flags |= XFS_TRANS_ABORT; | 2402 | cancel_flags |= XFS_TRANS_ABORT; |
2402 | error_return: | 2403 | error_return: |
2403 | xfs_trans_cancel(tp, cancel_flags); | 2404 | xfs_trans_cancel(tp, cancel_flags); |
2404 | XFS_QM_DQRELE(mp, udqp); | 2405 | xfs_qm_dqrele(udqp); |
2405 | XFS_QM_DQRELE(mp, gdqp); | 2406 | xfs_qm_dqrele(gdqp); |
2406 | 2407 | ||
2407 | if (unlock_dp_on_error) | 2408 | if (unlock_dp_on_error) |
2408 | xfs_iunlock(dp, XFS_ILOCK_EXCL); | 2409 | xfs_iunlock(dp, XFS_ILOCK_EXCL); |
@@ -2541,7 +2542,8 @@ xfs_alloc_file_space( | |||
2541 | if (XFS_FORCED_SHUTDOWN(mp)) | 2542 | if (XFS_FORCED_SHUTDOWN(mp)) |
2542 | return XFS_ERROR(EIO); | 2543 | return XFS_ERROR(EIO); |
2543 | 2544 | ||
2544 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 2545 | error = xfs_qm_dqattach(ip, 0); |
2546 | if (error) | ||
2545 | return error; | 2547 | return error; |
2546 | 2548 | ||
2547 | if (len <= 0) | 2549 | if (len <= 0) |
@@ -2628,8 +2630,8 @@ retry: | |||
2628 | break; | 2630 | break; |
2629 | } | 2631 | } |
2630 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 2632 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
2631 | error = XFS_TRANS_RESERVE_QUOTA_NBLKS(mp, tp, ip, | 2633 | error = xfs_trans_reserve_quota_nblks(tp, ip, qblocks, |
2632 | qblocks, 0, quota_flag); | 2634 | 0, quota_flag); |
2633 | if (error) | 2635 | if (error) |
2634 | goto error1; | 2636 | goto error1; |
2635 | 2637 | ||
@@ -2688,7 +2690,7 @@ dmapi_enospc_check: | |||
2688 | 2690 | ||
2689 | error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ | 2691 | error0: /* Cancel bmap, unlock inode, unreserve quota blocks, cancel trans */ |
2690 | xfs_bmap_cancel(&free_list); | 2692 | xfs_bmap_cancel(&free_list); |
2691 | XFS_TRANS_UNRESERVE_QUOTA_NBLKS(mp, tp, ip, qblocks, 0, quota_flag); | 2693 | xfs_trans_unreserve_quota_nblks(tp, ip, qblocks, 0, quota_flag); |
2692 | 2694 | ||
2693 | error1: /* Just cancel transaction */ | 2695 | error1: /* Just cancel transaction */ |
2694 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); | 2696 | xfs_trans_cancel(tp, XFS_TRANS_RELEASE_LOG_RES | XFS_TRANS_ABORT); |
@@ -2827,7 +2829,8 @@ xfs_free_file_space( | |||
2827 | 2829 | ||
2828 | xfs_itrace_entry(ip); | 2830 | xfs_itrace_entry(ip); |
2829 | 2831 | ||
2830 | if ((error = XFS_QM_DQATTACH(mp, ip, 0))) | 2832 | error = xfs_qm_dqattach(ip, 0); |
2833 | if (error) | ||
2831 | return error; | 2834 | return error; |
2832 | 2835 | ||
2833 | error = 0; | 2836 | error = 0; |
@@ -2953,9 +2956,9 @@ xfs_free_file_space( | |||
2953 | break; | 2956 | break; |
2954 | } | 2957 | } |
2955 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 2958 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
2956 | error = XFS_TRANS_RESERVE_QUOTA(mp, tp, | 2959 | error = xfs_trans_reserve_quota(tp, mp, |
2957 | ip->i_udquot, ip->i_gdquot, resblks, 0, | 2960 | ip->i_udquot, ip->i_gdquot, |
2958 | XFS_QMOPT_RES_REGBLKS); | 2961 | resblks, 0, XFS_QMOPT_RES_REGBLKS); |
2959 | if (error) | 2962 | if (error) |
2960 | goto error1; | 2963 | goto error1; |
2961 | 2964 | ||