Skip to content

Commit fc23a42

Browse files
author
Darrick J. Wong
committed
xfs: refactor xfs_qm_destroy_quotainos
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>
1 parent a3315d1 commit fc23a42

File tree

1 file changed

+20
-33
lines changed

1 file changed

+20
-33
lines changed

fs/xfs/xfs_qm.c

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
STATIC int xfs_qm_init_quotainos(struct xfs_mount *mp);
4141
STATIC int xfs_qm_init_quotainfo(struct xfs_mount *mp);
4242

43-
STATIC void xfs_qm_destroy_quotainos(struct xfs_quotainfo *qi);
4443
STATIC void xfs_qm_dqfree_one(struct xfs_dquot *dqp);
4544
/*
4645
* We use the batch lookup interface to iterate over the dquots as it
@@ -226,6 +225,24 @@ xfs_qm_unmount_rt(
226225
xfs_rtgroup_rele(rtg);
227226
}
228227

228+
STATIC void
229+
xfs_qm_destroy_quotainos(
230+
struct xfs_quotainfo *qi)
231+
{
232+
if (qi->qi_uquotaip) {
233+
xfs_irele(qi->qi_uquotaip);
234+
qi->qi_uquotaip = NULL; /* paranoia */
235+
}
236+
if (qi->qi_gquotaip) {
237+
xfs_irele(qi->qi_gquotaip);
238+
qi->qi_gquotaip = NULL;
239+
}
240+
if (qi->qi_pquotaip) {
241+
xfs_irele(qi->qi_pquotaip);
242+
qi->qi_pquotaip = NULL;
243+
}
244+
}
245+
229246
/*
230247
* Called from the vfsops layer.
231248
*/
@@ -250,20 +267,8 @@ xfs_qm_unmount_quotas(
250267
/*
251268
* Release the quota inodes.
252269
*/
253-
if (mp->m_quotainfo) {
254-
if (mp->m_quotainfo->qi_uquotaip) {
255-
xfs_irele(mp->m_quotainfo->qi_uquotaip);
256-
mp->m_quotainfo->qi_uquotaip = NULL;
257-
}
258-
if (mp->m_quotainfo->qi_gquotaip) {
259-
xfs_irele(mp->m_quotainfo->qi_gquotaip);
260-
mp->m_quotainfo->qi_gquotaip = NULL;
261-
}
262-
if (mp->m_quotainfo->qi_pquotaip) {
263-
xfs_irele(mp->m_quotainfo->qi_pquotaip);
264-
mp->m_quotainfo->qi_pquotaip = NULL;
265-
}
266-
}
270+
if (mp->m_quotainfo)
271+
xfs_qm_destroy_quotainos(mp->m_quotainfo);
267272
}
268273

269274
STATIC int
@@ -1712,24 +1717,6 @@ xfs_qm_init_quotainos(
17121717
return error;
17131718
}
17141719

1715-
STATIC void
1716-
xfs_qm_destroy_quotainos(
1717-
struct xfs_quotainfo *qi)
1718-
{
1719-
if (qi->qi_uquotaip) {
1720-
xfs_irele(qi->qi_uquotaip);
1721-
qi->qi_uquotaip = NULL; /* paranoia */
1722-
}
1723-
if (qi->qi_gquotaip) {
1724-
xfs_irele(qi->qi_gquotaip);
1725-
qi->qi_gquotaip = NULL;
1726-
}
1727-
if (qi->qi_pquotaip) {
1728-
xfs_irele(qi->qi_pquotaip);
1729-
qi->qi_pquotaip = NULL;
1730-
}
1731-
}
1732-
17331720
STATIC void
17341721
xfs_qm_dqfree_one(
17351722
struct xfs_dquot *dqp)

0 commit comments

Comments
 (0)