summaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rmap_item.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2024-07-02 20:23:02 +0200
committerDarrick J. Wong <djwong@kernel.org>2024-07-02 20:37:04 +0200
commit8363b4361997044ecb99880a1a9bfdebf9145eed (patch)
tree0353623606427e7ba37922d92a28e86900a529d6 /fs/xfs/xfs_rmap_item.c
parentxfs: reuse xfs_rmap_update_cancel_item (diff)
downloadlinux-8363b4361997044ecb99880a1a9bfdebf9145eed.tar.xz
linux-8363b4361997044ecb99880a1a9bfdebf9145eed.zip
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 <hch@lst.de> Reviewed-by: Darrick J. Wong <djwong@kernel.org> [djwong: minor porting changes] Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Diffstat (limited to 'fs/xfs/xfs_rmap_item.c')
-rw-r--r--fs/xfs/xfs_rmap_item.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/xfs/xfs_rmap_item.c b/fs/xfs/xfs_rmap_item.c
index 68e4ce0dbd72..44a9b77c1763 100644
--- a/fs/xfs/xfs_rmap_item.c
+++ b/fs/xfs/xfs_rmap_item.c
@@ -21,6 +21,7 @@
#include "xfs_log_priv.h"
#include "xfs_log_recover.h"
#include "xfs_ag.h"
+#include "xfs_btree.h"
struct kmem_cache *xfs_rui_cache;
struct kmem_cache *xfs_rud_cache;
@@ -386,6 +387,23 @@ xfs_rmap_update_finish_item(
return error;
}
+/* Clean up after calling xfs_rmap_finish_one. */
+STATIC void
+xfs_rmap_finish_one_cleanup(
+ struct xfs_trans *tp,
+ struct xfs_btree_cur *rcur,
+ int error)
+{
+ struct xfs_buf *agbp = NULL;
+
+ if (rcur == NULL)
+ return;
+ agbp = rcur->bc_ag.agbp;
+ xfs_btree_del_cursor(rcur, error);
+ if (error && agbp)
+ xfs_trans_brelse(tp, agbp);
+}
+
/* Abort all pending RUIs. */
STATIC void
xfs_rmap_update_abort_intent(