diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 69888dd863d789e03ceeea3dfd2b991642df1347..8346441985b0e54ecf28baf20c605461e7e522ac 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -173,6 +173,27 @@ xfs_sb_validate_fsb_count( return 0; } +void +xfs_destroy_perag( + xfs_mount_t *mp, + xfs_agnumber_t agstart, + xfs_agnumber_t agend) +{ + xfs_agnumber_t index; + xfs_perag_t *pag; + + for (index = agstart; index < agend; index++) { + spin_lock(&mp->m_perag_lock); + pag = radix_tree_delete(&mp->m_perag_tree, index); + spin_unlock(&mp->m_perag_lock); + if (!pag) + break; + xfs_buf_hash_destroy(pag); + xfs_iunlink_destroy(pag); + kmem_free(pag); + } +} + int xfs_initialize_perag( xfs_mount_t *mp, @@ -252,14 +273,7 @@ xfs_initialize_perag( kmem_free(pag); out_unwind_new_pags: /* unwind any prior newly initialized pags */ - for (index = first_initialised; index < agcount; index++) { - pag = radix_tree_delete(&mp->m_perag_tree, index); - if (!pag) - break; - xfs_buf_hash_destroy(pag); - xfs_iunlink_destroy(pag); - kmem_free(pag); - } + xfs_destroy_perag(mp, first_initialised, agcount); return error; }