Skip to content

Commit 8aef799

Browse files
author
Darrick J. Wong
committed
xfs: reuse xfs_refcount_update_cancel_item
Reuse xfs_refcount_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 <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 0e92548 commit 8aef799

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

fs/xfs/xfs_refcount_item.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,17 @@ xfs_refcount_update_put_group(
335335
xfs_perag_intent_put(ri->ri_pag);
336336
}
337337

338+
/* Cancel a deferred refcount update. */
339+
STATIC void
340+
xfs_refcount_update_cancel_item(
341+
struct list_head *item)
342+
{
343+
struct xfs_refcount_intent *ri = ci_entry(item);
344+
345+
xfs_refcount_update_put_group(ri);
346+
kmem_cache_free(xfs_refcount_intent_cache, ri);
347+
}
348+
338349
/* Process a deferred refcount update. */
339350
STATIC int
340351
xfs_refcount_update_finish_item(
@@ -354,8 +365,7 @@ xfs_refcount_update_finish_item(
354365
return -EAGAIN;
355366
}
356367

357-
xfs_refcount_update_put_group(ri);
358-
kmem_cache_free(xfs_refcount_intent_cache, ri);
368+
xfs_refcount_update_cancel_item(item);
359369
return error;
360370
}
361371

@@ -367,17 +377,6 @@ xfs_refcount_update_abort_intent(
367377
xfs_cui_release(CUI_ITEM(intent));
368378
}
369379

370-
/* Cancel a deferred refcount update. */
371-
STATIC void
372-
xfs_refcount_update_cancel_item(
373-
struct list_head *item)
374-
{
375-
struct xfs_refcount_intent *ri = ci_entry(item);
376-
377-
xfs_refcount_update_put_group(ri);
378-
kmem_cache_free(xfs_refcount_intent_cache, ri);
379-
}
380-
381380
/* Is this recovered CUI ok? */
382381
static inline bool
383382
xfs_cui_validate_phys(

0 commit comments

Comments
 (0)