Re: [PATCH 8/9] xfs: use iomap_valid method to detect stale cached iomaps

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

 



On Tue, Nov 15, 2022 at 12:30:42PM +1100, Dave Chinner wrote:
> +/*
> + * Check that the iomap passed to us is still valid for the given offset and
> + * length.
> + */
> +static bool
> +xfs_iomap_valid(
> +	struct inode		*inode,
> +	const struct iomap	*iomap)
> +{
> +	struct xfs_inode	*ip = XFS_I(inode);
> +	u64			cookie = 0;
> +
> +	if (iomap->flags & IOMAP_F_XATTR) {
> +		cookie = READ_ONCE(ip->i_af.if_seq);
> +	} else {
> +		if ((iomap->flags & IOMAP_F_SHARED) && ip->i_cowfp)
> +			cookie = (u64)READ_ONCE(ip->i_cowfp->if_seq) << 32;
> +		cookie |= READ_ONCE(ip->i_df.if_seq);
> +	}
> +	return cookie == iomap->validity_cookie;

How can this be called with IOMAP_F_XATTR set?

Also the code seems to duplicate xfs_iomap_inode_sequence, so
we just call that:

	return cookie == xfs_iomap_inode_sequence(XFS_I(inode), iomap->flags);




[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