]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: massage xfs_imap_to_bp into xfs_read_icluster
authorChristoph Hellwig <hch@lst.de>
Mon, 1 Jun 2026 12:43:49 +0000 (14:43 +0200)
committerCarlos Maiolino <cem@kernel.org>
Tue, 9 Jun 2026 07:14:42 +0000 (09:14 +0200)
xfs_imap_to_bp only uses the im_blkno field from struct xfs_imap, so pass
that directly.  Rename the function to xfs_read_icluster, which describes
the functionality much better and matches other helpers like xfs_read_agf
and xfs_read_agi.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/libxfs/xfs_ialloc.c
fs/xfs/libxfs/xfs_inode_buf.c
fs/xfs/libxfs/xfs_inode_buf.h
fs/xfs/scrub/ialloc.c
fs/xfs/scrub/ialloc_repair.c
fs/xfs/xfs_icache.c
fs/xfs/xfs_inode_item.c
fs/xfs/xfs_iunlink_item.c

index 6ea7e96a07b4e626e8854f7c57a9343a03d22020..18d07cf4c3e0e84a9e65a390d533e49603b1a713 100644 (file)
@@ -1075,7 +1075,7 @@ xfs_dialloc_check_ino(
        if (error)
                return -EAGAIN;
 
-       error = xfs_imap_to_bp(pag_mount(pag), tp, &imap, &bp);
+       error = xfs_read_icluster(pag_mount(pag), tp, imap.im_blkno, &bp);
        if (error)
                return -EAGAIN;
 
index ecc50daa67ba21e3bf5f77db2f6ed3137d505fac..a9864e3050cb91a41e05ad3eb6b0be9127de17c8 100644 (file)
@@ -123,24 +123,22 @@ const struct xfs_buf_ops xfs_inode_buf_ra_ops = {
 
 
 /*
- * This routine is called to map an inode to the buffer containing the on-disk
- * version of the inode.  It returns a pointer to the buffer containing the
- * on-disk inode in the bpp parameter.
+ * Read the inode cluster at @bno and return it in @bpp.
  */
 int
-xfs_imap_to_bp(
+xfs_read_icluster(
        struct xfs_mount        *mp,
        struct xfs_trans        *tp,
-       struct xfs_imap         *imap,
+       xfs_daddr_t             bno,
        struct xfs_buf          **bpp)
 {
        int                     error;
 
-       error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, imap->im_blkno,
+       error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, bno,
                        XFS_FSB_TO_BB(mp, M_IGEO(mp)->blocks_per_cluster),
                        0, bpp, &xfs_inode_buf_ops);
        if (xfs_metadata_is_sick(error))
-               xfs_agno_mark_sick(mp, xfs_daddr_to_agno(mp, imap->im_blkno),
+               xfs_agno_mark_sick(mp, xfs_daddr_to_agno(mp, bno),
                                XFS_SICK_AG_INODES);
        return error;
 }
index 54870796da419aca959cd1e35e1e02e1d7f6eb18..bcad22871b5c40efcbff75c305603958503fad6b 100644 (file)
@@ -11,15 +11,15 @@ struct xfs_dinode;
 
 /*
  * Inode location information.  Stored in the inode and passed to
- * xfs_imap_to_bp() to get a buffer and dinode for a given inode.
+ * xfs_read_icluster() to get a buffer and dinode for a given inode.
  */
 struct xfs_imap {
        xfs_daddr_t     im_blkno;       /* starting BB of inode chunk */
        unsigned short  im_boffset;     /* inode offset in block in bytes */
 };
 
-int    xfs_imap_to_bp(struct xfs_mount *mp, struct xfs_trans *tp,
-                      struct xfs_imap *imap, struct xfs_buf **bpp);
+int    xfs_read_icluster(struct xfs_mount *mp, struct xfs_trans *tp,
+               xfs_daddr_t bno, struct xfs_buf **bpp);
 void   xfs_dinode_calc_crc(struct xfs_mount *mp, struct xfs_dinode *dip);
 void   xfs_inode_to_disk(struct xfs_inode *ip, struct xfs_dinode *to,
                          xfs_lsn_t lsn);
index a7192ba29262a15142c39e19f98a96161a3ec0d6..fafbf163672374e0be130b721e532df500ae55d6 100644 (file)
@@ -429,7 +429,8 @@ xchk_iallocbt_check_cluster(
                        &XFS_RMAP_OINFO_INODES);
 
        /* Grab the inode cluster buffer. */
-       error = xfs_imap_to_bp(mp, bs->cur->bc_tp, &imap, &cluster_bp);
+       error = xfs_read_icluster(mp, bs->cur->bc_tp, imap.im_blkno,
+                       &cluster_bp);
        if (!xchk_btree_xref_process_error(bs->sc, bs->cur, 0, &error))
                return error;
 
index 2d7b9ce968dc41053f1785f987c389c23b80d38b..167f605a49628649000b909cad822b768b19cbaf 100644 (file)
@@ -287,7 +287,6 @@ xrep_ibt_process_cluster(
        struct xrep_ibt         *ri,
        xfs_agblock_t           cluster_bno)
 {
-       struct xfs_imap         imap;
        struct xfs_buf          *cluster_bp;
        struct xfs_scrub        *sc = ri->sc;
        struct xfs_mount        *mp = sc->mp;
@@ -305,9 +304,9 @@ xrep_ibt_process_cluster(
         * inobt because imap_to_bp directly maps the buffer without touching
         * either inode btree.
         */
-       imap.im_blkno = xfs_agbno_to_daddr(sc->sa.pag, cluster_bno);
-       imap.im_boffset = 0;
-       error = xfs_imap_to_bp(mp, sc->tp, &imap, &cluster_bp);
+       error = xfs_read_icluster(mp, sc->tp,
+                       xfs_agbno_to_daddr(sc->sa.pag, cluster_bno),
+                       &cluster_bp);
        if (error)
                return error;
 
index 6f19e751bb8aeb0086457d8a5864903077499b1e..234c1e6974e49463cab0db361cbdd21167187827 100644 (file)
@@ -663,7 +663,7 @@ xfs_iget_cache_miss(
        } else {
                struct xfs_buf          *bp;
 
-               error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &bp);
+               error = xfs_read_icluster(mp, tp, ip->i_imap.im_blkno, &bp);
                if (error)
                        goto out_destroy;
 
index 3256495202cf75e642497ae55659e7a7ec50b304..b4a835eb2e6d72b214b8cbe0a90be83eb3e4f100 100644 (file)
@@ -167,7 +167,8 @@ xfs_inode_item_precommit(
                 * here.
                 */
                spin_unlock(&iip->ili_lock);
-               error = xfs_imap_to_bp(ip->i_mount, tp, &ip->i_imap, &bp);
+               error = xfs_read_icluster(ip->i_mount, tp, ip->i_imap.im_blkno,
+                               &bp);
                if (error)
                        return error;
 
index c8817112d49d122d25983197b9ce9a8db9423055..f8f2edea0934c053bf871854965d34346ecf1cf9 100644 (file)
@@ -59,7 +59,7 @@ xfs_iunlink_log_dinode(
        int                     offset;
        int                     error;
 
-       error = xfs_imap_to_bp(tp->t_mountp, tp, &ip->i_imap, &ibp);
+       error = xfs_read_icluster(tp->t_mountp, tp, ip->i_imap.im_blkno, &ibp);
        if (error)
                return error;
        /*