aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandra Seetharaman <sekharan@us.ibm.com>2013-08-06 18:27:08 -0400
committerBen Myers <bpm@sgi.com>2013-08-20 18:00:38 -0400
commit5d5e3d57605e77708685e8d20a40fe86891db299 (patch)
treee58788d3fec7a5f9caaf7385388312518e2e70ca
parentaf30cb446dd5f4ad5b93d7d4188c49a864c0d643 (diff)
xfs: Add support for the Q_XGETQSTATV
For XFS, add support for Q_XGETQSTATV quotactl command. Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com> Reviewed-by: Rich Johnston <rjohnston@sgi.com> Signed-off-by: Ben Myers <bpm@sgi.com>
-rw-r--r--fs/xfs/xfs_qm.h2
-rw-r--r--fs/xfs/xfs_qm_syscalls.c82
-rw-r--r--fs/xfs/xfs_quotaops.c13
3 files changed, 97 insertions, 0 deletions
diff --git a/fs/xfs/xfs_qm.h b/fs/xfs/xfs_qm.h
index 579d6a02a5b6..670cd4464070 100644
--- a/fs/xfs/xfs_qm.h
+++ b/fs/xfs/xfs_qm.h
@@ -160,6 +160,8 @@ extern int xfs_qm_scall_setqlim(struct xfs_mount *, xfs_dqid_t, uint,
160 struct fs_disk_quota *); 160 struct fs_disk_quota *);
161extern int xfs_qm_scall_getqstat(struct xfs_mount *, 161extern int xfs_qm_scall_getqstat(struct xfs_mount *,
162 struct fs_quota_stat *); 162 struct fs_quota_stat *);
163extern int xfs_qm_scall_getqstatv(struct xfs_mount *,
164 struct fs_quota_statv *);
163extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); 165extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint);
164extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); 166extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint);
165 167
diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 5290af2411c4..8174aad0b388 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -404,6 +404,7 @@ xfs_qm_scall_quotaon(
404 404
405/* 405/*
406 * Return quota status information, such as uquota-off, enforcements, etc. 406 * Return quota status information, such as uquota-off, enforcements, etc.
407 * for Q_XGETQSTAT command.
407 */ 408 */
408int 409int
409xfs_qm_scall_getqstat( 410xfs_qm_scall_getqstat(
@@ -491,6 +492,87 @@ xfs_qm_scall_getqstat(
491 return 0; 492 return 0;
492} 493}
493 494
495/*
496 * Return quota status information, such as uquota-off, enforcements, etc.
497 * for Q_XGETQSTATV command, to support separate project quota field.
498 */
499int
500xfs_qm_scall_getqstatv(
501 struct xfs_mount *mp,
502 struct fs_quota_statv *out)
503{
504 struct xfs_quotainfo *q = mp->m_quotainfo;
505 struct xfs_inode *uip = NULL;
506 struct xfs_inode *gip = NULL;
507 struct xfs_inode *pip = NULL;
508 bool tempuqip = false;
509 bool tempgqip = false;
510 bool temppqip = false;
511
512 if (!xfs_sb_version_hasquota(&mp->m_sb)) {
513 out->qs_uquota.qfs_ino = NULLFSINO;
514 out->qs_gquota.qfs_ino = NULLFSINO;
515 out->qs_pquota.qfs_ino = NULLFSINO;
516 return (0);
517 }
518
519 out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
520 (XFS_ALL_QUOTA_ACCT|
521 XFS_ALL_QUOTA_ENFD));
522 out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino;
523 out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;
524 out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;
525
526 if (q) {
527 uip = q->qi_uquotaip;
528 gip = q->qi_gquotaip;
529 pip = q->qi_pquotaip;
530 }
531 if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) {
532 if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
533 0, 0, &uip) == 0)
534 tempuqip = true;
535 }
536 if (!gip && mp->m_sb.sb_gquotino != NULLFSINO) {
537 if (xfs_iget(mp, NULL, mp->m_sb.sb_gquotino,
538 0, 0, &gip) == 0)
539 tempgqip = true;
540 }
541 if (!pip && mp->m_sb.sb_pquotino != NULLFSINO) {
542 if (xfs_iget(mp, NULL, mp->m_sb.sb_pquotino,
543 0, 0, &pip) == 0)
544 temppqip = true;
545 }
546 if (uip) {
547 out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks;
548 out->qs_uquota.qfs_nextents = uip->i_d.di_nextents;
549 if (tempuqip)
550 IRELE(uip);
551 }
552
553 if (gip) {
554 out->qs_gquota.qfs_nblks = gip->i_d.di_nblocks;
555 out->qs_gquota.qfs_nextents = gip->i_d.di_nextents;
556 if (tempgqip)
557 IRELE(gip);
558 }
559 if (pip) {
560 out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks;
561 out->qs_pquota.qfs_nextents = pip->i_d.di_nextents;
562 if (temppqip)
563 IRELE(pip);
564 }
565 if (q) {
566 out->qs_incoredqs = q->qi_dquots;
567 out->qs_btimelimit = q->qi_btimelimit;
568 out->qs_itimelimit = q->qi_itimelimit;
569 out->qs_rtbtimelimit = q->qi_rtbtimelimit;
570 out->qs_bwarnlimit = q->qi_bwarnlimit;
571 out->qs_iwarnlimit = q->qi_iwarnlimit;
572 }
573 return 0;
574}
575
494#define XFS_DQ_MASK \ 576#define XFS_DQ_MASK \
495 (FS_DQ_LIMIT_MASK | FS_DQ_TIMER_MASK | FS_DQ_WARNS_MASK) 577 (FS_DQ_LIMIT_MASK | FS_DQ_TIMER_MASK | FS_DQ_WARNS_MASK)
496 578
diff --git a/fs/xfs/xfs_quotaops.c b/fs/xfs/xfs_quotaops.c
index 446a2fc9825e..1326d81596c2 100644
--- a/fs/xfs/xfs_quotaops.c
+++ b/fs/xfs/xfs_quotaops.c
@@ -56,6 +56,18 @@ xfs_fs_get_xstate(
56} 56}
57 57
58STATIC int 58STATIC int
59xfs_fs_get_xstatev(
60 struct super_block *sb,
61 struct fs_quota_statv *fqs)
62{
63 struct xfs_mount *mp = XFS_M(sb);
64
65 if (!XFS_IS_QUOTA_RUNNING(mp))
66 return -ENOSYS;
67 return -xfs_qm_scall_getqstatv(mp, fqs);
68}
69
70STATIC int
59xfs_fs_set_xstate( 71xfs_fs_set_xstate(
60 struct super_block *sb, 72 struct super_block *sb,
61 unsigned int uflags, 73 unsigned int uflags,
@@ -135,6 +147,7 @@ xfs_fs_set_dqblk(
135} 147}
136 148
137const struct quotactl_ops xfs_quotactl_operations = { 149const struct quotactl_ops xfs_quotactl_operations = {
150 .get_xstatev = xfs_fs_get_xstatev,
138 .get_xstate = xfs_fs_get_xstate, 151 .get_xstate = xfs_fs_get_xstate,
139 .set_xstate = xfs_fs_set_xstate, 152 .set_xstate = xfs_fs_set_xstate,
140 .get_dqblk = xfs_fs_get_dqblk, 153 .get_dqblk = xfs_fs_get_dqblk,