Re: [PATCH] v3 inodes are only valid on crc-enabled filesystems.

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

 



On 16 Aug 2015, at 01:42, Dave Chinner <david@xxxxxxxxxxxxx> wrote:

> On Sun, Aug 16, 2015 at 01:14:55AM +0100, Roger Willcocks wrote:
>> Fix an xfs_repair regression reported by Leslie Rhorer where a bad
>> (v3) inode version number was not reset.
>> 
>> Signed-off-by: Roger Willcocks <roger@xxxxxxxxxxxxxxxx>
>> 
>> -#define XFS_DINODE_GOOD_VERSION(v)	((v) >= 1 && (v) <= 3)
>> +#define XFS_DINODE_GOOD_VERSION(sb, v) \
>> +	(xfs_sb_version_hascrc(sb) ? ((v) == 3) : ((v) == 1 || (v) == 2))
> 
> I'd make this a static inline function so it gets type checking and
> it is easier to understand the logic at a glance. i.e. something
> like:
> 
> static inline bool
> xfs_dinode_good_version(struct xfs_mount *mp, __uint8_t version)
> {
> 	if (version < 1 || version > 3)
> 		return false;
> 	if (xfs_sb_version_hascrc(&mp->m_sb)) {
> 		if (version != 3)
> 			return false;
> 	} else if (version > 2)
> 		return false;
> 
> 	return true;
> }
> 

include of xfs_dinode.h has to be moved to after the definition of
xfs_mount in libxfs.h, but that’s okay following the pattern set by
xfs_da_format.h.

Updated patch follows.

—
Roger

_______________________________________________
xfs mailing list
xfs@xxxxxxxxxxx
http://oss.sgi.com/mailman/listinfo/xfs




[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux