diff options
author | Abhijith Das <adas@redhat.com> | 2010-11-18 11:26:46 -0500 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2010-11-30 05:31:27 -0500 |
commit | 802ec9b6682349d9d9c92a9e55f44324d2954f41 (patch) | |
tree | 25e69625588e936e3cdc93dd648d07fcbfe73ce0 /fs/gfs2/quota.c | |
parent | edc221d00bd5c6da0e5c67701f3782b72796619f (diff) |
GFS2: Allow gfs2 to update quota usage values through the quotactl interface
With this patch the gfs2_set_dqblk() function will be able to update the
quota usage block count (FS_DQ_BCOUNT) in addition to the already supported
FS_DQ_BHARD (limit) and FS_DQ_BSOFT (warn) fields of the dquot structure.
Signed-off-by: Abhi Das <adas@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index f606baf9ba72..a689901963de 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -666,6 +666,10 @@ static int gfs2_adjust_quota(struct gfs2_inode *ip, loff_t loc, | |||
666 | qp->qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift); | 666 | qp->qu_limit = cpu_to_be64(fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift); |
667 | qd->qd_qb.qb_limit = qp->qu_limit; | 667 | qd->qd_qb.qb_limit = qp->qu_limit; |
668 | } | 668 | } |
669 | if (fdq->d_fieldmask & FS_DQ_BCOUNT) { | ||
670 | qp->qu_value = cpu_to_be64(fdq->d_bcount >> sdp->sd_fsb2bb_shift); | ||
671 | qd->qd_qb.qb_value = qp->qu_value; | ||
672 | } | ||
669 | } | 673 | } |
670 | 674 | ||
671 | /* Write the quota into the quota file on disk */ | 675 | /* Write the quota into the quota file on disk */ |
@@ -1509,7 +1513,7 @@ out: | |||
1509 | } | 1513 | } |
1510 | 1514 | ||
1511 | /* GFS2 only supports a subset of the XFS fields */ | 1515 | /* GFS2 only supports a subset of the XFS fields */ |
1512 | #define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD) | 1516 | #define GFS2_FIELDMASK (FS_DQ_BSOFT|FS_DQ_BHARD|FS_DQ_BCOUNT) |
1513 | 1517 | ||
1514 | static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id, | 1518 | static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id, |
1515 | struct fs_disk_quota *fdq) | 1519 | struct fs_disk_quota *fdq) |
@@ -1569,9 +1573,15 @@ static int gfs2_set_dqblk(struct super_block *sb, int type, qid_t id, | |||
1569 | if ((fdq->d_fieldmask & FS_DQ_BSOFT) && | 1573 | if ((fdq->d_fieldmask & FS_DQ_BSOFT) && |
1570 | ((fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_warn))) | 1574 | ((fdq->d_blk_softlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_warn))) |
1571 | fdq->d_fieldmask ^= FS_DQ_BSOFT; | 1575 | fdq->d_fieldmask ^= FS_DQ_BSOFT; |
1576 | |||
1572 | if ((fdq->d_fieldmask & FS_DQ_BHARD) && | 1577 | if ((fdq->d_fieldmask & FS_DQ_BHARD) && |
1573 | ((fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_limit))) | 1578 | ((fdq->d_blk_hardlimit >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_limit))) |
1574 | fdq->d_fieldmask ^= FS_DQ_BHARD; | 1579 | fdq->d_fieldmask ^= FS_DQ_BHARD; |
1580 | |||
1581 | if ((fdq->d_fieldmask & FS_DQ_BCOUNT) && | ||
1582 | ((fdq->d_bcount >> sdp->sd_fsb2bb_shift) == be64_to_cpu(qd->qd_qb.qb_value))) | ||
1583 | fdq->d_fieldmask ^= FS_DQ_BCOUNT; | ||
1584 | |||
1575 | if (fdq->d_fieldmask == 0) | 1585 | if (fdq->d_fieldmask == 0) |
1576 | goto out_i; | 1586 | goto out_i; |
1577 | 1587 | ||
@@ -1620,4 +1630,3 @@ const struct quotactl_ops gfs2_quotactl_ops = { | |||
1620 | .get_dqblk = gfs2_get_dqblk, | 1630 | .get_dqblk = gfs2_get_dqblk, |
1621 | .set_dqblk = gfs2_set_dqblk, | 1631 | .set_dqblk = gfs2_set_dqblk, |
1622 | }; | 1632 | }; |
1623 | |||