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]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux