Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Chandra Seetharaman and committed by
Ben Myers
5d5e3d57 af30cb44

+97
+2
fs/xfs/xfs_qm.h
··· 160 160 struct fs_disk_quota *); 161 161 extern int xfs_qm_scall_getqstat(struct xfs_mount *, 162 162 struct fs_quota_stat *); 163 + extern int xfs_qm_scall_getqstatv(struct xfs_mount *, 164 + struct fs_quota_statv *); 163 165 extern int xfs_qm_scall_quotaon(struct xfs_mount *, uint); 164 166 extern int xfs_qm_scall_quotaoff(struct xfs_mount *, uint); 165 167
+82
fs/xfs/xfs_qm_syscalls.c
··· 404 404 405 405 /* 406 406 * Return quota status information, such as uquota-off, enforcements, etc. 407 + * for Q_XGETQSTAT command. 407 408 */ 408 409 int 409 410 xfs_qm_scall_getqstat( ··· 478 477 out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; 479 478 out->qs_gquota.qfs_nblks = pip->i_d.di_nblocks; 480 479 out->qs_gquota.qfs_nextents = pip->i_d.di_nextents; 480 + if (temppqip) 481 + IRELE(pip); 482 + } 483 + if (q) { 484 + out->qs_incoredqs = q->qi_dquots; 485 + out->qs_btimelimit = q->qi_btimelimit; 486 + out->qs_itimelimit = q->qi_itimelimit; 487 + out->qs_rtbtimelimit = q->qi_rtbtimelimit; 488 + out->qs_bwarnlimit = q->qi_bwarnlimit; 489 + out->qs_iwarnlimit = q->qi_iwarnlimit; 490 + } 491 + return 0; 492 + } 493 + 494 + /* 495 + * Return quota status information, such as uquota-off, enforcements, etc. 496 + * for Q_XGETQSTATV command, to support separate project quota field. 497 + */ 498 + int 499 + xfs_qm_scall_getqstatv( 500 + struct xfs_mount *mp, 501 + struct fs_quota_statv *out) 502 + { 503 + struct xfs_quotainfo *q = mp->m_quotainfo; 504 + struct xfs_inode *uip = NULL; 505 + struct xfs_inode *gip = NULL; 506 + struct xfs_inode *pip = NULL; 507 + bool tempuqip = false; 508 + bool tempgqip = false; 509 + bool temppqip = false; 510 + 511 + if (!xfs_sb_version_hasquota(&mp->m_sb)) { 512 + out->qs_uquota.qfs_ino = NULLFSINO; 513 + out->qs_gquota.qfs_ino = NULLFSINO; 514 + out->qs_pquota.qfs_ino = NULLFSINO; 515 + return (0); 516 + } 517 + 518 + out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags & 519 + (XFS_ALL_QUOTA_ACCT| 520 + XFS_ALL_QUOTA_ENFD)); 521 + out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino; 522 + out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino; 523 + out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino; 524 + 525 + if (q) { 526 + uip = q->qi_uquotaip; 527 + gip = q->qi_gquotaip; 528 + pip = q->qi_pquotaip; 529 + } 530 + if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) { 531 + if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino, 532 + 0, 0, &uip) == 0) 533 + tempuqip = true; 534 + } 535 + if (!gip && mp->m_sb.sb_gquotino != NULLFSINO) { 536 + if (xfs_iget(mp, NULL, mp->m_sb.sb_gquotino, 537 + 0, 0, &gip) == 0) 538 + tempgqip = true; 539 + } 540 + if (!pip && mp->m_sb.sb_pquotino != NULLFSINO) { 541 + if (xfs_iget(mp, NULL, mp->m_sb.sb_pquotino, 542 + 0, 0, &pip) == 0) 543 + temppqip = true; 544 + } 545 + if (uip) { 546 + out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks; 547 + out->qs_uquota.qfs_nextents = uip->i_d.di_nextents; 548 + if (tempuqip) 549 + IRELE(uip); 550 + } 551 + 552 + if (gip) { 553 + out->qs_gquota.qfs_nblks = gip->i_d.di_nblocks; 554 + out->qs_gquota.qfs_nextents = gip->i_d.di_nextents; 555 + if (tempgqip) 556 + IRELE(gip); 557 + } 558 + if (pip) { 559 + out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks; 560 + out->qs_pquota.qfs_nextents = pip->i_d.di_nextents; 481 561 if (temppqip) 482 562 IRELE(pip); 483 563 }
+13
fs/xfs/xfs_quotaops.c
··· 56 56 } 57 57 58 58 STATIC int 59 + xfs_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 + 70 + STATIC int 59 71 xfs_fs_set_xstate( 60 72 struct super_block *sb, 61 73 unsigned int uflags, ··· 147 135 } 148 136 149 137 const struct quotactl_ops xfs_quotactl_operations = { 138 + .get_xstatev = xfs_fs_get_xstatev, 150 139 .get_xstate = xfs_fs_get_xstate, 151 140 .set_xstate = xfs_fs_set_xstate, 152 141 .get_dqblk = xfs_fs_get_dqblk,