]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
libxfs: mark xmbuf_{un,}map_page static
authorChristoph Hellwig <hch@lst.de>
Mon, 24 Feb 2025 18:21:41 +0000 (10:21 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 25 Feb 2025 17:15:56 +0000 (09:15 -0800)
Not used outside of buf_mem.c.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
libxfs/buf_mem.c
libxfs/buf_mem.h

index 16cb038ba10e2a4644a479e3e8cae159732be3b3..77396fa95b413806f76436b8da06413f2dfb9bef 100644 (file)
@@ -85,6 +85,55 @@ xmbuf_libinit(void)
                xmbuf_max_mappings = 1024;
 }
 
+/* Directly map a memfd page into the buffer cache. */
+static int
+xmbuf_map_page(
+       struct xfs_buf          *bp)
+{
+       struct xfile            *xfile = bp->b_target->bt_xfile;
+       void                    *p;
+       loff_t                  pos;
+
+       pos = xfile->partition_pos + BBTOB(xfs_buf_daddr(bp));
+       p = mmap(NULL, BBTOB(bp->b_length), PROT_READ | PROT_WRITE, MAP_SHARED,
+                       xfile->fcb->fd, pos);
+       if (p == MAP_FAILED) {
+               if (errno == ENOMEM && !xmbuf_unmap_early) {
+#ifdef DEBUG
+                       fprintf(stderr, "xmbuf could not make mappings!\n");
+#endif
+                       xmbuf_unmap_early = true;
+               }
+               return errno;
+       }
+
+       if (!xmbuf_unmap_early &&
+           atomic_inc_return(&xmbuf_mappings) > xmbuf_max_mappings) {
+#ifdef DEBUG
+               fprintf(stderr, _("xmbuf hit too many mappings (%ld)!\n",
+                                       xmbuf_max_mappings);
+#endif
+               xmbuf_unmap_early = true;
+       }
+
+       bp->b_addr = p;
+       bp->b_flags |= LIBXFS_B_UPTODATE | LIBXFS_B_UNCHECKED;
+       bp->b_error = 0;
+       return 0;
+}
+
+/* Unmap a memfd page that was mapped into the buffer cache. */
+static void
+xmbuf_unmap_page(
+       struct xfs_buf          *bp)
+{
+       if (!xmbuf_unmap_early)
+               atomic_dec(&xmbuf_mappings);
+       munmap(bp->b_addr, BBTOB(bp->b_length));
+       bp->b_addr = NULL;
+}
+
+
 /* Allocate a new cache node (aka a xfs_buf) */
 static struct cache_node *
 xmbuf_cache_alloc(
@@ -280,54 +329,6 @@ xmbuf_free(
        kfree(btp);
 }
 
-/* Directly map a memfd page into the buffer cache. */
-int
-xmbuf_map_page(
-       struct xfs_buf          *bp)
-{
-       struct xfile            *xfile = bp->b_target->bt_xfile;
-       void                    *p;
-       loff_t                  pos;
-
-       pos = xfile->partition_pos + BBTOB(xfs_buf_daddr(bp));
-       p = mmap(NULL, BBTOB(bp->b_length), PROT_READ | PROT_WRITE, MAP_SHARED,
-                       xfile->fcb->fd, pos);
-       if (p == MAP_FAILED) {
-               if (errno == ENOMEM && !xmbuf_unmap_early) {
-#ifdef DEBUG
-                       fprintf(stderr, "xmbuf could not make mappings!\n");
-#endif
-                       xmbuf_unmap_early = true;
-               }
-               return errno;
-       }
-
-       if (!xmbuf_unmap_early &&
-           atomic_inc_return(&xmbuf_mappings) > xmbuf_max_mappings) {
-#ifdef DEBUG
-               fprintf(stderr, _("xmbuf hit too many mappings (%ld)!\n",
-                                       xmbuf_max_mappings);
-#endif
-               xmbuf_unmap_early = true;
-       }
-
-       bp->b_addr = p;
-       bp->b_flags |= LIBXFS_B_UPTODATE | LIBXFS_B_UNCHECKED;
-       bp->b_error = 0;
-       return 0;
-}
-
-/* Unmap a memfd page that was mapped into the buffer cache. */
-void
-xmbuf_unmap_page(
-       struct xfs_buf          *bp)
-{
-       if (!xmbuf_unmap_early)
-               atomic_dec(&xmbuf_mappings);
-       munmap(bp->b_addr, BBTOB(bp->b_length));
-       bp->b_addr = NULL;
-}
-
 /* Is this a valid daddr within the buftarg? */
 bool
 xmbuf_verify_daddr(
index f19bc6fd700b9ad4c96d4e4e8d5f43e0e149fda3..6e4b2d3503b853bf7419e976c2b7d9cd6374342f 100644 (file)
@@ -20,9 +20,6 @@ int xmbuf_alloc(struct xfs_mount *mp, const char *descr,
                unsigned long long maxpos, struct xfs_buftarg **btpp);
 void xmbuf_free(struct xfs_buftarg *btp);
 
-int xmbuf_map_page(struct xfs_buf *bp);
-void xmbuf_unmap_page(struct xfs_buf *bp);
-
 bool xmbuf_verify_daddr(struct xfs_buftarg *btp, xfs_daddr_t daddr);
 void xmbuf_trans_bdetach(struct xfs_trans *tp, struct xfs_buf *bp);
 int xmbuf_finalize(struct xfs_buf *bp);