mirror of
https://github.com/torvalds/linux.git
synced 2026-09-23 22:14:03 +02:00
xfs: use the correct reservations for rtrmap/refcount recovery
LOLLM noticed that we might reserve the wrong number of blocks for
recovering rtrmap and rtrefcount updates after a crash. Fix that.
Cc: stable@vger.kernel.org # v6.14
Fixes: 5e0679d1c6 ("xfs: support recovering rmap intent items targetting realtime extents")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
8fc18580ec
commit
471e0b6e2d
|
|
@ -508,6 +508,7 @@ xfs_refcount_recover_work(
|
|||
struct xfs_cui_log_item *cuip = CUI_ITEM(lip);
|
||||
struct xfs_trans *tp;
|
||||
struct xfs_mount *mp = lip->li_log->l_mp;
|
||||
unsigned int dblocks;
|
||||
bool isrt = xfs_cui_item_isrt(lip);
|
||||
int i;
|
||||
int error = 0;
|
||||
|
|
@ -543,8 +544,11 @@ xfs_refcount_recover_work(
|
|||
* full btree split on either end of the refcount range.
|
||||
*/
|
||||
resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
|
||||
error = xfs_trans_alloc(mp, &resv, mp->m_refc_maxlevels * 2, 0,
|
||||
XFS_TRANS_RESERVE, &tp);
|
||||
if (isrt)
|
||||
dblocks = mp->m_rtrefc_maxlevels * 2;
|
||||
else
|
||||
dblocks = mp->m_refc_maxlevels * 2;
|
||||
error = xfs_trans_alloc(mp, &resv, dblocks, 0, XFS_TRANS_RESERVE, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
|
|
@ -573,6 +573,7 @@ xfs_rmap_recover_work(
|
|||
struct xfs_rui_log_item *ruip = RUI_ITEM(lip);
|
||||
struct xfs_trans *tp;
|
||||
struct xfs_mount *mp = lip->li_log->l_mp;
|
||||
unsigned int dblocks;
|
||||
bool isrt = xfs_rui_item_isrt(lip);
|
||||
int i;
|
||||
int error = 0;
|
||||
|
|
@ -596,8 +597,11 @@ xfs_rmap_recover_work(
|
|||
}
|
||||
|
||||
resv = xlog_recover_resv(&M_RES(mp)->tr_itruncate);
|
||||
error = xfs_trans_alloc(mp, &resv, mp->m_rmap_maxlevels, 0,
|
||||
XFS_TRANS_RESERVE, &tp);
|
||||
if (isrt)
|
||||
dblocks = mp->m_rtrmap_maxlevels;
|
||||
else
|
||||
dblocks = mp->m_rmap_maxlevels;
|
||||
error = xfs_trans_alloc(mp, &resv, dblocks, 0, XFS_TRANS_RESERVE, &tp);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user