提交 ffbfbe96 编写于 作者: L Long Li 提交者: openeuler-sync-bot

xfs: factor out xfs_destroy_perag()

Offering: HULK
hulk inclusion
category: bugfix
bugzilla: 188878, https://gitee.com/openeuler/kernel/issues/I76JSK

--------------------------------

Factor out xfs_destroy_perag() from xfs_initialize_perag() for error
handle, delete perag from radix tree requires lock protection, just like
any other places where perag tree are modified.
Signed-off-by: NLong Li <leo.lilong@huawei.com>
(cherry picked from commit 42297cd9)
上级 11a04e90
......@@ -172,6 +172,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,
......@@ -251,14 +272,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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册