[PATCH v8 5/5] xfs: Use new qs_pquota field in fs_quota_stat for Q_XGETQSTAT
Dave Chinner
david at fromorbit.com
Fri May 17 00:14:41 CDT 2013
On Fri, May 10, 2013 at 04:21:29PM -0500, Chandra Seetharaman wrote:
> For the Q_XGETQSTAT quota command, if the new version of fs_quota_stat
> data structure is used, fill the project quota information.
>
> Signed-off-by: Chandra Seetharaman <sekharan at us.ibm.com>
> ---
> fs/xfs/xfs_qm_syscalls.c | 39 +++++++++++++++++++++++++--------------
> 1 files changed, 25 insertions(+), 14 deletions(-)
>
> diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
> index c27b0e4..7c5876b 100644
> --- a/fs/xfs/xfs_qm_syscalls.c
> +++ b/fs/xfs/xfs_qm_syscalls.c
> @@ -420,20 +420,14 @@ xfs_qm_scall_getqstat(
> bool tempgqip = false;
> bool temppqip = false;
>
> - if (!xfs_sb_version_hasquota(&mp->m_sb)) {
> - out->qs_uquota.qfs_ino = NULLFSINO;
> - out->qs_gquota.qfs_ino = NULLFSINO;
> - out->qs_pquota.qfs_ino = NULLFSINO;
> + out->qs_uquota.qfs_ino = NULLFSINO;
> + out->qs_gquota.qfs_ino = NULLFSINO;
> + out->qs_pquota.qfs_ino = NULLFSINO;
> +
> + if (!xfs_sb_version_hasquota(&mp->m_sb))
> return (0);
> - }
> out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
> - (XFS_ALL_QUOTA_ACCT|
> - XFS_ALL_QUOTA_ENFD));
> - out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino;
> - out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;
> - if (&out->qs_gquota != &out->qs_pquota)
> - out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;
> -
> + (XFS_ALL_QUOTA_ACCT| XFS_ALL_QUOTA_ENFD));
> if (q) {
> uip = q->qi_uquotaip;
> gip = q->qi_gquotaip;
> @@ -454,21 +448,38 @@ xfs_qm_scall_getqstat(
> 0, 0, &pip) == 0)
> temppqip = true;
> }
> +
> if (uip) {
> + out->qs_uquota.qfs_ino = mp->m_sb.sb_uquotino;
> out->qs_uquota.qfs_nblks = uip->i_d.di_nblocks;
> out->qs_uquota.qfs_nextents = uip->i_d.di_nextents;
> if (tempuqip)
> IRELE(uip);
> }
> if (gip) {
> + out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;
> out->qs_gquota.qfs_nblks = gip->i_d.di_nblocks;
> out->qs_gquota.qfs_nextents = gip->i_d.di_nextents;
> if (tempgqip)
> IRELE(gip);
> }
> if (pip) {
> - out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks;
> - out->qs_pquota.qfs_nextents = pip->i_d.di_nextents;
> + if (out->qs_version >= FS_QSTAT_VERSION_2) {
> + out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;
> + out->qs_pquota.qfs_nblks = pip->i_d.di_nblocks;
> + out->qs_pquota.qfs_nextents = pip->i_d.di_nextents;
> + } else {
> + /*
> + * In FS_QSTAT_VERSION version, there is no
> + * qs_pquota, and there is no combined support
> + * for gquota/pquota. qs_gquota is shared for
> + * providing the pquota/gquota information to
> + * the user space.
> + */
Move that comment to the head of the function. i.e.:
/*
* We support two different versions of the fs_quota_stat structure
* here. If the version is FS_QSTAT_VERSION, then there is no
* separate project quota fields, and so we write project quota
* information into the group quota fields. With FS_QSTAT_VERSION_2,
* there is a separate project quota field so we can use that
* instead to pass both group and project quota back to user space
* in the one call.
*/
Cheers,
Dave.
--
Dave Chinner
david at fromorbit.com
More information about the xfs
mailing list