Skip to content

Commit 5d3d0a6

Browse files
author
Darrick J. Wong
committed
xfs: reuse xfs_bmap_update_cancel_item
Reuse xfs_bmap_update_cancel_item to put the AG/RTG and free the item in a few places that currently open code the logic. Inspired-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Darrick J. Wong <djwong@kernel.org> Reviewed-by: Christoph Hellwig <hch@lst.de>
1 parent de47e4c commit 5d3d0a6

1 file changed

Lines changed: 12 additions & 13 deletions

File tree

fs/xfs/xfs_bmap_item.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,17 @@ xfs_bmap_update_put_group(
343343
xfs_perag_intent_put(bi->bi_pag);
344344
}
345345

346+
/* Cancel a deferred bmap update. */
347+
STATIC void
348+
xfs_bmap_update_cancel_item(
349+
struct list_head *item)
350+
{
351+
struct xfs_bmap_intent *bi = bi_entry(item);
352+
353+
xfs_bmap_update_put_group(bi);
354+
kmem_cache_free(xfs_bmap_intent_cache, bi);
355+
}
356+
346357
/* Process a deferred bmap update. */
347358
STATIC int
348359
xfs_bmap_update_finish_item(
@@ -360,8 +371,7 @@ xfs_bmap_update_finish_item(
360371
return -EAGAIN;
361372
}
362373

363-
xfs_bmap_update_put_group(bi);
364-
kmem_cache_free(xfs_bmap_intent_cache, bi);
374+
xfs_bmap_update_cancel_item(item);
365375
return error;
366376
}
367377

@@ -373,17 +383,6 @@ xfs_bmap_update_abort_intent(
373383
xfs_bui_release(BUI_ITEM(intent));
374384
}
375385

376-
/* Cancel a deferred bmap update. */
377-
STATIC void
378-
xfs_bmap_update_cancel_item(
379-
struct list_head *item)
380-
{
381-
struct xfs_bmap_intent *bi = bi_entry(item);
382-
383-
xfs_bmap_update_put_group(bi);
384-
kmem_cache_free(xfs_bmap_intent_cache, bi);
385-
}
386-
387386
/* Is this recovered BUI ok? */
388387
static inline bool
389388
xfs_bui_validate(

0 commit comments

Comments
 (0)