xfs
[Top] [All Lists]

Re: [PATCH 3/3] xfs: Remove some pointless quota checks

To: Jan Kara <jack@xxxxxxx>
Subject: Re: [PATCH 3/3] xfs: Remove some pointless quota checks
From: Brian Foster <bfoster@xxxxxxxxxx>
Date: Thu, 15 Jan 2015 08:28:05 -0500
Cc: xfs@xxxxxxxxxxx
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <1421317085-14350-4-git-send-email-jack@xxxxxxx>
References: <1421317085-14350-1-git-send-email-jack@xxxxxxx> <1421317085-14350-4-git-send-email-jack@xxxxxxx>
User-agent: Mutt/1.5.23 (2014-03-12)
On Thu, Jan 15, 2015 at 11:18:05AM +0100, Jan Kara wrote:
> xfs_fs_get_xstate() and xfs_fs_get_xstatev() check whether there's quota
> running before calling xfs_qm_scall_getqstat() or
> xfs_qm_scall_getqstatv(). Thus we are certain that superblock supports
> quota and xfs_sb_version_hasquota() check is pointless. Similarly we
> know that when quota is running, mp->m_quotainfo will be allocated.
> 
> Signed-off-by: Jan Kara <jack@xxxxxxx>
> ---

Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx>

>  fs/xfs/xfs_qm_syscalls.c | 59 
> ++++++++++++++++--------------------------------
>  1 file changed, 20 insertions(+), 39 deletions(-)
> 
> diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
> index a8c673dbff32..784c41b3ad84 100644
> --- a/fs/xfs/xfs_qm_syscalls.c
> +++ b/fs/xfs/xfs_qm_syscalls.c
> @@ -411,20 +411,12 @@ xfs_qm_scall_getqstat(
>       memset(out, 0, sizeof(fs_quota_stat_t));
>  
>       out->qs_version = FS_QSTAT_VERSION;
> -     if (!xfs_sb_version_hasquota(&mp->m_sb)) {
> -             out->qs_uquota.qfs_ino = NULLFSINO;
> -             out->qs_gquota.qfs_ino = NULLFSINO;
> -             return 0;
> -     }
> -
>       out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
>                                                       (XFS_ALL_QUOTA_ACCT|
>                                                        XFS_ALL_QUOTA_ENFD));
> -     if (q) {
> -             uip = q->qi_uquotaip;
> -             gip = q->qi_gquotaip;
> -             pip = q->qi_pquotaip;
> -     }
> +     uip = q->qi_uquotaip;
> +     gip = q->qi_gquotaip;
> +     pip = q->qi_pquotaip;
>       if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) {
>               if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
>                                       0, 0, &uip) == 0)
> @@ -470,14 +462,13 @@ xfs_qm_scall_getqstat(
>               if (temppqip)
>                       IRELE(pip);
>       }
> -     if (q) {
> -             out->qs_incoredqs = q->qi_dquots;
> -             out->qs_btimelimit = q->qi_btimelimit;
> -             out->qs_itimelimit = q->qi_itimelimit;
> -             out->qs_rtbtimelimit = q->qi_rtbtimelimit;
> -             out->qs_bwarnlimit = q->qi_bwarnlimit;
> -             out->qs_iwarnlimit = q->qi_iwarnlimit;
> -     }
> +     out->qs_incoredqs = q->qi_dquots;
> +     out->qs_btimelimit = q->qi_btimelimit;
> +     out->qs_itimelimit = q->qi_itimelimit;
> +     out->qs_rtbtimelimit = q->qi_rtbtimelimit;
> +     out->qs_bwarnlimit = q->qi_bwarnlimit;
> +     out->qs_iwarnlimit = q->qi_iwarnlimit;
> +
>       return 0;
>  }
>  
> @@ -498,13 +489,6 @@ xfs_qm_scall_getqstatv(
>       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;
> -             return 0;
> -     }
> -
>       out->qs_flags = (__uint16_t) xfs_qm_export_flags(mp->m_qflags &
>                                                       (XFS_ALL_QUOTA_ACCT|
>                                                        XFS_ALL_QUOTA_ENFD));
> @@ -512,11 +496,9 @@ xfs_qm_scall_getqstatv(
>       out->qs_gquota.qfs_ino = mp->m_sb.sb_gquotino;
>       out->qs_pquota.qfs_ino = mp->m_sb.sb_pquotino;
>  
> -     if (q) {
> -             uip = q->qi_uquotaip;
> -             gip = q->qi_gquotaip;
> -             pip = q->qi_pquotaip;
> -     }
> +     uip = q->qi_uquotaip;
> +     gip = q->qi_gquotaip;
> +     pip = q->qi_pquotaip;
>       if (!uip && mp->m_sb.sb_uquotino != NULLFSINO) {
>               if (xfs_iget(mp, NULL, mp->m_sb.sb_uquotino,
>                                       0, 0, &uip) == 0)
> @@ -551,14 +533,13 @@ xfs_qm_scall_getqstatv(
>               if (temppqip)
>                       IRELE(pip);
>       }
> -     if (q) {
> -             out->qs_incoredqs = q->qi_dquots;
> -             out->qs_btimelimit = q->qi_btimelimit;
> -             out->qs_itimelimit = q->qi_itimelimit;
> -             out->qs_rtbtimelimit = q->qi_rtbtimelimit;
> -             out->qs_bwarnlimit = q->qi_bwarnlimit;
> -             out->qs_iwarnlimit = q->qi_iwarnlimit;
> -     }
> +     out->qs_incoredqs = q->qi_dquots;
> +     out->qs_btimelimit = q->qi_btimelimit;
> +     out->qs_itimelimit = q->qi_itimelimit;
> +     out->qs_rtbtimelimit = q->qi_rtbtimelimit;
> +     out->qs_bwarnlimit = q->qi_bwarnlimit;
> +     out->qs_iwarnlimit = q->qi_iwarnlimit;
> +
>       return 0;
>  }
>  
> -- 
> 2.1.2
> 
> _______________________________________________
> xfs mailing list
> xfs@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs

<Prev in Thread] Current Thread [Next in Thread>