Skip to content

xfsprogs: libxfs sync for v7.2

Andrey Albershteyn linux-xfs 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest23 patches 1 replyIn review
  2. v121 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/23libxfs: convert diff_items helpers to cmp_intlibxfs/defer_item.c+4 -40 replies
2/23xfs: Report case sensitivity in fileattr_getinclude/linux.h libxfs/xfs_inode_util.c+19 -00 replies
3/23xfs: fix exchmaps reservation limit checklibxfs/xfs_exchmaps.c+1 -10 replies
4/23xfs: add a XFS_INODE_TO_AGNO helperdb/iunlink.c libxfs/inode.c libxfs/xfs_dir2.c +4 more+10 -80 replies
5/23xfs: add a XFS_INODE_TO_AGINO helperdb/iunlink.c libxfs/iunlink.c libxfs/xfs_format.h +2 more+7 -60 replies
6/23xfs: add a XFS_INO_TO_FSB helperlibxfs/xfs_bmap.c libxfs/xfs_btree.c libxfs/xfs_format.h +1 more+8 -100 replies
7/23xfs: add a xfs_rmap_inode_bmbt_ownerlibxfs/xfs_bmap.c libxfs/xfs_bmap_btree.c libxfs/xfs_btree.c +4 more+11 -90 replies
8/23xfs: add a xfs_rmap_inode_owner helperlibxfs/xfs_bmap.c libxfs/xfs_rmap.h+3 -10 replies
9/23xfs: remove the i_ino field in struct xfs_inodedb/attrset.c db/bmap_inflate.c db/dquot.c +41 more+229 -2240 replies
10/23xfs: cleanup xfs_imaplibxfs/xfs_ialloc.c+28 -340 replies
11/23xfs: remove im_len field in struct xfs_imaplibxfs/xfs_ialloc.c libxfs/xfs_inode_buf.c libxfs/xfs_inode_buf.h+7 -70 replies
12/23xfs: massage xfs_imap_to_bp into xfs_read_iclusterdb/iunlink.c libxfs/inode.c libxfs/iunlink.c +6 more+16 -170 replies
13/23xfs: store an agbno in struct xfs_imapdb/iunlink.c libxfs/inode.c libxfs/iunlink.c +5 more+37 -350 replies
14/23xfs: mark struct xfs_imap as __packedlibxfs/xfs_inode_buf.h+1 -10 replies
15/23xfs: fix pointer arithmetic error on 32-bit systemslibxfs/xfs_bmap_btree.h+1 -10 replies
16/23xfs: pass back updated nb from xfs_growfs_compute_deltaslibxfs/xfs_ag.c libxfs/xfs_ag.h+6 -60 replies
17/23xfs: cleanup xfs_growfs_compute_deltaslibxfs/xfs_ag.c libxfs/xfs_ag.h+22 -250 replies
18/23xfs: move XFS_LSN_CMP to xfs_log_format.hinclude/xfs_trans.h libxfs/xfs_log_format.h+13 -180 replies
19/23xfs: fix memory leak in xfs_dqinode_metadir_create()libxfs/xfs_dquot_buf.c+12 -20 replies
20/23xfs: fix null pointer dereference in tracepointlibxfs/xfs_defer.c+1 -10 replies
21/23xfs: fix off-by-one in rtrefcount btree root level validationlibxfs/xfs_rtrefcount_btree.c+2 -20 replies
22/23xfs: fix exchange-range reflink flag clearing issue with INO1_WRITTENlibxfs/xfs_exchmaps.c+10 -00 replies
23/23xfs: check v5 superblock features earlylibxfs/xfs_sb.c+3 -30 replies

Reviews trailers per patch

All 23 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchChristoph HellwigRoland MainzDarrick J. WongCarlos Maiolino
SeriesR-b
1/23R-b
2/23R-b R-b
3/23R-b R-b
4/23R-b R-b R-b
5/23R-b R-b R-b
6/23R-b R-b R-b
7/23R-b R-b R-b
8/23R-b R-b R-b
9/23R-b R-b R-b
10/23R-b R-b R-b
11/23R-b R-b R-b
12/23R-b R-b
13/23R-b R-b R-b
14/23R-b R-b R-b
15/23R-b
16/23R-b R-b R-b
17/23R-b R-b
18/23R-b R-b R-b
19/23R-b
20/23R-b
21/23R-b R-b
22/23R-b R-b
23/23R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v2 thread

Cover letter [PATCH v2 00/23] xfsprogs: libxfs sync for v7.2

Hi all,

This is v2 of libxfs sync for v7.1..v7.2.

This one is Darrick's v7.2 sync which I missed while preparing v1. On top of the patchset I added "Fixes:" included in v7.2.

See Interdiff below.

Andrey Albershteyn (1):
xfs: fix null pointer dereference in tracepoint

Christoph Hellwig (15):
xfs: add a XFS_INODE_TO_AGNO helper
xfs: add a XFS_INODE_TO_AGINO helper
xfs: add a XFS_INO_TO_FSB helper
xfs: add a xfs_rmap_inode_bmbt_owner
xfs: add a xfs_rmap_inode_owner helper
xfs: remove the i_ino field in struct xfs_inode
xfs: cleanup xfs_imap
xfs: remove im_len field in struct xfs_imap
xfs: massage xfs_imap_to_bp into xfs_read_icluster
xfs: store an agbno in struct xfs_imap
xfs: mark struct xfs_imap as __packed
xfs: pass back updated nb from xfs_growfs_compute_deltas
xfs: cleanup xfs_growfs_compute_deltas
xfs: move XFS_LSN_CMP to xfs_log_format.h
xfs: check v5 superblock features early

Chuck Lever (1):
xfs: Report case sensitivity in fileattr_get

Darrick J. Wong (2):
libxfs: convert diff_items helpers to cmp_int
xfs: fix pointer arithmetic error on 32-bit systems

Dawei Feng (1):
xfs: fix memory leak in xfs_dqinode_metadir_create()

Lin Jiapeng (1):
xfs: fix exchange-range reflink flag clearing issue with INO1_WRITTEN

Xiang Mei (1):
xfs: fix off-by-one in rtrefcount btree root level validation

Yingjie Gao (1):
xfs: fix exchmaps reservation limit check

 db/attrset.c                  |   2 +-
 db/bmap_inflate.c             |   4 +-
 db/dquot.c                    |   2 +-
 db/iunlink.c                  |  13 ++--
 db/namei.c                    |  14 ++--
 db/rdump.c                    |   2 +-
 include/linux.h               |  17 +++++
 include/xfs_inode.h           |   7 +-
 include/xfs_trans.h           |  18 -----
 libxfs/defer_item.c           |   8 +--
 libxfs/inode.c                |   8 +--
 libxfs/iunlink.c              |   4 +-
 libxfs/libxfs_api_defs.h      |   2 +-
 libxfs/listxattr.c            |   4 +-
 libxfs/logitem.c              |  17 +++--
 libxfs/util.c                 |   2 +-
 libxfs/xfs_ag.c               |  42 ++++++-----
 libxfs/xfs_ag.h               |   5 +-
 libxfs/xfs_attr.c             |   2 +-
 libxfs/xfs_attr_leaf.c        |   2 +-
 libxfs/xfs_bmap.c             |  20 +++---
 libxfs/xfs_bmap_btree.c       |   8 +--
 libxfs/xfs_bmap_btree.h       |   2 +-
 libxfs/xfs_btree.c            |  18 +++--
 libxfs/xfs_btree_staging.c    |   2 +-
 libxfs/xfs_da_btree.c         |   2 +-
 libxfs/xfs_defer.c            |   2 +-
 libxfs/xfs_dir2.c             |  44 ++++++------
 libxfs/xfs_dir2_node.c        |   2 +-
 libxfs/xfs_dir2_sf.c          |   4 +-
 libxfs/xfs_dquot_buf.c        |  14 +++-
 libxfs/xfs_exchmaps.c         |  20 ++++--
 libxfs/xfs_format.h           |   6 ++
 libxfs/xfs_ialloc.c           |  90 ++++++++++--------------
 libxfs/xfs_inode_buf.c        |  24 +++----
 libxfs/xfs_inode_buf.h        |  13 ++--
 libxfs/xfs_inode_fork.c       |   6 +-
 libxfs/xfs_inode_util.c       |  15 ++--
 libxfs/xfs_log_format.h       |  13 ++++
 libxfs/xfs_metadir.c          |   2 +-
 libxfs/xfs_parent.c           |   8 +--
 libxfs/xfs_parent.h           |   2 +-
 libxfs/xfs_rmap.c             |   6 +-
 libxfs/xfs_rmap.h             |   4 ++
 libxfs/xfs_rtbitmap.c         |   4 +-
 libxfs/xfs_rtrefcount_btree.c |   8 +--
 libxfs/xfs_rtrmap_btree.c     |   4 +-
 libxfs/xfs_sb.c               |   6 +-
 libxfs/xfs_symlink_remote.c   |   6 +-
 mkfs/proto.c                  |  16 ++---
 repair/bmap_repair.c          |  12 ++--
 repair/bulkload.c             |   2 +-
 repair/phase6.c               | 128 +++++++++++++++++-----------------
 repair/pptr.c                 | 100 +++++++++++++-------------
 repair/quotacheck.c           |   8 +--
 repair/rt.c                   |   6 +-
 repair/rtrefcount_repair.c    |   2 +-
 repair/rtrmap_repair.c        |   2 +-
 repair/xfs_repair.c           |   2 +-
 59 files changed, 422 insertions(+), 386 deletions(-)

Interdiff against v1:

