diff options
author | Steven Whitehouse <swhiteho@redhat.com> | 2009-09-28 06:52:16 -0400 |
---|---|---|
committer | Steven Whitehouse <swhiteho@redhat.com> | 2009-12-03 06:52:21 -0500 |
commit | 113d6b3c99bf30d8083068d00e3c7304d91d4845 (patch) | |
tree | 77c46b298307f8ce44998ee50d791ee736cf0faa /fs/gfs2/quota.c | |
parent | 1e72c0f7c40e665d2ed40014750fdd2fa9968bcf (diff) |
GFS2: Add get_xquota support
This adds support for viewing the current GFS2 quota settings
via the XFS quota API. The setting of quotas will be addressed
in a later patch. Fields which are not supported here are left
set to zero.
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Reviewed-by: Bob Peterson <rpeterso@redhat.com>
Diffstat (limited to 'fs/gfs2/quota.c')
-rw-r--r-- | fs/gfs2/quota.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 33e369f108b3..6c5d6aa7d532 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -1367,8 +1367,51 @@ static int gfs2_quota_get_xstate(struct super_block *sb, | |||
1367 | return 0; | 1367 | return 0; |
1368 | } | 1368 | } |
1369 | 1369 | ||
1370 | static int gfs2_xquota_get(struct super_block *sb, int type, qid_t id, | ||
1371 | struct fs_disk_quota *fdq) | ||
1372 | { | ||
1373 | struct gfs2_sbd *sdp = sb->s_fs_info; | ||
1374 | struct gfs2_quota_lvb *qlvb; | ||
1375 | struct gfs2_quota_data *qd; | ||
1376 | struct gfs2_holder q_gh; | ||
1377 | int error; | ||
1378 | |||
1379 | memset(fdq, 0, sizeof(struct fs_disk_quota)); | ||
1380 | |||
1381 | if (sdp->sd_args.ar_quota == GFS2_QUOTA_OFF) | ||
1382 | return -ESRCH; /* Crazy XFS error code */ | ||
1383 | |||
1384 | if (type == USRQUOTA) | ||
1385 | type = QUOTA_USER; | ||
1386 | else if (type == GRPQUOTA) | ||
1387 | type = QUOTA_GROUP; | ||
1388 | else | ||
1389 | return -EINVAL; | ||
1390 | |||
1391 | error = qd_get(sdp, type, id, &qd); | ||
1392 | if (error) | ||
1393 | return error; | ||
1394 | error = do_glock(qd, FORCE, &q_gh); | ||
1395 | if (error) | ||
1396 | goto out; | ||
1397 | |||
1398 | qlvb = (struct gfs2_quota_lvb *)qd->qd_gl->gl_lvb; | ||
1399 | fdq->d_version = FS_DQUOT_VERSION; | ||
1400 | fdq->d_flags = (type == QUOTA_USER) ? XFS_USER_QUOTA : XFS_GROUP_QUOTA; | ||
1401 | fdq->d_id = id; | ||
1402 | fdq->d_blk_hardlimit = be64_to_cpu(qlvb->qb_limit); | ||
1403 | fdq->d_blk_softlimit = be64_to_cpu(qlvb->qb_warn); | ||
1404 | fdq->d_bcount = be64_to_cpu(qlvb->qb_value); | ||
1405 | |||
1406 | gfs2_glock_dq_uninit(&q_gh); | ||
1407 | out: | ||
1408 | qd_put(qd); | ||
1409 | return error; | ||
1410 | } | ||
1411 | |||
1370 | const struct quotactl_ops gfs2_quotactl_ops = { | 1412 | const struct quotactl_ops gfs2_quotactl_ops = { |
1371 | .quota_sync = gfs2_quota_sync, | 1413 | .quota_sync = gfs2_quota_sync, |
1372 | .get_xstate = gfs2_quota_get_xstate, | 1414 | .get_xstate = gfs2_quota_get_xstate, |
1415 | .get_xquota = gfs2_xquota_get, | ||
1373 | }; | 1416 | }; |
1374 | 1417 | ||