]> git.apps.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: move and rename xfs_btree_read_bufl
authorChristoph Hellwig <hch@lst.de>
Mon, 22 Apr 2024 17:01:09 +0000 (10:01 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Mon, 3 Jun 2024 18:37:40 +0000 (11:37 -0700)
Source kernel commit: 6a701eb8fbbb5f500684947883fd77ed0475fa82

Despite its name, xfs_btree_read_bufl doesn't contain any btree-related
functionaliy and isn't used by the btree code.  Move it to xfs_bmap.c,
hard code the refval and ops arguments and rename it to
xfs_bmap_read_buf.

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>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
libxfs/xfs_bmap.c
libxfs/xfs_btree.c
libxfs/xfs_btree.h

index 86643f4c3fde2e6f6ac67072afc2e2627dd9fbc6..4790efd3de28fcbe1ab9de5b199458e857573ff9 100644 (file)
@@ -220,6 +220,28 @@ xfs_bmap_forkoff_reset(
        }
 }
 
+static int
+xfs_bmap_read_buf(
+       struct xfs_mount        *mp,            /* file system mount point */
+       struct xfs_trans        *tp,            /* transaction pointer */
+       xfs_fsblock_t           fsbno,          /* file system block number */
+       struct xfs_buf          **bpp)          /* buffer for fsbno */
+{
+       struct xfs_buf          *bp;            /* return value */
+       int                     error;
+
+       if (!xfs_verify_fsbno(mp, fsbno))
+               return -EFSCORRUPTED;
+       error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
+                       XFS_FSB_TO_DADDR(mp, fsbno), mp->m_bsize, 0, &bp,
+                       &xfs_bmbt_buf_ops);
+       if (!error) {
+               xfs_buf_set_ref(bp, XFS_BMAP_BTREE_REF);
+               *bpp = bp;
+       }
+       return error;
+}
+
 #ifdef DEBUG
 STATIC struct xfs_buf *
 xfs_bmap_get_bp(
@@ -359,9 +381,7 @@ xfs_bmap_check_leaf_extents(
                bp = xfs_bmap_get_bp(cur, XFS_FSB_TO_DADDR(mp, bno));
                if (!bp) {
                        bp_release = 1;
-                       error = xfs_btree_read_bufl(mp, NULL, bno, &bp,
-                                               XFS_BMAP_BTREE_REF,
-                                               &xfs_bmbt_buf_ops);
+                       error = xfs_bmap_read_buf(mp, NULL, bno, &bp);
                        if (xfs_metadata_is_sick(error))
                                xfs_btree_mark_sick(cur);
                        if (error)
@@ -448,9 +468,7 @@ xfs_bmap_check_leaf_extents(
                bp = xfs_bmap_get_bp(cur, XFS_FSB_TO_DADDR(mp, bno));
                if (!bp) {
                        bp_release = 1;
-                       error = xfs_btree_read_bufl(mp, NULL, bno, &bp,
-                                               XFS_BMAP_BTREE_REF,
-                                               &xfs_bmbt_buf_ops);
+                       error = xfs_bmap_read_buf(mp, NULL, bno, &bp);
                        if (xfs_metadata_is_sick(error))
                                xfs_btree_mark_sick(cur);
                        if (error)
@@ -567,8 +585,7 @@ xfs_bmap_btree_to_extents(
                return -EFSCORRUPTED;
        }
 #endif
-       error = xfs_btree_read_bufl(mp, tp, cbno, &cbp, XFS_BMAP_BTREE_REF,
-                               &xfs_bmbt_buf_ops);
+       error = xfs_bmap_read_buf(mp, tp, cbno, &cbp);
        if (xfs_metadata_is_sick(error))
                xfs_btree_mark_sick(cur);
        if (error)
index 7168a575359aad887894479c653b42ad458e3515..a989b2da2dd5b68514c31a0e136a259bafe9659c 100644 (file)
@@ -856,36 +856,6 @@ xfs_btree_offsets(
        }
 }
 
-/*
- * Get a buffer for the block, return it read in.
- * Long-form addressing.
- */
-int
-xfs_btree_read_bufl(
-       struct xfs_mount        *mp,            /* file system mount point */
-       struct xfs_trans        *tp,            /* transaction pointer */
-       xfs_fsblock_t           fsbno,          /* file system block number */
-       struct xfs_buf          **bpp,          /* buffer for fsbno */
-       int                     refval,         /* ref count value for buffer */
-       const struct xfs_buf_ops *ops)
-{
-       struct xfs_buf          *bp;            /* return value */
-       xfs_daddr_t             d;              /* real disk block address */
-       int                     error;
-
-       if (!xfs_verify_fsbno(mp, fsbno))
-               return -EFSCORRUPTED;
-       d = XFS_FSB_TO_DADDR(mp, fsbno);
-       error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
-                                  mp->m_bsize, 0, &bp, ops);
-       if (error)
-               return error;
-       if (bp)
-               xfs_buf_set_ref(bp, refval);
-       *bpp = bp;
-       return 0;
-}
-
 STATIC int
 xfs_btree_readahead_fsblock(
        struct xfs_btree_cur    *cur,
index c48b4fdebafa67ca911e4b7417d2ca63dfaba576..bacd67cc8cedbc4c9d7a4a823af619f172bd0572 100644 (file)
@@ -378,19 +378,6 @@ xfs_btree_offsets(
        int                     *first, /* output: first byte offset */
        int                     *last); /* output: last byte offset */
 
-/*
- * Get a buffer for the block, return it read in.
- * Long-form addressing.
- */
-int                                    /* error */
-xfs_btree_read_bufl(
-       struct xfs_mount        *mp,    /* file system mount point */
-       struct xfs_trans        *tp,    /* transaction pointer */
-       xfs_fsblock_t           fsbno,  /* file system block number */
-       struct xfs_buf          **bpp,  /* buffer for fsbno */
-       int                     refval, /* ref count value for buffer */
-       const struct xfs_buf_ops *ops);
-
 /*
  * Initialise a new btree block header
  */