diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2013-08-06 18:27:08 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2013-08-20 18:00:38 -0400 |
commit | 5d5e3d57605e77708685e8d20a40fe86891db299 (patch) | |
tree | e58788d3fec7a5f9caaf7385388312518e2e70ca /fs/xfs/xfs_qm_syscalls.c | |
parent | af30cb446dd5f4ad5b93d7d4188c49a864c0d643 (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>
Diffstat (limited to 'fs/xfs/xfs_qm_syscalls.c')
-rw-r--r-- | fs/xfs/xfs_qm_syscalls.c | 82 |
1 files changed, 82 insertions, 0 deletions
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 | */ |
408 | int | 409 | int |
409 | xfs_qm_scall_getqstat( | 410 | xfs_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 | */ | ||
499 | int | ||
500 | xfs_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 | ||