xfs: Remove some pointless quota checks
authorJan Kara <jack@suse.cz>
Fri, 12 Dec 2014 19:53:36 +0000 (20:53 +0100)
committerJan Kara <jack@suse.cz>
Wed, 21 Jan 2015 18:21:33 +0000 (19:21 +0100)
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.

Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
fs/xfs/xfs_qm_syscalls.c

index b7a8f5665d7b2d9ce22313c1492d23869ae5e955..42a15ddedb072f916594576d27b76857030b9b17 100644 (file)
@@ -415,20 +415,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)
@@ -474,14 +466,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;
 }
 
@@ -502,13 +493,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));
@@ -516,11 +500,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)
@@ -555,14 +537,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;
 }