Re: [PATCH 1/3] xfs_db: stop misusing an onstack inode

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

 



On Tue, Jul 14, 2020 at 02:46:43PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@xxxxxxxxxx>
> 
> The onstack inode in xfs_check's process_inode is a potential landmine
> since it's not a /real/ incore inode.  The upcoming 5.8 merge will make
> this messier wrt inode forks, so just remove the onstack inode and
> reference the ondisk fields directly.  This also reduces the amount of
> thinking that I have to do w.r.t. future libxfs porting efforts.
> 
> Signed-off-by: Darrick J. Wong <darrick.wong@xxxxxxxxxx>

Comparing this to my version here:

http://git.infradead.org/users/hch/xfsprogs.git/commitdiff/791d7d324290dbb83be7bf35fe15f9898f5df1c1

>  	mode_t			mode;
> +	uint16_t		diflags;
> +	uint64_t		diflags2 = 0;
> +	xfs_nlink_t		nlink;
> +	xfs_dqid_t		uid;
> +	xfs_dqid_t		gid;
> +	xfs_dqid_t		prid;

Not sure we really need the local variables, as they are mostly just
used once except for error messages..

> +	if (dip->di_version == 1) {
> +		nlink = be16_to_cpu(dip->di_onlink);
> +		prid = 0;
> +	} else {
> +		nlink = be32_to_cpu(dip->di_nlink);
> +		prid = (xfs_dqid_t)be16_to_cpu(dip->di_projid_hi) << 16 |
> +				   be16_to_cpu(dip->di_projid_lo);
> +	}

I mad the assumption that we don't support v1 inodes anymore, but
it appears we actually do.  So we might need to keep these two.

>  	if (isfree) {
> -		if (xino.i_d.di_nblocks != 0) {
> +		if (be64_to_cpu(dip->di_nblocks) != 0) {

No need to byte swap for a comparism with 0.

> -	if ((unsigned int)xino.i_d.di_aformat > XFS_DINODE_FMT_BTREE)  {
> +	if ((unsigned int)dip->di_aformat > XFS_DINODE_FMT_BTREE)  {

No need for the (pre-existing) cast here.

> +			fmtnames[(int)dip->di_aformat],

Same here.



[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