Skip to content

Commit bac3f78

Browse files
author
Darrick J. Wong
committed
xfs: don't bother calling xfs_refcount_finish_one_cleanup in xfs_refcount_finish_one
In xfs_refcount_finish_one we know the cursor is non-zero when calling xfs_refcount_finish_one_cleanup and we pass a 0 error variable. This means xfs_refcount_finish_one_cleanup is just doing a xfs_btree_del_cursor. Open code that and move xfs_refcount_finish_one_cleanup to fs/xfs/xfs_refcount_item.c. Inspired-by: Christoph Hellwig <[email protected]> Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]>
1 parent 8aef799 commit bac3f78

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

fs/xfs/libxfs/xfs_refcount.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,23 +1300,6 @@ xfs_refcount_adjust(
13001300
return error;
13011301
}
13021302

1303-
/* Clean up after calling xfs_refcount_finish_one. */
1304-
void
1305-
xfs_refcount_finish_one_cleanup(
1306-
struct xfs_trans *tp,
1307-
struct xfs_btree_cur *rcur,
1308-
int error)
1309-
{
1310-
struct xfs_buf *agbp;
1311-
1312-
if (rcur == NULL)
1313-
return;
1314-
agbp = rcur->bc_ag.agbp;
1315-
xfs_btree_del_cursor(rcur, error);
1316-
if (error)
1317-
xfs_trans_brelse(tp, agbp);
1318-
}
1319-
13201303
/*
13211304
* Set up a continuation a deferred refcount operation by updating the intent.
13221305
* Checks to make sure we're not going to run off the end of the AG.
@@ -1380,7 +1363,7 @@ xfs_refcount_finish_one(
13801363
if (rcur != NULL && rcur->bc_ag.pag != ri->ri_pag) {
13811364
nr_ops = rcur->bc_refc.nr_ops;
13821365
shape_changes = rcur->bc_refc.shape_changes;
1383-
xfs_refcount_finish_one_cleanup(tp, rcur, 0);
1366+
xfs_btree_del_cursor(rcur, 0);
13841367
rcur = NULL;
13851368
*pcur = NULL;
13861369
}

fs/xfs/libxfs/xfs_refcount.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,6 @@ void xfs_refcount_increase_extent(struct xfs_trans *tp,
8282
void xfs_refcount_decrease_extent(struct xfs_trans *tp,
8383
struct xfs_bmbt_irec *irec);
8484

85-
extern void xfs_refcount_finish_one_cleanup(struct xfs_trans *tp,
86-
struct xfs_btree_cur *rcur, int error);
8785
extern int xfs_refcount_finish_one(struct xfs_trans *tp,
8886
struct xfs_refcount_intent *ri, struct xfs_btree_cur **pcur);
8987

fs/xfs/xfs_refcount_item.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "xfs_log_priv.h"
2222
#include "xfs_log_recover.h"
2323
#include "xfs_ag.h"
24+
#include "xfs_btree.h"
2425

2526
struct kmem_cache *xfs_cui_cache;
2627
struct kmem_cache *xfs_cud_cache;
@@ -369,6 +370,23 @@ xfs_refcount_update_finish_item(
369370
return error;
370371
}
371372

373+
/* Clean up after calling xfs_refcount_finish_one. */
374+
STATIC void
375+
xfs_refcount_finish_one_cleanup(
376+
struct xfs_trans *tp,
377+
struct xfs_btree_cur *rcur,
378+
int error)
379+
{
380+
struct xfs_buf *agbp;
381+
382+
if (rcur == NULL)
383+
return;
384+
agbp = rcur->bc_ag.agbp;
385+
xfs_btree_del_cursor(rcur, error);
386+
if (error)
387+
xfs_trans_brelse(tp, agbp);
388+
}
389+
372390
/* Abort all pending CUIs. */
373391
STATIC void
374392
xfs_refcount_update_abort_intent(

0 commit comments

Comments
 (0)