Skip to content

Commit 8363b43

Browse files
Christoph HellwigDarrick J. Wong
authored andcommitted
xfs: don't bother calling xfs_rmap_finish_one_cleanup in xfs_rmap_finish_one
In xfs_rmap_finish_one we known the cursor is non-zero when calling xfs_rmap_finish_one_cleanup and we pass a 0 error variable. This means xfs_rmap_finish_one_cleanup is just doing a xfs_btree_del_cursor. Open code that and move xfs_rmap_finish_one_cleanup to fs/xfs/xfs_rmap_item.c. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> [djwong: minor porting changes] Signed-off-by: Darrick J. Wong <[email protected]>
1 parent 37f9d1d commit 8363b43

File tree

3 files changed

+19
-20
lines changed

3 files changed

+19
-20
lines changed

fs/xfs/libxfs/xfs_rmap.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2523,23 +2523,6 @@ xfs_rmap_query_all(
25232523
return xfs_btree_query_all(cur, xfs_rmap_query_range_helper, &query);
25242524
}
25252525

2526-
/* Clean up after calling xfs_rmap_finish_one. */
2527-
void
2528-
xfs_rmap_finish_one_cleanup(
2529-
struct xfs_trans *tp,
2530-
struct xfs_btree_cur *rcur,
2531-
int error)
2532-
{
2533-
struct xfs_buf *agbp;
2534-
2535-
if (rcur == NULL)
2536-
return;
2537-
agbp = rcur->bc_ag.agbp;
2538-
xfs_btree_del_cursor(rcur, error);
2539-
if (error)
2540-
xfs_trans_brelse(tp, agbp);
2541-
}
2542-
25432526
/* Commit an rmap operation into the ondisk tree. */
25442527
int
25452528
__xfs_rmap_finish_intent(
@@ -2604,7 +2587,7 @@ xfs_rmap_finish_one(
26042587
*/
26052588
rcur = *pcur;
26062589
if (rcur != NULL && rcur->bc_ag.pag != ri->ri_pag) {
2607-
xfs_rmap_finish_one_cleanup(tp, rcur, 0);
2590+
xfs_btree_del_cursor(rcur, 0);
26082591
rcur = NULL;
26092592
*pcur = NULL;
26102593
}

fs/xfs/libxfs/xfs_rmap.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ void xfs_rmap_alloc_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
192192
void xfs_rmap_free_extent(struct xfs_trans *tp, xfs_agnumber_t agno,
193193
xfs_agblock_t bno, xfs_extlen_t len, uint64_t owner);
194194

195-
void xfs_rmap_finish_one_cleanup(struct xfs_trans *tp,
196-
struct xfs_btree_cur *rcur, int error);
197195
int xfs_rmap_finish_one(struct xfs_trans *tp, struct xfs_rmap_intent *ri,
198196
struct xfs_btree_cur **pcur);
199197
int __xfs_rmap_finish_intent(struct xfs_btree_cur *rcur,

fs/xfs/xfs_rmap_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_rui_cache;
2627
struct kmem_cache *xfs_rud_cache;
@@ -386,6 +387,23 @@ xfs_rmap_update_finish_item(
386387
return error;
387388
}
388389

390+
/* Clean up after calling xfs_rmap_finish_one. */
391+
STATIC void
392+
xfs_rmap_finish_one_cleanup(
393+
struct xfs_trans *tp,
394+
struct xfs_btree_cur *rcur,
395+
int error)
396+
{
397+
struct xfs_buf *agbp = NULL;
398+
399+
if (rcur == NULL)
400+
return;
401+
agbp = rcur->bc_ag.agbp;
402+
xfs_btree_del_cursor(rcur, error);
403+
if (error && agbp)
404+
xfs_trans_brelse(tp, agbp);
405+
}
406+
389407
/* Abort all pending RUIs. */
390408
STATIC void
391409
xfs_rmap_update_abort_intent(

0 commit comments

Comments
 (0)