Skip to contentSkip to conversation

xfs_repair: Use xfs_extnum_t instead of basic data types

PATCH In review Chandan Babu R 4 participants 4 messages Jun 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs_repair: Use xfs_extnum_t instead of basic data types

xfs_extnum_t is the type to use to declare variables whose values have been obtained from per-inode extent counters. This commit replaces using basic types (e.g. uint64_t) with xfs_extnum_t when declaring such variables.

---
 repair/dinode.c | 18 +++++++++---------
 repair/scan.c   |  6 +++---
 2 files changed, 12 insertions(+), 12 deletions(-)
repair/dinode.c +9 -9
index 5a02751a..71801522 100644
@@ -759,7 +759,7 @@ process_btinode(
 	int			type,
 	int			*dirty,
 	xfs_rfsblock_t		*tot,
-	uint64_t		*nex,
+	xfs_extnum_t		*nex,
 	blkmap_t		**blkmapp,
 	int			whichfork,
 	int			check_dups)
@@ -773,7 +773,7 @@ process_btinode(
 	char			*forkname = get_forkname(whichfork);
 	int			i;
 	int			level;
-	int			numrecs;
+	xfs_extnum_t		numrecs;
 	bmap_cursor_t		cursor;
 	uint64_t		magic;
 
@@ -934,7 +934,7 @@ process_exinode(
 	int			type,
 	int			*dirty,
 	xfs_rfsblock_t		*tot,
-	uint64_t		*nex,
+	xfs_extnum_t		*nex,
 	blkmap_t		**blkmapp,
 	int			whichfork,
 	int			check_dups)
@@ -1794,8 +1794,8 @@ static int
 process_inode_blocks_and_extents(
 	struct xfs_dinode	*dino,
 	xfs_rfsblock_t		nblocks,
-	uint64_t		nextents,
-	uint64_t		anextents,
+	xfs_extnum_t		nextents,
+	xfs_extnum_t		anextents,
 	xfs_ino_t		lino,
 	int			*dirty)
 {
@@ -1894,7 +1894,7 @@ process_inode_data_fork(
 	int			type,
 	int			*dirty,
 	xfs_rfsblock_t		*totblocks,
-	uint64_t		*nextents,
+	xfs_extnum_t		*nextents,
 	blkmap_t		**dblkmap,
 	int			check_dups)
 {
@@ -2003,7 +2003,7 @@ process_inode_attr_fork(
 	int			type,
 	int			*dirty,
 	xfs_rfsblock_t		*atotblocks,
-	uint64_t		*anextents,
+	xfs_extnum_t		*anextents,
 	int			check_dups,
 	int			extra_attr_check,
 	int			*retval)
@@ -2288,8 +2288,8 @@ process_dinode_int(xfs_mount_t *mp,
 	int			di_mode;
 	int			type;
 	int			retval = 0;
-	uint64_t		nextents;
-	uint64_t		anextents;
+	xfs_extnum_t		nextents;
+	xfs_extnum_t		anextents;
 	xfs_ino_t		lino;
 	const int		is_free = 0;
 	const int		is_used = 1;
repair/scan.c +3 -3
index c8977a02..603d29a3 100644
@@ -133,7 +133,7 @@ scan_lbtree(
 				xfs_fsblock_t		bno,
 				xfs_ino_t		ino,
 				xfs_rfsblock_t		*tot,
-				uint64_t		*nex,
+				xfs_extnum_t		*nex,
 				blkmap_t		**blkmapp,
 				bmap_cursor_t		*bm_cursor,
 				int			isroot,
@@ -144,7 +144,7 @@ scan_lbtree(
 	int		whichfork,
 	xfs_ino_t	ino,
 	xfs_rfsblock_t	*tot,
-	uint64_t	*nex,
+	xfs_extnum_t	*nex,
 	blkmap_t	**blkmapp,
 	bmap_cursor_t	*bm_cursor,
 	int		isroot,
@@ -204,7 +204,7 @@ scan_bmapbt(
 	xfs_fsblock_t		bno,
 	xfs_ino_t		ino,
 	xfs_rfsblock_t		*tot,
-	uint64_t		*nex,
+	xfs_extnum_t		*nex,
 	blkmap_t		**blkmapp,
 	bmap_cursor_t		*bm_cursor,
 	int			isroot,
Signature · 1 line
2.35.1
#1 lore raw
Quoted 6 lines · Chandan Babu R

xfs_extnum_t is the type to use to declare variables whose values have been obtained from per-inode extent counters. This commit replaces using basic types (e.g. uint64_t) with xfs_extnum_t when declaring such variables.

---

Thanks Chandan - I had rolled something like this into the merge of kernel "xfs: Use xfs_extnum_t instead of basic data types"
because it seemed like it should maybe all be done at once.

And the tree Dave has already had (some of) these type changes in db/ and repair/dinode.c as part of that patch.

On top of that, I added a lot more of these conversions, i.e. to bmap(), bmap_one_extent(), and make_bbmap() in db/bmap.c, process_bmbt_reclist() in db/check.c, fa_cfileoffd() and fa_dfiloffd() in db/faddr.c ... perhaps I should send you my net diff on top of the tree dchinner assembled, and you can see what you think?

But at the highest level, does it make more sense to convert everything in the utilities at the same time as "xfs: Use xfs_extnum_t instead of basic data types" is applied to xfsprogs libxfs/ or would separate patches be better?

Thanks,
-Eric

#2 lore raw
Quoted 12 lines · Eric Sandeen
Quoted 6 lines · Chandan Babu R

xfs_extnum_t is the type to use to declare variables whose values have been obtained from per-inode extent counters. This commit replaces using basic types (e.g. uint64_t) with xfs_extnum_t when declaring such variables.

---

Thanks Chandan - I had rolled something like this into the merge of kernel "xfs: Use xfs_extnum_t instead of basic data types"
because it seemed like it should maybe all be done at once.

Quoted 8 lines

And the tree Dave has already had (some of) these type changes in db/ and repair/dinode.c as part of that patch.

On top of that, I added a lot more of these conversions, i.e. to bmap(), bmap_one_extent(), and make_bbmap() in db/bmap.c, process_bmbt_reclist() in db/check.c, fa_cfileoffd() and fa_dfiloffd() in db/faddr.c ... perhaps I should send you my net diff on top of the tree dchinner assembled, and you can see what you think?

Just merge what we've already got, then do an audit to check for anything that is missing and then commit them.

Quoted 4 lines

But at the highest level, does it make more sense to convert everything in the utilities at the same time as "xfs: Use xfs_extnum_t instead of basic data types" is applied to xfsprogs libxfs/ or would separate patches be better?

So long as it is converted before the release point it doesn't matter. We don't have extent counts of > 2*32 out in the wild yet, so as long as the conversions are all sorted by the time 5.19 is done then it just doesn't matter how many commits it takes because users won't be using the dev tree to repair filesystems with extent counts that could overflow a 32 bit counter....

Cheers,

Dave.

Signature · 2 lines
Dave Chinner
[email protected]
#3 lore raw
Quoted 16 lines · Dave Chinner
Quoted 15 lines · Eric Sandeen
Quoted 6 lines · Chandan Babu R

xfs_extnum_t is the type to use to declare variables whose values have been obtained from per-inode extent counters. This commit replaces using basic types (e.g. uint64_t) with xfs_extnum_t when declaring such variables.

---

Thanks Chandan - I had rolled something like this into the merge of kernel "xfs: Use xfs_extnum_t instead of basic data types"
because it seemed like it should maybe all be done at once.

And the tree Dave has already had (some of) these type changes in db/ and repair/dinode.c as part of that patch.

Quoted 8 lines
Quoted 5 lines

On top of that, I added a lot more of these conversions, i.e. to bmap(), bmap_one_extent(), and make_bbmap() in db/bmap.c, process_bmbt_reclist() in db/check.c, fa_cfileoffd() and fa_dfiloffd() in db/faddr.c ... perhaps I should send you my net diff on top of the tree dchinner assembled, and you can see what you think?

Just merge what we've already got, then do an audit to check for anything that is missing and then commit them.

I've already got the additional updates folded into what I have staged, though. But I can also push what /I've/ got, and do an audit to fix stuff later, too, I suppose.

Quoted 11 lines
Quoted 4 lines

But at the highest level, does it make more sense to convert everything in the utilities at the same time as "xfs: Use xfs_extnum_t instead of basic data types" is applied to xfsprogs libxfs/ or would separate patches be better?

So long as it is converted before the release point it doesn't matter. We don't have extent counts of > 2*32 out in the wild yet, so as long as the conversions are all sorted by the time 5.19 is done then it just doesn't matter how many commits it takes because users won't be using the dev tree to repair filesystems with extent counts that could overflow a 32 bit counter....

Yeah, that's fair.

Thanks,
-Eric

Quoted 3 lines

Cheers,

Dave.