db/attrset.c +1 -1
index 273c20295600..ec51ce2e0775 100644
@@ -701,7 +701,7 @@ attrlist_print(
 		.whichfork	= XFS_ATTR_FORK,
 		.op_flags	= XFS_DA_OP_OKNOENT,
 		.dp		= ip,
-		.owner		= ip->i_ino,
+		.owner		= I_INO(ip),
 		.trans		= tp,
 		.attr_filter	= attr_flags & XFS_ATTR_NSP_ONDISK_MASK,
 		.name		= name,
db/bmap_inflate.c +2 -2
index cc7c197e788d..13891896fc8b 100644
@@ -176,7 +176,7 @@ alloc_bmbt_blocks(
 			target = XFS_AGB_TO_FSB(mp, tgt_agno, 0);
 		}
 
-		libxfs_rmap_ino_bmbt_owner(&args.oinfo, ip->i_ino,
+		libxfs_rmap_ino_bmbt_owner(&args.oinfo, I_INO(ip),
 				XFS_DATA_FORK);
 
 		error = -libxfs_alloc_vextent_start_ag(&args, target);
@@ -421,7 +421,7 @@ estimate_size(
 
 report:
 	dbprintf(_("ino 0x%llx nextents %llu btblocks %llu btheight %u dirty %u\n"),
-			ip->i_ino, nextents, bmap_bload.nr_blocks,
+			I_INO(ip), nextents, bmap_bload.nr_blocks,
 			bmap_bload.btree_height, dirty_blocks);
 
 	return 0;
db/dquot.c +1 -1
index c028d50e4ca4..0c1ebf4e7907 100644
@@ -104,7 +104,7 @@ dqtype_to_inode(
 	if (error)
 		goto out_dp;
 
-	ret = ip->i_ino;
+	ret = I_INO(ip);
 	libxfs_irele(ip);
 out_dp:
 	if (dp)
db/iunlink.c +8 -5
index c73f818242b9..447d2859b104 100644
@@ -22,8 +22,8 @@ count_rtblocks(
 	if (error) {
 		dbprintf(
 _("could not read AG %u agino %u extents, err=%d\n"),
-				XFS_INO_TO_AGNO(ip->i_mount, ip->i_ino),
-				XFS_INO_TO_AGINO(ip->i_mount, ip->i_ino),
+				XFS_INODE_TO_AGNO(ip),
+				XFS_INODE_TO_AGINO(ip),
 				error);
 		return 0;
 	}
@@ -43,6 +43,7 @@ get_next_unlinked(
 	struct xfs_buf		*ino_bp;
 	struct xfs_dinode	*dip;
 	struct xfs_inode	*ip;
+	struct xfs_perag	*pag;
 	xfs_ino_t		ino;
 	xfs_agino_t		ret;
 	int			error;
@@ -65,7 +66,9 @@ get_next_unlinked(
 		dbprintf("\n");
 	}
 
-	error = -libxfs_imap_to_bp(mp, NULL, &ip->i_imap, &ino_bp);
+	pag = libxfs_perag_get(mp, agno);
+	error = -libxfs_read_icluster(pag, NULL, ip->i_imap.im_agbno, &ino_bp);
+	libxfs_perag_put(pag);
 	if (error) {
 		libxfs_irele(ip);
 		goto bad;
@@ -246,8 +249,8 @@ create_unlinked(
 		dbprintf(_("commit inode: %s\n"), strerror(error));
 
 	dbprintf(_("Created unlinked inode %llu in agno %u\n"),
-			(unsigned long long)ip->i_ino,
-			XFS_INO_TO_AGNO(mp, ip->i_ino));
+			(unsigned long long)I_INO(ip),
+			XFS_INODE_TO_AGNO(ip));
 	libxfs_irele(ip);
 	return error;
 out_rele:
db/namei.c +7 -7
index 0a50ec87df9f..6e5d0ac46360 100644
@@ -331,7 +331,7 @@ list_sfdir(
 	/* . and .. entries */
 	off = xfs_dir2_db_off_to_dataptr(geo, geo->datablk,
 			geo->data_entry_offset);
-	error = dir_emit(args->trans, args->dp, off, ".", -1, dp->i_ino,
+	error = dir_emit(args->trans, args->dp, off, ".", -1, I_INO(dp),
 			XFS_DIR3_FT_DIR, private);
 	if (error)
 		return error;
@@ -503,7 +503,7 @@ listdir(
 		.trans		= tp,
 		.dp		= dp,
 		.geo		= dp->i_mount->m_dir_geo,
-		.owner		= dp->i_ino,
+		.owner		= I_INO(dp),
 	};
 	int			error;
 
@@ -748,7 +748,7 @@ list_leaf_pptrs(
 	struct xfs_buf			*leaf_bp;
 	int				error;
 
-	error = -libxfs_attr3_leaf_read(NULL, ip, ip->i_ino, 0, &leaf_bp);
+	error = -libxfs_attr3_leaf_read(NULL, ip, I_INO(ip), 0, &leaf_bp);
 	if (error)
 		return error;
 
@@ -846,7 +846,7 @@ list_node_pptrs(
 
 		libxfs_trans_brelse(NULL, leaf_bp);
 
-		error = -libxfs_attr3_leaf_read(NULL, ip, ip->i_ino,
+		error = -libxfs_attr3_leaf_read(NULL, ip, I_INO(ip),
 				leafhdr.forw, &leaf_bp);
 		if (error)
 			return error;
@@ -1062,7 +1062,7 @@ create_child(
 	libxfs_trans_ijoin(tp, dp, 0);
 	libxfs_trans_ijoin(tp, ip, 0);
 
-	error = -libxfs_dir_createname(tp, dp, &xname, ip->i_ino, resblks);
+	error = -libxfs_dir_createname(tp, dp, &xname, I_INO(ip), resblks);
 	if (error)
 		goto out_trans;
 
@@ -1076,7 +1076,7 @@ create_child(
 	/* Replace the dotdot entry in the child directory. */
 	if (isdir) {
 		error = -libxfs_dir_replace(tp, ip, &xfs_name_dotdot,
-				dp->i_ino, resblks);
+				I_INO(dp), resblks);
 		if (error)
 			goto out_trans;
 	}
@@ -1287,7 +1287,7 @@ remove_child(
 	if (error)
 		goto out_trans;
 
-	error = -libxfs_dir_removename(tp, dp, &xname, ip->i_ino, resblks);
+	error = -libxfs_dir_removename(tp, dp, &xname, I_INO(ip), resblks);
 	if (error)
 		goto out_trans;
 
db/rdump.c +1 -1
index 599d0727e788..7fd171a9d53f 100644
@@ -376,7 +376,7 @@ rdump_xattr(
 			.trans		= tp,
 			.dp		= ip,
 			.geo		= mp->m_attr_geo,
-			.owner		= ip->i_ino,
+			.owner		= I_INO(ip),
 			.attr_filter	= attr_flags & XFS_ATTR_NSP_ONDISK_MASK,
 			.namelen	= namelen,
 			.name		= name,
include/linux.h +17 -0
index 8972c9596c75..a10d531cffdb 100644
@@ -258,6 +258,23 @@ struct file_attr {
 #define FS_XFLAG_COWEXTSIZE	0x00010000	/* CoW extent size allocator hint */
 #endif
 
+#ifndef FS_XFLAG_VERITY
+#define FS_XFLAG_VERITY		0x00020000	/* fs-verity enabled */
+#endif
+
+/*
+ * Case handling flags (read-only, cannot be set via ioctl).
+ * Default (neither set) indicates POSIX semantics: case-sensitive
+ * lookups and case-preserving storage.
+ */
+#ifndef FS_XFLAG_CASEFOLD
+#define FS_XFLAG_CASEFOLD	0x00040000	/* case-insensitive lookups */
+#endif
+
+#ifndef FS_XFLAG_CASENONPRESERVING
+#define FS_XFLAG_CASENONPRESERVING 0x00080000	/* case not preserved */
+#endif
+
 /* Atomic Write */
 #ifndef RWF_ATOMIC
 #define RWF_ATOMIC	((__kernel_rwf_t)0x00000040)
include/xfs_inode.h +6 -1
index 61d4d285a106..f07a34ec5d46 100644
@@ -72,6 +72,7 @@ struct inode {
 	unsigned long		i_state; /* Not actually used in userspace */
 	uint32_t		i_generation;
 	uint64_t		i_version;
+	uint64_t		i_ino;		/* inode number (agno/agino) */
 	struct timespec64	__i_atime;
 	struct timespec64	__i_mtime;
 	struct timespec64	__i_ctime; /* use inode_*_ctime accessors! */
@@ -218,7 +219,6 @@ static inline bool inode_wrong_type(const struct inode *inode, umode_t mode)
 typedef struct xfs_inode {
 	struct cache_node	i_node;
 	struct xfs_mount	*i_mount;	/* fs mount struct ptr */
-	xfs_ino_t		i_ino;		/* inode number (agno/agino) */
 	struct xfs_imap		i_imap;		/* location for xfs_imap() */
 	struct xfs_ifork	*i_cowfp;	/* copy on write extents */
 	struct xfs_ifork	i_df;		/* data fork */
@@ -366,6 +366,11 @@ static inline xfs_fsize_t XFS_ISIZE(struct xfs_inode *ip)
 }
 #define XFS_IS_REALTIME_INODE(ip) ((ip)->i_diflags & XFS_DIFLAG_REALTIME)
 
+static inline uint64_t I_INO(const struct xfs_inode *ip)
+{
+	return VFS_IC(ip)->i_ino;
+}
+
 static inline bool xfs_is_zoned_inode(struct xfs_inode *ip)
 {
 	return xfs_has_zoned(ip->i_mount) && XFS_IS_REALTIME_INODE(ip);
include/xfs_trans.h +0 -18
index d4b546a0e3d0..9102bc6f5b27 100644
@@ -164,22 +164,4 @@ libxfs_trans_read_buf(
 #define xfs_ail_get_push_target(ail)    \
 		((log) == (log) ? NULLCOMMITLSN : NULLCOMMITLSN)
 
-/* from xfs_log.h */
-/*
- * By comparing each component, we don't have to worry about extra
- * endian issues in treating two 32 bit numbers as one 64 bit number
- */
-static inline xfs_lsn_t _lsn_cmp(xfs_lsn_t lsn1, xfs_lsn_t lsn2)
-{
-	if (CYCLE_LSN(lsn1) != CYCLE_LSN(lsn2))
-		return (CYCLE_LSN(lsn1)<CYCLE_LSN(lsn2))? -999 : 999;
-
-	if (BLOCK_LSN(lsn1) != BLOCK_LSN(lsn2))
-		return (BLOCK_LSN(lsn1)<BLOCK_LSN(lsn2))? -999 : 999;
-
-	return 0;
-}
-
-#define XFS_LSN_CMP(a, b)			_lsn_cmp(a, b)
-
 #endif	/* __XFS_TRANS_H__ */
libxfs/defer_item.c +4 -4
index 4fc2c74a548c..14ee41525517 100644
@@ -50,7 +50,7 @@ xfs_extent_free_diff_items(
 	struct xfs_extent_free_item	*ra = xefi_entry(a);
 	struct xfs_extent_free_item	*rb = xefi_entry(b);
 
-	return ra->xefi_group->xg_gno - rb->xefi_group->xg_gno;
+	return cmp_int(ra->xefi_group->xg_gno, rb->xefi_group->xg_gno);
 }
 
 /* Get an EFI. */
@@ -252,7 +252,7 @@ xfs_rmap_update_diff_items(
 	struct xfs_rmap_intent		*ra = ri_entry(a);
 	struct xfs_rmap_intent		*rb = ri_entry(b);
 
-	return ra->ri_group->xg_gno - rb->ri_group->xg_gno;
+	return cmp_int(ra->ri_group->xg_gno, rb->ri_group->xg_gno);
 }
 
 /* Get an RUI. */
@@ -404,7 +404,7 @@ xfs_refcount_update_diff_items(
 	struct xfs_refcount_intent	*ra = ci_entry(a);
 	struct xfs_refcount_intent	*rb = ci_entry(b);
 
-	return ra->ri_group->xg_gno - rb->ri_group->xg_gno;
+	return cmp_int(ra->ri_group->xg_gno, rb->ri_group->xg_gno);
 }
 
 /* Get an CUI. */
@@ -563,7 +563,7 @@ xfs_bmap_update_diff_items(
 	struct xfs_bmap_intent		*ba = bi_entry(a);
 	struct xfs_bmap_intent		*bb = bi_entry(b);
 
-	return ba->bi_owner->i_ino - bb->bi_owner->i_ino;
+	return cmp_int(I_INO(ba->bi_owner), I_INO(bb->bi_owner));
 }
 
 /* Get an BUI. */
libxfs/inode.c +4 -4
index dc7e227e8ee9..b6838d3d4bd3 100644
@@ -151,7 +151,7 @@ libxfs_iget(
 		return -ENOMEM;
 
 	VFS_I(ip)->i_count = 1;
-	ip->i_ino = ino;
+	VFS_I(ip)->i_ino = ino;
 	ip->i_mount = mp;
 	ip->i_diflags2 = mp->m_ino_geo.new_diflags2;
 	ip->i_af.if_format = XFS_DINODE_FMT_EXTENTS;
@@ -159,8 +159,8 @@ libxfs_iget(
 	ip->i_prev_unlinked = NULLAGINO;
 	spin_lock_init(&VFS_I(ip)->i_lock);
 
-	pag = xfs_perag_get(mp, XFS_INO_TO_AGNO(mp, ip->i_ino));
-	error = xfs_imap(pag, tp, ip->i_ino, &ip->i_imap, 0);
+	pag = xfs_perag_get(mp, XFS_INODE_TO_AGNO(ip));
+	error = xfs_imap(pag, tp, I_INO(ip), &ip->i_imap, 0);
 	xfs_perag_put(pag);
 
 	if (error)
@@ -182,7 +182,7 @@ libxfs_iget(
 	} else {
 		struct xfs_buf		*bp;
 
-		error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &bp);
+		error = xfs_read_icluster(pag, tp, ip->i_imap.im_agbno, &bp);
 		if (error)
 			goto out_destroy;
 
libxfs/iunlink.c +2 -2
index 2d4dd0aee0b8..875e0caae988 100644
@@ -44,7 +44,7 @@ xfs_iunlink_log_dinode(
 	int			offset;
 	int			error;
 
-	error = xfs_imap_to_bp(mp, tp, &ip->i_imap, &ibp);
+	error = xfs_read_icluster(iup->pag, tp, ip->i_imap.im_agbno, &ibp);
 	if (error)
 		return error;
 	/*
@@ -66,7 +66,7 @@ xfs_iunlink_log_dinode(
 	}
 
 	trace_xfs_iunlink_update_dinode(mp, pag_agno(iup->pag),
-					XFS_INO_TO_AGINO(mp, ip->i_ino),
+					XFS_INODE_TO_AGINO(ip),
 					be32_to_cpu(dip->di_next_unlinked),
 					iup->next_agino);
 
libxfs/libxfs_api_defs.h +1 -1
index d7c912e77879..4f542ae7267e 100644
@@ -200,7 +200,7 @@
 #define xfs_iext_lookup_extent		libxfs_iext_lookup_extent
 #define xfs_iext_next			libxfs_iext_next
 #define xfs_ifork_zap_attr		libxfs_ifork_zap_attr
-#define xfs_imap_to_bp			libxfs_imap_to_bp
+#define xfs_read_icluster		libxfs_read_icluster
 
 #define xfs_initialize_perag		libxfs_initialize_perag
 #define xfs_initialize_perag_data	libxfs_initialize_perag_data
libxfs/listxattr.c +2 -2
index 34205682f022..fb6f1d53b9d8 100644
@@ -101,7 +101,7 @@ xattr_walk_leaf(
 	struct xfs_buf			*leaf_bp;
 	int				error;
 
-	error = -libxfs_attr3_leaf_read(tp, ip, ip->i_ino, 0, &leaf_bp);
+	error = -libxfs_attr3_leaf_read(tp, ip, I_INO(ip), 0, &leaf_bp);
 	if (error)
 		return error;
 
@@ -231,7 +231,7 @@ xattr_walk_node(
 		if (bitmap_test(seen_blocks, leafhdr.forw, 1))
 			goto out_bitmap;
 
-		error = -libxfs_attr3_leaf_read(tp, ip, ip->i_ino,
+		error = -libxfs_attr3_leaf_read(tp, ip, I_INO(ip),
 				leafhdr.forw, &leaf_bp);
 		if (error)
 			goto out_bitmap;
libxfs/logitem.c +11 -6
index d8d86d919cf4..6e56e476d1ea 100644
@@ -16,6 +16,7 @@
 #include "xfs_inode.h"
 #include "xfs_trans.h"
 #include "xfs_rtbitmap.h"
+#include "xfs_ag.h"
 
 struct kmem_cache	*xfs_buf_item_cache;
 struct kmem_cache	*xfs_ili_cache;		/* inode log item cache */
@@ -140,7 +141,7 @@ static uint64_t
 xfs_inode_item_sort(
 	struct xfs_log_item	*lip)
 {
-	return INODE_ITEM(lip)->ili_inode->i_ino;
+	return I_INO(INODE_ITEM(lip)->ili_inode);
 }
 
 /*
@@ -180,6 +181,7 @@ xfs_inode_item_precommit(
 {
 	struct xfs_inode_log_item *iip = INODE_ITEM(lip);
 	struct xfs_inode	*ip = iip->ili_inode;
+	struct xfs_mount	*mp = ip->i_mount;
 	struct inode		*inode = VFS_I(ip);
 	unsigned int		flags = iip->ili_dirty_flags;
 
@@ -200,7 +202,7 @@ xfs_inode_item_precommit(
 	 * to upgrade this inode to bigtime format, do so now.
 	 */
 	if ((flags & (XFS_ILOG_CORE | XFS_ILOG_TIMESTAMP)) &&
-	    xfs_has_bigtime(ip->i_mount) &&
+	    xfs_has_bigtime(mp) &&
 	    !xfs_inode_has_bigtime(ip)) {
 		ip->i_diflags2 |= XFS_DIFLAG2_BIGTIME;
 		flags |= XFS_ILOG_CORE;
@@ -214,7 +216,7 @@ xfs_inode_item_precommit(
 	 */
 	if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) &&
 	    (ip->i_diflags & XFS_DIFLAG_EXTSZINHERIT) &&
-	    xfs_extlen_to_rtxmod(ip->i_mount, ip->i_extsize) > 0) {
+	    xfs_extlen_to_rtxmod(mp, ip->i_extsize) > 0) {
 		ip->i_diflags &= ~(XFS_DIFLAG_EXTSIZE |
 				   XFS_DIFLAG_EXTSZINHERIT);
 		ip->i_extsize = 0;
@@ -241,13 +243,14 @@ xfs_inode_item_precommit(
 	 */
 	if ((ip->i_diflags & XFS_DIFLAG_RTINHERIT) &&
 	    (ip->i_diflags2 & XFS_DIFLAG2_COWEXTSIZE) &&
-	    xfs_extlen_to_rtxmod(ip->i_mount, ip->i_cowextsize) > 0) {
+	    xfs_extlen_to_rtxmod(mp, ip->i_cowextsize) > 0) {
 		ip->i_diflags2 &= ~XFS_DIFLAG2_COWEXTSIZE;
 		ip->i_cowextsize = 0;
 		flags |= XFS_ILOG_CORE;
 	}
 
 	if (!iip->ili_item.li_buf) {
+		struct xfs_perag *pag;
 		struct xfs_buf	*bp;
 		int		error;
 
@@ -261,7 +264,9 @@ xfs_inode_item_precommit(
 		 * here.
 		 */
 		spin_unlock(&iip->ili_lock);
-		error = xfs_imap_to_bp(ip->i_mount, tp, &ip->i_imap, &bp);
+		pag = xfs_perag_get(mp, XFS_INODE_TO_AGNO(ip));
+		error = xfs_read_icluster(pag, tp, ip->i_imap.im_agbno, &bp);
+		xfs_perag_put(pag);
 		if (error)
 			return error;
 
@@ -316,7 +321,7 @@ xfs_inode_item_init(
 	iip = ip->i_itemp = kmem_cache_zalloc(xfs_ili_cache, 0);
 #ifdef LI_DEBUG
 	fprintf(stderr, "inode_item_init for inode %llu, iip=%p\n",
-		ip->i_ino, iip);
+		I_INO(ip), iip);
 #endif
 
 	spin_lock_init(&iip->ili_lock);
libxfs/util.c +1 -1
index 143d011ac60d..6cbbe9056eba 100644
@@ -343,7 +343,7 @@ xfs_inode_verifier_error(
 	xfs_alert(NULL, "Metadata %s detected at %p, inode 0x%llx %s",
 		  error == -EFSBADCRC ? "CRC error" : "corruption",
 		  failaddr ? failaddr : __return_address,
-		  ip->i_ino, name);
+		  I_INO(ip), name);
 }
 
 /*
mkfs/proto.c +8 -8
index dd47e41d833e..bdd0fadda517 100644
@@ -289,7 +289,7 @@ writesymlink(
 	xfs_extlen_t		nb = XFS_B_TO_FSB(mp, len);
 	int			error;
 
-	error = -libxfs_symlink_write_target(tp, ip, ip->i_ino, buf, len, nb,
+	error = -libxfs_symlink_write_target(tp, ip, I_INO(ip), buf, len, nb,
 			nb);
 	if (error) {
 		fprintf(stderr,
@@ -417,7 +417,7 @@ writeattr(
 	struct xfs_da_args	args = {
 		.dp		= ip,
 		.geo		= ip->i_mount->m_attr_geo,
-		.owner		= ip->i_ino,
+		.owner		= I_INO(ip),
 		.whichfork	= XFS_ATTR_FORK,
 		.op_flags	= XFS_DA_OP_OKNOENT,
 		.value		= valuebuf,
@@ -548,7 +548,7 @@ newdirent(
 
 	rsv = XFS_DIRENTER_SPACE_RES(mp, name->len);
 
-	error = -libxfs_dir_createname(tp, pip, name, ip->i_ino, rsv);
+	error = -libxfs_dir_createname(tp, pip, name, I_INO(ip), rsv);
 	if (error)
 		fail(_("directory createname error"), error);
 
@@ -927,7 +927,7 @@ parseproto(
 			fail(_("Inode allocation failed"), error);
 		if (!pip) {
 			pip = ip;
-			mp->m_sb.sb_rootino = ip->i_ino;
+			mp->m_sb.sb_rootino = I_INO(ip);
 			libxfs_log_sb(tp);
 			isroot = 1;
 		} else {
@@ -1057,10 +1057,10 @@ create_sb_metadata_file(
 
 	switch (type) {
 	case XFS_RTGI_BITMAP:
-		mp->m_sb.sb_rbmino = ip->i_ino;
+		mp->m_sb.sb_rbmino = I_INO(ip);
 		break;
 	case XFS_RTGI_SUMMARY:
-		mp->m_sb.sb_rsumino = ip->i_ino;
+		mp->m_sb.sb_rsumino = I_INO(ip);
 		break;
 	default:
 		error = EFSCORRUPTED;
@@ -1634,7 +1634,7 @@ create_nondir_inode(
 	 * hardlink, so we need to store it.
 	 */
 	if (file_stat->st_nlink > 1)
-		track_hardlink_inode(file_stat, ip->i_ino);
+		track_hardlink_inode(file_stat, I_INO(ip));
 
 	libxfs_irele(ip);
 }
@@ -1880,7 +1880,7 @@ populate_from_dir(
 	if (error)
 		fail(_("Inode allocation failed"), error);
 
-	mp->m_sb.sb_rootino = ip->i_ino;
+	mp->m_sb.sb_rootino = I_INO(ip);
 	libxfs_log_sb(tp);
 	newdirectory(mp, tp, ip, ip);
 	libxfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
repair/bmap_repair.c +8 -4
index 192f189de052..dfdce1a0e01f 100644
@@ -134,7 +134,7 @@ xrep_bmap_walk_rmap(
 	int				error;
 
 	/* Skip extents which are not owned by this inode and fork. */
-	if (rec->rm_owner != rb->sc->ip->i_ino)
+	if (rec->rm_owner != I_INO(rb->sc->ip))
 		return 0;
 
 	error = xrep_bmap_check_fork_rmap(rb, cur, rec);
@@ -252,7 +252,7 @@ xrep_bmap_walk_rtrmap(
 	int				error = 0;
 
 	/* Skip extents which are not owned by this inode and fork. */
-	if (rec->rm_owner != rb->sc->ip->i_ino)
+	if (rec->rm_owner != I_INO(rb->sc->ip))
 		return 0;
 
 	error = xrep_bmap_check_rtfork_rmap(rb->sc, cur, rec);
@@ -576,7 +576,7 @@ xrep_bmap_build_new_fork(
 	 * Prepare to construct the new fork by initializing the new btree
 	 * structure and creating a fake ifork in the ifakeroot structure.
 	 */
-	libxfs_rmap_ino_bmbt_owner(&oinfo, sc->ip->i_ino, rb->whichfork);
+	xfs_rmap_inode_bmbt_owner(&oinfo, sc->ip, rb->whichfork);
 	bulkload_init_inode(&rb->new_fork_info, sc, rb->whichfork, &oinfo);
 	bmap_cur = libxfs_bmbt_init_cursor(sc->mp, NULL, sc->ip,
 			XFS_STAGING_FORK);
@@ -740,6 +740,7 @@ rebuild_bmap(
 		.mp		= mp,
 	};
 	const struct xfs_buf_ops *bp_ops;
+	struct xfs_perag	*pag;
 	unsigned long		boffset;
 	unsigned long long	resblks;
 	xfs_daddr_t		bp_bn;
@@ -821,7 +822,10 @@ rebuild_bmap(
 	 * Rebuilding the inode fork rolled the transaction, so we need to
 	 * re-grab the inode cluster buffer and dinode pointer for the caller.
 	 */
-	err2 = -libxfs_imap_to_bp(mp, NULL, &sc.ip->i_imap, ino_bpp);
+	pag = libxfs_perag_get(mp, XFS_INODE_TO_AGNO(sc.ip));
+	err2 = -libxfs_read_icluster(pag, NULL, sc.ip->i_imap.im_agbno,
+			ino_bpp);
+	libxfs_perag_put(pag);
 	if (err2)
 		do_error(
  _("Unable to re-grab inode cluster buffer after failed repair of inode %llu, error %d.\n"),
repair/bulkload.c +1 -1
index a9e51de0a24c..6bc110071f02 100644
@@ -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);
 }
repair/phase6.c +64 -64

445 lines not on this page · raw message

repair/pptr.c +50 -50

384 lines not on this page · raw message

repair/quotacheck.c +4 -4
index f4c0314177b0..fc7e3864654c 100644
@@ -169,7 +169,7 @@ qc_count_rtblocks(
 	if (error) {
 		do_warn(
 _("could not read ino %"PRIu64" extents, err=%d\n"),
-			ip->i_ino, error);
+			I_INO(ip), error);
 		chkd_flags = 0;
 		return 0;
 	}
@@ -375,7 +375,7 @@ qc_walk_dquot_extent(
 		if (error) {
 			do_warn(
 _("cannot read %s inode %"PRIu64", block %"PRIu64", disk block %"PRIu64", err=%d\n"),
-				qflags_typestr(dquots->type), ip->i_ino,
+				qflags_typestr(dquots->type), I_INO(ip),
 				map->br_startoff + bno,
 				map->br_startblock + bno, error);
 			chkd_flags = 0;
@@ -454,7 +454,7 @@ quotacheck_verify(
 	if (error) {
 		do_warn(
 	_("could not read %s inode %"PRIu64" extents, err=%d\n"),
-			qflags_typestr(type), ip->i_ino, error);
+			qflags_typestr(type), I_INO(ip), error);
 		chkd_flags = 0;
 		goto err;
 	}
@@ -659,7 +659,7 @@ mark_quota_inode(
 	if (error)
 		goto out_corrupt;
 
-	set_quota_inode(type, ip->i_ino);
+	set_quota_inode(type, I_INO(ip));
 	libxfs_irele(ip);
 	return 0;
 
repair/rt.c +3 -3
index 781d8968446c..3e51c9b5eb4b 100644
@@ -268,7 +268,7 @@ check_rtfile_contents(
 		if (xfs_has_rtgroups(mp)) {
 			struct xfs_rtbuf_blkinfo	*hdr = bp->b_addr;
 
-			if (hdr->rt_owner != cpu_to_be64(ip->i_ino)) {
+			if (hdr->rt_owner != cpu_to_be64(I_INO(ip))) {
 				do_warn(
  _("corrupt owner in %s at dblock 0x%llx\n"),
 					filename, (unsigned long long)bno);
@@ -461,12 +461,12 @@ mark_rtginode(
 		goto out_corrupt;
 
 	if (xfs_has_rtgroups(rtg_mount(rtg))) {
-		if (bitmap_test(rtg_inodes[type], ip->i_ino, 1)) {
+		if (bitmap_test(rtg_inodes[type], I_INO(ip), 1)) {
 			error = EFSCORRUPTED;
 			goto out_corrupt;
 		}
 
-		error = bitmap_set(rtg_inodes[type], ip->i_ino, 1);
+		error = bitmap_set(rtg_inodes[type], I_INO(ip), 1);
 		if (error)
 			goto out_corrupt;
 	}
repair/rtrefcount_repair.c +1 -1
index 228d080e5a5d..7906af17e893 100644
@@ -173,7 +173,7 @@ xrep_rtrefc_build_new_tree(
 	 * Prepare to construct the new fork by initializing the new btree
 	 * structure and creating a fake ifork in the ifakeroot structure.
 	 */
-	libxfs_rmap_ino_bmbt_owner(&oinfo, sc->ip->i_ino, XFS_DATA_FORK);
+	xfs_rmap_inode_bmbt_owner(&oinfo, sc->ip, XFS_DATA_FORK);
 	bulkload_init_inode(&rr->new_fork_info, sc, XFS_DATA_FORK, &oinfo);
 	cur = libxfs_rtrefcountbt_init_cursor(NULL, rr->rtg);
 	libxfs_btree_stage_ifakeroot(cur, ifake);
repair/rtrmap_repair.c +1 -1
index 955db1738fe2..136fafc01024 100644
@@ -211,7 +211,7 @@ xrep_rtrmap_build_new_tree(
 	 * Prepare to construct the new fork by initializing the new btree
 	 * structure and creating a fake ifork in the ifakeroot structure.
 	 */
-	libxfs_rmap_ino_bmbt_owner(&oinfo, sc->ip->i_ino, XFS_DATA_FORK);
+	xfs_rmap_inode_bmbt_owner(&oinfo, sc->ip, XFS_DATA_FORK);
 	bulkload_init_inode(&rr->new_fork_info, sc, XFS_DATA_FORK, &oinfo);
 	cur = libxfs_rtrmapbt_init_cursor(NULL, rr->rtg);
 	libxfs_btree_stage_ifakeroot(cur, ifake);
repair/xfs_repair.c +1 -1
index dd758ebc577e..2ad1ee8b4aa7 100644
@@ -670,7 +670,7 @@ check_metadir_inode(
 
 	/* If we changed the metadir inode, try reloading it. */
 	if (!mp->m_metadirip ||
-	    mp->m_metadirip->i_ino != mp->m_sb.sb_metadirino) {
+	    I_INO(mp->m_metadirip) != mp->m_sb.sb_metadirino) {
 		if (mp->m_metadirip)
 			libxfs_irele(mp->m_metadirip);
 
Signature · 1 line
2.55.0