summaryrefslogtreecommitdiff
path: root/quotaio_v2.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-09-27 21:34:57 +0000
committerjkar8572 <jkar8572>2001-09-27 21:34:57 +0000
commit1f1b463eb250b98954c96837d880cc0e07e109aa (patch)
treefddf4986a37d15d5640a3115b2aac4fd4611a090 /quotaio_v2.c
parent6cac7d8ee94d9262117e27df014a8b76ff889bde (diff)
Implemented setting only limits by commit_dquot() so edquota & setquota can operate
safe on live filesystem.
Diffstat (limited to 'quotaio_v2.c')
-rw-r--r--quotaio_v2.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/quotaio_v2.c b/quotaio_v2.c
index cd0d3c4..449c751 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -25,7 +25,7 @@ static int v2_init_io(struct quota_handle *h);
static int v2_new_io(struct quota_handle *h);
static int v2_write_info(struct quota_handle *h);
static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id);
-static int v2_commit_dquot(struct dquot *dquot);
+static int v2_commit_dquot(struct dquot *dquot, int flags);
static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *dquot, char *dqname));
static int v2_report(struct quota_handle *h, int verbose);
@@ -624,7 +624,7 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id)
* Commit changes of dquot to disk - it might also mean deleting it when quota became fake one and user has no blocks...
* User can process use 'errno' to detect errstr
*/
-static int v2_commit_dquot(struct dquot *dquot)
+static int v2_commit_dquot(struct dquot *dquot, int flags)
{
struct util_dqblk *b = &dquot->dq_dqb;
@@ -635,9 +635,16 @@ static int v2_commit_dquot(struct dquot *dquot)
}
if (QIO_ENABLED(dquot->dq_h)) {
struct v2_kern_dqblk kdqblk;
+ int cmd;
+ if (flags == COMMIT_USAGE)
+ cmd = Q_V2_SETUSE;
+ else if (flags == COMMIT_LIMITS)
+ cmd = Q_V2_SETQLIM;
+ else
+ cmd = Q_V2_SETQUOTA;
v2_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
- if (quotactl(QCMD(Q_V2_SETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
+ if (quotactl(QCMD(cmd, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
dquot->dq_id, (void *)&kdqblk) < 0)
return -1;
return 0;