xfs: refactor xfs_qm_destroy_quotainos
authorDarrick J. Wong <djwong@kernel.org>
Mon, 4 Nov 2024 04:19:37 +0000 (20:19 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:38:45 +0000 (13:38 -0800)
Reuse this function instead of open-coding the logic.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/xfs_qm.c

index 28b1420bac1dd22e8917e629077f32cc6b8eeb26..b37e80fe7e86a60d7e188cc96a8fd15b262ebc6b 100644 (file)
@@ -40,7 +40,6 @@
 STATIC int     xfs_qm_init_quotainos(struct xfs_mount *mp);
 STATIC int     xfs_qm_init_quotainfo(struct xfs_mount *mp);
 
-STATIC void    xfs_qm_destroy_quotainos(struct xfs_quotainfo *qi);
 STATIC void    xfs_qm_dqfree_one(struct xfs_dquot *dqp);
 /*
  * We use the batch lookup interface to iterate over the dquots as it
@@ -226,6 +225,24 @@ xfs_qm_unmount_rt(
        xfs_rtgroup_rele(rtg);
 }
 
+STATIC void
+xfs_qm_destroy_quotainos(
+       struct xfs_quotainfo    *qi)
+{
+       if (qi->qi_uquotaip) {
+               xfs_irele(qi->qi_uquotaip);
+               qi->qi_uquotaip = NULL; /* paranoia */
+       }
+       if (qi->qi_gquotaip) {
+               xfs_irele(qi->qi_gquotaip);
+               qi->qi_gquotaip = NULL;
+       }
+       if (qi->qi_pquotaip) {
+               xfs_irele(qi->qi_pquotaip);
+               qi->qi_pquotaip = NULL;
+       }
+}
+
 /*
  * Called from the vfsops layer.
  */
@@ -250,20 +267,8 @@ xfs_qm_unmount_quotas(
        /*
         * Release the quota inodes.
         */
-       if (mp->m_quotainfo) {
-               if (mp->m_quotainfo->qi_uquotaip) {
-                       xfs_irele(mp->m_quotainfo->qi_uquotaip);
-                       mp->m_quotainfo->qi_uquotaip = NULL;
-               }
-               if (mp->m_quotainfo->qi_gquotaip) {
-                       xfs_irele(mp->m_quotainfo->qi_gquotaip);
-                       mp->m_quotainfo->qi_gquotaip = NULL;
-               }
-               if (mp->m_quotainfo->qi_pquotaip) {
-                       xfs_irele(mp->m_quotainfo->qi_pquotaip);
-                       mp->m_quotainfo->qi_pquotaip = NULL;
-               }
-       }
+       if (mp->m_quotainfo)
+               xfs_qm_destroy_quotainos(mp->m_quotainfo);
 }
 
 STATIC int
@@ -1712,24 +1717,6 @@ error_rele:
        return error;
 }
 
-STATIC void
-xfs_qm_destroy_quotainos(
-       struct xfs_quotainfo    *qi)
-{
-       if (qi->qi_uquotaip) {
-               xfs_irele(qi->qi_uquotaip);
-               qi->qi_uquotaip = NULL; /* paranoia */
-       }
-       if (qi->qi_gquotaip) {
-               xfs_irele(qi->qi_gquotaip);
-               qi->qi_gquotaip = NULL;
-       }
-       if (qi->qi_pquotaip) {
-               xfs_irele(qi->qi_pquotaip);
-               qi->qi_pquotaip = NULL;
-       }
-}
-
 STATIC void
 xfs_qm_dqfree_one(
        struct xfs_dquot        *dqp)