Re: [PATCH V7 06/17] xfs: Promote xfs_extnum_t and xfs_aextnum_t to 64 and 32-bits respectively

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04 Mar 2022 at 06:59, Dave Chinner wrote:
> On Tue, Mar 01, 2022 at 04:09:27PM +0530, Chandan Babu R wrote:
>> A future commit will introduce a 64-bit on-disk data extent counter and a
>> 32-bit on-disk attr extent counter. This commit promotes xfs_extnum_t and
>> xfs_aextnum_t to 64 and 32-bits in order to correctly handle in-core versions
>> of these quantities.
>> 
>> Reported-by: kernel test robot <lkp@xxxxxxxxx>
>
> What was reported by the test robot? This change isn't a bug that
> needed fixing, it's a core part of the patchset...
>

Kernel test robot had complained about the following,

  ld.lld: error: undefined symbol: __udivdi3
  >>> referenced by xfs_bmap.c
  >>>               xfs/libxfs/xfs_bmap.o:(xfs_bmap_compute_maxlevels) in archive fs/built-in.a

I had solved the linker error by replacing the division operation with the
following statement,

  maxblocks = howmany_64(maxleafents, minleafrecs);

Sorry, I will include this description in the commit message.

>> Reviewed-by: Darrick J. Wong <djwong@xxxxxxxxxx>
>> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx>
>> ---
>>  fs/xfs/libxfs/xfs_bmap.c       | 6 +++---
>>  fs/xfs/libxfs/xfs_inode_fork.c | 2 +-
>>  fs/xfs/libxfs/xfs_inode_fork.h | 2 +-
>>  fs/xfs/libxfs/xfs_types.h      | 4 ++--
>>  fs/xfs/xfs_inode.c             | 4 ++--
>>  fs/xfs/xfs_trace.h             | 2 +-
>>  6 files changed, 10 insertions(+), 10 deletions(-)
>> 
>> diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
>> index 98541be873d8..9df98339a43a 100644
>> --- a/fs/xfs/libxfs/xfs_bmap.c
>> +++ b/fs/xfs/libxfs/xfs_bmap.c
>> @@ -52,9 +52,9 @@ xfs_bmap_compute_maxlevels(
>>  	xfs_mount_t	*mp,		/* file system mount structure */
>>  	int		whichfork)	/* data or attr fork */
>>  {
>> +	xfs_extnum_t	maxleafents;	/* max leaf entries possible */
>>  	int		level;		/* btree level */
>>  	uint		maxblocks;	/* max blocks at this level */
>> -	xfs_extnum_t	maxleafents;	/* max leaf entries possible */
>>  	int		maxrootrecs;	/* max records in root block */
>>  	int		minleafrecs;	/* min records in leaf block */
>>  	int		minnoderecs;	/* min records in node block */
>
> Unnecessary.
>

I agree. I will revert the above change.

>> @@ -83,7 +83,7 @@ xfs_bmap_compute_maxlevels(
>>  	maxrootrecs = xfs_bmdr_maxrecs(sz, 0);
>>  	minleafrecs = mp->m_bmap_dmnr[0];
>>  	minnoderecs = mp->m_bmap_dmnr[1];
>> -	maxblocks = (maxleafents + minleafrecs - 1) / minleafrecs;
>> +	maxblocks = howmany_64(maxleafents, minleafrecs);
>>  	for (level = 1; maxblocks > 1; level++) {
>>  		if (maxblocks <= maxrootrecs)
>>  			maxblocks = 1;
>> @@ -467,7 +467,7 @@ xfs_bmap_check_leaf_extents(
>>  	if (bp_release)
>>  		xfs_trans_brelse(NULL, bp);
>>  error_norelse:
>> -	xfs_warn(mp, "%s: BAD after btree leaves for %d extents",
>> +	xfs_warn(mp, "%s: BAD after btree leaves for %llu extents",
>>  		__func__, i);
>>  	xfs_err(mp, "%s: CORRUPTED BTREE OR SOMETHING", __func__);
>>  	xfs_force_shutdown(mp, SHUTDOWN_CORRUPT_INCORE);
>> diff --git a/fs/xfs/libxfs/xfs_inode_fork.c b/fs/xfs/libxfs/xfs_inode_fork.c
>> index 829739e249b6..ce690abe5dce 100644
>> --- a/fs/xfs/libxfs/xfs_inode_fork.c
>> +++ b/fs/xfs/libxfs/xfs_inode_fork.c
>> @@ -117,7 +117,7 @@ xfs_iformat_extents(
>>  	 * we just bail out rather than crash in kmem_alloc() or memcpy() below.
>>  	 */
>>  	if (unlikely(size < 0 || size > XFS_DFORK_SIZE(dip, mp, whichfork))) {
>> -		xfs_warn(ip->i_mount, "corrupt inode %Lu ((a)extents = %d).",
>> +		xfs_warn(ip->i_mount, "corrupt inode %llu ((a)extents = %llu).",
>>  			(unsigned long long) ip->i_ino, nex);
>
> Isn't ip->i_ino explicitly defined as an unsigned long long? If you are going
> to fix one part of the printk formatting for ip->i_ino, you should
> probably should get rid of the unnecessary cast, too.

Yes, xfs_ino_t is an alias for "unsigned long long". I will remove the
typecast.

>
> Otherwise looks OK.

-- 
chandan



[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux