]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: move xfs_bmap_defer_add to xfs_bmap_item.c
authorDarrick J. Wong <djwong@kernel.org>
Mon, 22 Apr 2024 17:01:12 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:41 +0000 (11:37 -0700)
Source kernel commit: 80284115854e60686b2e0183b31bb303ae69aa8c

Move the code that adds the incore xfs_bmap_item deferred work data to a
transaction live with the BUI log item code.  This means that the file
mapping code no longer has to know about the inner workings of the BUI
log items.

As a consequence, we can hide the _get_group helper.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
libxfs/Makefile
libxfs/defer_item.c
libxfs/defer_item.h [new file with mode: 0644]
libxfs/xfs_bmap.c
libxfs/xfs_bmap.h

index 9baee62c0921346a244aa7c935facc54088702f6..1c88dbc2a5a7937cb9cdc1647bb95a295a5ecdca 100644 (file)
@@ -20,6 +20,7 @@ PKGHFILES = xfs_fs.h \
        xfs_log_format.h
 
 HFILES = \
+       defer_item.h \
        libxfs_io.h \
        libxfs_api_defs.h \
        init.h \
index 014589f82ec8d4b91906e14071286daff00667e7..d67032c262007aca4f364a81ffac74bc77dcb036 100644 (file)
@@ -24,6 +24,7 @@
 #include "xfs_da_btree.h"
 #include "xfs_attr.h"
 #include "libxfs.h"
+#include "defer_item.h"
 
 /* Dummy defer item ops, since we don't do logging. */
 
@@ -479,7 +480,7 @@ xfs_bmap_update_create_done(
 }
 
 /* Take an active ref to the AG containing the space we're mapping. */
-void
+static inline void
 xfs_bmap_update_get_group(
        struct xfs_mount        *mp,
        struct xfs_bmap_intent  *bi)
@@ -498,6 +499,18 @@ xfs_bmap_update_get_group(
        bi->bi_pag = xfs_perag_intent_get(mp, agno);
 }
 
+/* Add this deferred BUI to the transaction. */
+void
+xfs_bmap_defer_add(
+       struct xfs_trans        *tp,
+       struct xfs_bmap_intent  *bi)
+{
+       trace_xfs_bmap_defer(bi);
+
+       xfs_bmap_update_get_group(tp->t_mountp, bi);
+       xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
+}
+
 /* Release an active AG ref after finishing mapping work. */
 static inline void
 xfs_bmap_update_put_group(
diff --git a/libxfs/defer_item.h b/libxfs/defer_item.h
new file mode 100644 (file)
index 0000000..6d3abf1
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023-2024 Oracle.  All Rights Reserved.
+ * Author: Darrick J. Wong <djwong@kernel.org>
+ */
+#ifndef        __LIBXFS_DEFER_ITEM_H_
+#define        __LIBXFS_DEFER_ITEM_H_
+
+struct xfs_bmap_intent;
+
+void xfs_bmap_defer_add(struct xfs_trans *tp, struct xfs_bmap_intent *bi);
+
+#endif /* __LIBXFS_DEFER_ITEM_H_ */
index ae4f7e699922b3ee7f2a019b2c53bf69f75339aa..07bd8b34635a2a8a1086db7900339b7ea96ad1b1 100644 (file)
@@ -31,6 +31,7 @@
 #include "xfs_refcount.h"
 #include "xfs_rtbitmap.h"
 #include "xfs_health.h"
+#include "defer_item.h"
 
 struct kmem_cache              *xfs_bmap_intent_cache;
 
@@ -6192,10 +6193,7 @@ __xfs_bmap_add(
        bi->bi_whichfork = whichfork;
        bi->bi_bmap = *bmap;
 
-       trace_xfs_bmap_defer(bi);
-
-       xfs_bmap_update_get_group(tp->t_mountp, bi);
-       xfs_defer_add(tp, &bi->bi_list, &xfs_bmap_update_defer_type);
+       xfs_bmap_defer_add(tp, bi);
        return 0;
 }
 
index 0a2fd9304d1c50617d3049887cb205ac5e19de86..325cc232a4153df49d8a83e6df0f0cad5529be92 100644 (file)
@@ -245,9 +245,6 @@ struct xfs_bmap_intent {
        struct xfs_bmbt_irec                    bi_bmap;
 };
 
-void xfs_bmap_update_get_group(struct xfs_mount *mp,
-               struct xfs_bmap_intent *bi);
-
 int    xfs_bmap_finish_one(struct xfs_trans *tp, struct xfs_bmap_intent *bi);
 void   xfs_bmap_map_extent(struct xfs_trans *tp, struct xfs_inode *ip,
                struct xfs_bmbt_irec *imap);