xfs: make the start pointer passed to btree alloc_block functions const
authorDarrick J. Wong <djwong@kernel.org>
Thu, 12 Aug 2021 16:53:27 +0000 (09:53 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 19 Aug 2021 01:46:02 +0000 (18:46 -0700)
The @start pointer passed to each per-AG btree type's ->alloc_block
function isn't supposed to be modified, since it's a hint about the
location of the btree block being split that is to be fed to the
allocator, so mark the parameter const.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/libxfs/xfs_alloc_btree.c
fs/xfs/libxfs/xfs_bmap_btree.c
fs/xfs/libxfs/xfs_btree.h
fs/xfs/libxfs/xfs_btree_staging.c
fs/xfs/libxfs/xfs_ialloc_btree.c
fs/xfs/libxfs/xfs_refcount_btree.c
fs/xfs/libxfs/xfs_rmap_btree.c

index 87f7f9f27449048674763ed43ede2a27bb1e2b7a..0b9303caf41a171f949e3c496cc46653d4a428f9 100644 (file)
@@ -50,10 +50,10 @@ xfs_allocbt_set_root(
 
 STATIC int
 xfs_allocbt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        int                     error;
        xfs_agblock_t           bno;
index 961f0193b058a4659dfcc0e2376a825483882eda..3bb7c03ea4d16d10eff2e413b84dc1934585a183 100644 (file)
@@ -193,10 +193,10 @@ xfs_bmbt_update_cursor(
 
 STATIC int
 xfs_bmbt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        xfs_alloc_arg_t         args;           /* block allocation args */
        int                     error;          /* error return value */
index 504032d91a0a37d80b75bc7ac2098351b2cbeaeb..8a36012a2e89b4ebe92842e7b84c3a4d745cca1d 100644 (file)
@@ -110,7 +110,7 @@ struct xfs_btree_ops {
 
        /* block allocation / freeing */
        int     (*alloc_block)(struct xfs_btree_cur *cur,
-                              union xfs_btree_ptr *start_bno,
+                              const union xfs_btree_ptr *start_bno,
                               union xfs_btree_ptr *new_bno,
                               int *stat);
        int     (*free_block)(struct xfs_btree_cur *cur, struct xfs_buf *bp);
index bce6a3da98655cb646d5d379600c2d4611519366..ac9e80152b5cff8f27ca5eabca862a71b1239c50 100644 (file)
@@ -59,10 +59,10 @@ xfs_btree_fakeroot_dup_cursor(
  */
 STATIC int
 xfs_btree_fakeroot_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start_bno,
-       union xfs_btree_ptr     *new_bno,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start_bno,
+       union xfs_btree_ptr             *new_bno,
+       int                             *stat)
 {
        ASSERT(0);
        return -EFSCORRUPTED;
index 903537a08c8ee85d3372e578b1b4dbeb9390da3e..cb602ba8b5d1da90c59f6763a46cde71677e785f 100644 (file)
@@ -88,11 +88,11 @@ xfs_inobt_mod_blockcount(
 
 STATIC int
 __xfs_inobt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat,
-       enum xfs_ag_resv_type   resv)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat,
+       enum xfs_ag_resv_type           resv)
 {
        xfs_alloc_arg_t         args;           /* block allocation args */
        int                     error;          /* error return value */
@@ -127,20 +127,20 @@ __xfs_inobt_alloc_block(
 
 STATIC int
 xfs_inobt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        return __xfs_inobt_alloc_block(cur, start, new, stat, XFS_AG_RESV_NONE);
 }
 
 STATIC int
 xfs_finobt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        if (cur->bc_mp->m_finobt_nores)
                return xfs_inobt_alloc_block(cur, start, new, stat);
index ec4b7195c371175e239b4675a5f2a4c5ae87fcb2..3c97c24f033b93aa4097c2663118d92a8c4403f8 100644 (file)
@@ -51,10 +51,10 @@ xfs_refcountbt_set_root(
 
 STATIC int
 xfs_refcountbt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        struct xfs_buf          *agbp = cur->bc_ag.agbp;
        struct xfs_agf          *agf = agbp->b_addr;
index 4b62064d0baab6d3dc7a0f85e5f46293d96a9b40..aa86f35d05fc705887e52c591d8b6debb670b9aa 100644 (file)
@@ -76,10 +76,10 @@ xfs_rmapbt_set_root(
 
 STATIC int
 xfs_rmapbt_alloc_block(
-       struct xfs_btree_cur    *cur,
-       union xfs_btree_ptr     *start,
-       union xfs_btree_ptr     *new,
-       int                     *stat)
+       struct xfs_btree_cur            *cur,
+       const union xfs_btree_ptr       *start,
+       union xfs_btree_ptr             *new,
+       int                             *stat)
 {
        struct xfs_buf          *agbp = cur->bc_ag.agbp;
        struct xfs_agf          *agf = agbp->b_addr;