Re: [PATCH 10/12] NFS: Do not serialise O_DIRECT reads and writes

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

 



> +void
> +nfs_lock_bio(struct nfs_inode *nfsi)

bio stands for buffered I/O?  This could really use a more descriptive
name and/or a comment..

> +{
> +	/* Be an optimist! */
> +	down_read(&nfsi->io_lock);
> +	if (test_bit(NFS_INO_ODIRECT, &nfsi->flags) == 0)
> +		return;
> +	up_read(&nfsi->io_lock);

So if no direct I/O is going on this locks shared?

> +	/* Slow path.... */
> +	down_write(&nfsi->io_lock);
> +	clear_bit(NFS_INO_ODIRECT, &nfsi->flags);
> +	downgrade_write(&nfsi->io_lock);

The whole locking here seems rather confusing.  Why not use the XFS
locking model:

buffered write:		exclusive
buffered read:		shared
direct write:		shared (exclusive for pagecache invalidate)
direct read:		shared (exclusive for pagecache invalidate)

The nice thing is than in 4.7-rc i_mutex has been replaced with a
rw_mutex so you can just use that in shared mode for direct I/O
as-is without needing any new lock.
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux