diff options
author | Nathan Scott <nathans@sgi.com> | 2005-06-21 01:38:48 -0400 |
---|---|---|
committer | Nathan Scott <nathans@sgi.com> | 2005-06-21 01:38:48 -0400 |
commit | c8ad20ffeb592d66ea869c57f8c525a9d727c67b (patch) | |
tree | 3306edfe984170bc881a1d7fbeab29b4b59f0305 /fs/xfs/quota/xfs_dquot.c | |
parent | 8401e9631c26dca9ebbc6997ac445fd49b06c79e (diff) |
[XFS] Add support for project quota, based on Dan Knappes earlier work.
SGI-PV: 932952
SGI-Modid: xfs-linux:xfs-kern:22805a
Signed-off-by: Nathan Scott <nathans@sgi.com>
Diffstat (limited to 'fs/xfs/quota/xfs_dquot.c')
-rw-r--r-- | fs/xfs/quota/xfs_dquot.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/fs/xfs/quota/xfs_dquot.c b/fs/xfs/quota/xfs_dquot.c index 9ce471430a0e..68089f56d5cd 100644 --- a/fs/xfs/quota/xfs_dquot.c +++ b/fs/xfs/quota/xfs_dquot.c | |||
@@ -399,9 +399,9 @@ xfs_qm_init_dquot_blk( | |||
399 | for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++) | 399 | for (i = 0; i < XFS_QM_DQPERBLK(mp); i++, d++, curid++) |
400 | xfs_qm_dqinit_core(curid, type, d); | 400 | xfs_qm_dqinit_core(curid, type, d); |
401 | xfs_trans_dquot_buf(tp, bp, | 401 | xfs_trans_dquot_buf(tp, bp, |
402 | type & XFS_DQ_USER ? | 402 | (type & XFS_DQ_USER ? XFS_BLI_UDQUOT_BUF : |
403 | XFS_BLI_UDQUOT_BUF : | 403 | ((type & XFS_DQ_PROJ) ? XFS_BLI_PDQUOT_BUF : |
404 | XFS_BLI_GDQUOT_BUF); | 404 | XFS_BLI_GDQUOT_BUF))); |
405 | xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1); | 405 | xfs_trans_log_buf(tp, bp, 0, BBTOB(XFS_QI_DQCHUNKLEN(mp)) - 1); |
406 | } | 406 | } |
407 | 407 | ||
@@ -482,8 +482,7 @@ xfs_qm_dqalloc( | |||
482 | * the entire thing. | 482 | * the entire thing. |
483 | */ | 483 | */ |
484 | xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), | 484 | xfs_qm_init_dquot_blk(tp, mp, INT_GET(dqp->q_core.d_id, ARCH_CONVERT), |
485 | dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP), | 485 | dqp->dq_flags & XFS_DQ_ALLTYPES, bp); |
486 | bp); | ||
487 | 486 | ||
488 | if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) { | 487 | if ((error = xfs_bmap_finish(&tp, &flist, firstblock, &committed))) { |
489 | goto error1; | 488 | goto error1; |
@@ -613,8 +612,7 @@ xfs_qm_dqtobp( | |||
613 | /* | 612 | /* |
614 | * A simple sanity check in case we got a corrupted dquot... | 613 | * A simple sanity check in case we got a corrupted dquot... |
615 | */ | 614 | */ |
616 | if (xfs_qm_dqcheck(ddq, id, | 615 | if (xfs_qm_dqcheck(ddq, id, dqp->dq_flags & XFS_DQ_ALLTYPES, |
617 | dqp->dq_flags & (XFS_DQ_USER|XFS_DQ_GROUP), | ||
618 | flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN), | 616 | flags & (XFS_QMOPT_DQREPAIR|XFS_QMOPT_DOWARN), |
619 | "dqtobp")) { | 617 | "dqtobp")) { |
620 | if (!(flags & XFS_QMOPT_DQREPAIR)) { | 618 | if (!(flags & XFS_QMOPT_DQREPAIR)) { |
@@ -891,8 +889,8 @@ int | |||
891 | xfs_qm_dqget( | 889 | xfs_qm_dqget( |
892 | xfs_mount_t *mp, | 890 | xfs_mount_t *mp, |
893 | xfs_inode_t *ip, /* locked inode (optional) */ | 891 | xfs_inode_t *ip, /* locked inode (optional) */ |
894 | xfs_dqid_t id, /* gid or uid, depending on type */ | 892 | xfs_dqid_t id, /* uid/projid/gid depending on type */ |
895 | uint type, /* UDQUOT or GDQUOT */ | 893 | uint type, /* XFS_DQ_USER/XFS_DQ_PROJ/XFS_DQ_GROUP */ |
896 | uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */ | 894 | uint flags, /* DQALLOC, DQSUSER, DQREPAIR, DOWARN */ |
897 | xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ | 895 | xfs_dquot_t **O_dqpp) /* OUT : locked incore dquot */ |
898 | { | 896 | { |
@@ -903,7 +901,9 @@ xfs_qm_dqget( | |||
903 | 901 | ||
904 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); | 902 | ASSERT(XFS_IS_QUOTA_RUNNING(mp)); |
905 | if ((! XFS_IS_UQUOTA_ON(mp) && type == XFS_DQ_USER) || | 903 | if ((! XFS_IS_UQUOTA_ON(mp) && type == XFS_DQ_USER) || |
904 | (! XFS_IS_PQUOTA_ON(mp) && type == XFS_DQ_PROJ) || | ||
906 | (! XFS_IS_GQUOTA_ON(mp) && type == XFS_DQ_GROUP)) { | 905 | (! XFS_IS_GQUOTA_ON(mp) && type == XFS_DQ_GROUP)) { |
906 | printk("XQM: ESRCH1\n"); | ||
907 | return (ESRCH); | 907 | return (ESRCH); |
908 | } | 908 | } |
909 | h = XFS_DQ_HASH(mp, id, type); | 909 | h = XFS_DQ_HASH(mp, id, type); |
@@ -921,7 +921,9 @@ xfs_qm_dqget( | |||
921 | again: | 921 | again: |
922 | 922 | ||
923 | #ifdef DEBUG | 923 | #ifdef DEBUG |
924 | ASSERT(type == XFS_DQ_USER || type == XFS_DQ_GROUP); | 924 | ASSERT(type == XFS_DQ_USER || |
925 | type == XFS_DQ_PROJ || | ||
926 | type == XFS_DQ_GROUP); | ||
925 | if (ip) { | 927 | if (ip) { |
926 | ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); | 928 | ASSERT(XFS_ISLOCKED_INODE_EXCL(ip)); |
927 | if (type == XFS_DQ_USER) | 929 | if (type == XFS_DQ_USER) |
@@ -979,6 +981,7 @@ xfs_qm_dqget( | |||
979 | &dqp))) { | 981 | &dqp))) { |
980 | if (ip) | 982 | if (ip) |
981 | xfs_ilock(ip, XFS_ILOCK_EXCL); | 983 | xfs_ilock(ip, XFS_ILOCK_EXCL); |
984 | if (error == ESRCH) printk("XQM: ESRCH2\n"); | ||
982 | return (error); | 985 | return (error); |
983 | } | 986 | } |
984 | 987 | ||
@@ -1004,6 +1007,7 @@ xfs_qm_dqget( | |||
1004 | if (! XFS_IS_DQTYPE_ON(mp, type)) { | 1007 | if (! XFS_IS_DQTYPE_ON(mp, type)) { |
1005 | /* inode stays locked on return */ | 1008 | /* inode stays locked on return */ |
1006 | xfs_qm_dqdestroy(dqp); | 1009 | xfs_qm_dqdestroy(dqp); |
1010 | printk("XQM: ESRCH3\n"); | ||
1007 | return XFS_ERROR(ESRCH); | 1011 | return XFS_ERROR(ESRCH); |
1008 | } | 1012 | } |
1009 | /* | 1013 | /* |
@@ -1244,8 +1248,8 @@ xfs_qm_dqflush( | |||
1244 | return (error); | 1248 | return (error); |
1245 | } | 1249 | } |
1246 | 1250 | ||
1247 | if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), 0, XFS_QMOPT_DOWARN, | 1251 | if (xfs_qm_dqcheck(&dqp->q_core, INT_GET(ddqp->d_id, ARCH_CONVERT), |
1248 | "dqflush (incore copy)")) { | 1252 | 0, XFS_QMOPT_DOWARN, "dqflush (incore copy)")) { |
1249 | xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); | 1253 | xfs_force_shutdown(dqp->q_mount, XFS_CORRUPT_INCORE); |
1250 | return XFS_ERROR(EIO); | 1254 | return XFS_ERROR(EIO); |
1251 | } | 1255 | } |
@@ -1397,7 +1401,8 @@ xfs_dqlock2( | |||
1397 | { | 1401 | { |
1398 | if (d1 && d2) { | 1402 | if (d1 && d2) { |
1399 | ASSERT(d1 != d2); | 1403 | ASSERT(d1 != d2); |
1400 | if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { | 1404 | if (INT_GET(d1->q_core.d_id, ARCH_CONVERT) > |
1405 | INT_GET(d2->q_core.d_id, ARCH_CONVERT)) { | ||
1401 | xfs_dqlock(d2); | 1406 | xfs_dqlock(d2); |
1402 | xfs_dqlock(d1); | 1407 | xfs_dqlock(d1); |
1403 | } else { | 1408 | } else { |
@@ -1520,8 +1525,7 @@ xfs_qm_dqprint(xfs_dquot_t *dqp) | |||
1520 | cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); | 1525 | cmn_err(CE_DEBUG, "-----------KERNEL DQUOT----------------"); |
1521 | cmn_err(CE_DEBUG, "---- dquotID = %d", | 1526 | cmn_err(CE_DEBUG, "---- dquotID = %d", |
1522 | (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); | 1527 | (int)INT_GET(dqp->q_core.d_id, ARCH_CONVERT)); |
1523 | cmn_err(CE_DEBUG, "---- type = %s", | 1528 | cmn_err(CE_DEBUG, "---- type = %s", DQFLAGTO_TYPESTR(dqp)); |
1524 | XFS_QM_ISUDQ(dqp) ? "USR" : "GRP"); | ||
1525 | cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); | 1529 | cmn_err(CE_DEBUG, "---- fs = 0x%p", dqp->q_mount); |
1526 | cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); | 1530 | cmn_err(CE_DEBUG, "---- blkno = 0x%x", (int) dqp->q_blkno); |
1527 | cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); | 1531 | cmn_err(CE_DEBUG, "---- boffset = 0x%x", (int) dqp->q_bufoffset); |