From: Andrey Albershteyn <aalbersh@kernel.org>
To: linux-xfs@vger.kernel.org, aalbersh@kernel.org
Cc: bestswngs@gmail.com, brauner@kernel.org, cem@kernel.org,
chuck.lever@oracle.com, cmaiolino@redhat.com,
dawei.feng@seu.edu.cn, djwong@kernel.org,
gaoyingjie@uniontech.com, hch@lst.de, jiapenglin@tencent.com,
roland.mainz@nrubsig.org, xmei5@asu.edu
Subject: [PATCH v2 06/23] xfs: add a XFS_INO_TO_FSB helper
Date: Thu, 3 Sep 2026 13:39:48 +0200 [thread overview]
Message-ID: <20260903114022.570210-7-aalbersh@kernel.org> (raw)
In-Reply-To: <20260903114022.570210-1-aalbersh@kernel.org>
From: Christoph Hellwig <hch@lst.de>
Source kernel commit: f8b7c9a8b0a9e43b054981d134b426d9464264f6
Add a shortcut for the common XFS_INO_TO_FSB(mp, ip->i_ino) pattern.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
libxfs/xfs_bmap.c | 8 +++-----
libxfs/xfs_btree.c | 6 ++----
libxfs/xfs_format.h | 2 ++
repair/bulkload.c | 2 +-
4 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/libxfs/xfs_bmap.c b/libxfs/xfs_bmap.c
index 96975f88497a..d211d31697a2 100644
--- a/libxfs/xfs_bmap.c
+++ b/libxfs/xfs_bmap.c
@@ -675,8 +675,7 @@ xfs_bmap_extents_to_btree(
args.minlen = args.maxlen = args.prod = 1;
args.wasdel = wasdel;
*logflagsp = 0;
- error = xfs_alloc_vextent_start_ag(&args,
- XFS_INO_TO_FSB(mp, ip->i_ino));
+ error = xfs_alloc_vextent_start_ag(&args, XFS_INODE_TO_FSB(ip));
if (error)
goto out_root_realloc;
@@ -822,8 +821,7 @@ xfs_bmap_local_to_extents(
*/
args.total = total;
args.minlen = args.maxlen = args.prod = 1;
- error = xfs_alloc_vextent_start_ag(&args,
- XFS_INO_TO_FSB(args.mp, ip->i_ino));
+ error = xfs_alloc_vextent_start_ag(&args, XFS_INODE_TO_FSB(ip));
if (error)
goto done;
@@ -3584,7 +3582,7 @@ xfs_bmap_btalloc_best_length(
xfs_extlen_t blen = 0;
int error;
- ap->blkno = XFS_INO_TO_FSB(args->mp, ap->ip->i_ino);
+ ap->blkno = XFS_INODE_TO_FSB(ap->ip);
if (!xfs_bmap_adjacent(ap))
ap->eof = false;
diff --git a/libxfs/xfs_btree.c b/libxfs/xfs_btree.c
index 4ab0d8d3789b..0069fba162a8 100644
--- a/libxfs/xfs_btree.c
+++ b/libxfs/xfs_btree.c
@@ -3240,8 +3240,7 @@ xfs_btree_new_iroot(
if (level > 0)
aptr = *xfs_btree_ptr_addr(cur, 1, block);
else
- aptr.l = cpu_to_be64(XFS_INO_TO_FSB(cur->bc_mp,
- cur->bc_ino.ip->i_ino));
+ aptr.l = cpu_to_be64(XFS_INODE_TO_FSB(cur->bc_ino.ip));
/* Allocate the new block. If we can't do it, we're toast. Give up. */
error = xfs_btree_alloc_block(cur, &aptr, &nptr, stat);
@@ -5606,8 +5605,7 @@ xfs_btree_alloc_metafile_block(
ASSERT(xfs_is_metadir_inode(ip));
xfs_rmap_ino_bmbt_owner(&args.oinfo, ip->i_ino, cur->bc_ino.whichfork);
- error = xfs_alloc_vextent_start_ag(&args,
- XFS_INO_TO_FSB(cur->bc_mp, ip->i_ino));
+ error = xfs_alloc_vextent_start_ag(&args, XFS_INODE_TO_FSB(ip));
if (error)
return error;
if (args.fsbno == NULLFSBLOCK) {
diff --git a/libxfs/xfs_format.h b/libxfs/xfs_format.h
index f812c6782492..9886af0507e3 100644
--- a/libxfs/xfs_format.h
+++ b/libxfs/xfs_format.h
@@ -1289,6 +1289,8 @@ static inline bool xfs_dinode_is_metadir(const struct xfs_dinode *dip)
((int)(i) & XFS_INO_MASK(XFS_INO_OFFSET_BITS(mp)))
#define XFS_INO_TO_FSB(mp,i) \
XFS_AGB_TO_FSB(mp, XFS_INO_TO_AGNO(mp,i), XFS_INO_TO_AGBNO(mp,i))
+#define XFS_INODE_TO_FSB(ip) \
+ XFS_INO_TO_FSB((ip)->i_mount, (ip)->i_ino)
#define XFS_AGINO_TO_INO(mp,a,i) \
(((xfs_ino_t)(a) << XFS_INO_AGINO_BITS(mp)) | (i))
#define XFS_AGINO_TO_AGBNO(mp,i) ((i) >> XFS_INO_OFFSET_BITS(mp))
diff --git a/repair/bulkload.c b/repair/bulkload.c
index a9e51de0a24c..6bc110071f02 100644
--- a/repair/bulkload.c
+++ b/repair/bulkload.c
@@ -32,7 +32,7 @@ bulkload_init_inode(
int whichfork,
const struct xfs_owner_info *oinfo)
{
- bulkload_init_ag(bkl, sc, oinfo, XFS_INO_TO_FSB(sc->mp, sc->ip->i_ino));
+ bulkload_init_ag(bkl, sc, oinfo, XFS_INODE_TO_FSB(sc->ip));
bkl->ifake.if_fork = kmem_cache_zalloc(xfs_ifork_cache, 0);
bkl->ifake.if_fork_size = xfs_inode_fork_size(sc->ip, whichfork);
}
--
2.55.0
next prev parent reply other threads:[~2026-09-03 11:41 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 11:39 [PATCH v2 00/23] xfsprogs: libxfs sync for v7.2 Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 01/23] libxfs: convert diff_items helpers to cmp_int Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 02/23] xfs: Report case sensitivity in fileattr_get Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 03/23] xfs: fix exchmaps reservation limit check Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 04/23] xfs: add a XFS_INODE_TO_AGNO helper Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 05/23] xfs: add a XFS_INODE_TO_AGINO helper Andrey Albershteyn
2026-09-03 11:39 ` Andrey Albershteyn [this message]
2026-09-03 11:39 ` [PATCH v2 07/23] xfs: add a xfs_rmap_inode_bmbt_owner Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 08/23] xfs: add a xfs_rmap_inode_owner helper Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 09/23] xfs: remove the i_ino field in struct xfs_inode Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 10/23] xfs: cleanup xfs_imap Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 11/23] xfs: remove im_len field in struct xfs_imap Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 12/23] xfs: massage xfs_imap_to_bp into xfs_read_icluster Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 13/23] xfs: store an agbno in struct xfs_imap Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 14/23] xfs: mark struct xfs_imap as __packed Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 15/23] xfs: fix pointer arithmetic error on 32-bit systems Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 16/23] xfs: pass back updated nb from xfs_growfs_compute_deltas Andrey Albershteyn
2026-09-03 11:39 ` [PATCH v2 17/23] xfs: cleanup xfs_growfs_compute_deltas Andrey Albershteyn
2026-09-03 11:40 ` [PATCH v2 18/23] xfs: move XFS_LSN_CMP to xfs_log_format.h Andrey Albershteyn
2026-09-03 11:40 ` [PATCH v2 19/23] xfs: fix memory leak in xfs_dqinode_metadir_create() Andrey Albershteyn
2026-09-03 11:40 ` [PATCH v2 20/23] xfs: fix null pointer dereference in tracepoint Andrey Albershteyn
2026-09-03 11:40 ` [PATCH v2 21/23] xfs: fix off-by-one in rtrefcount btree root level validation Andrey Albershteyn
2026-09-03 11:40 ` [PATCH v2 22/23] xfs: fix exchange-range reflink flag clearing issue with INO1_WRITTEN Andrey Albershteyn
2026-09-03 11:40 ` [PATCH v2 23/23] xfs: check v5 superblock features early Andrey Albershteyn
2026-09-07 5:52 ` [PATCH v2 00/23] xfsprogs: libxfs sync for v7.2 Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260903114022.570210-7-aalbersh@kernel.org \
--to=aalbersh@kernel.org \
--cc=bestswngs@gmail.com \
--cc=brauner@kernel.org \
--cc=cem@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=cmaiolino@redhat.com \
--cc=dawei.feng@seu.edu.cn \
--cc=djwong@kernel.org \
--cc=gaoyingjie@uniontech.com \
--cc=hch@lst.de \
--cc=jiapenglin@tencent.com \
--cc=linux-xfs@vger.kernel.org \
--cc=roland.mainz@nrubsig.org \
--cc=xmei5@asu.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.