xfs
[Top] [All Lists]

Re: [PATCH 2/5] xfs: reduce ilock hold times in xfs_file_aio_write_check

To: Christoph Hellwig <hch@xxxxxxxxxxxxx>
Subject: Re: [PATCH 2/5] xfs: reduce ilock hold times in xfs_file_aio_write_checks
From: Ben Myers <bpm@xxxxxxx>
Date: Thu, 19 Apr 2012 15:30:16 -0500
Cc: xfs@xxxxxxxxxxx
In-reply-to: <20120327143826.433267717@xxxxxxxxxxxxxxxxxxxxxx>
References: <20120327143445.196524266@xxxxxxxxxxxxxxxxxxxxxx> <20120327143826.433267717@xxxxxxxxxxxxxxxxxxxxxx>
User-agent: Mutt/1.5.20 (2009-06-14)
On Tue, Mar 27, 2012 at 10:34:47AM -0400, Christoph Hellwig wrote:
> We do not need the ilock for generic_write_checks and the i_size read,
> which are protected by i_mutex and/or iolock, so reduce the ilock
> critical section to just the call to xfs_zero_eof.

So.. I agree that it looks like the only thing we need to protect in
generic_write_checks is the i_size_read.

For buffered io i_size_write is done in generic_write_end, and protected
XFS_IOLOCK_EXCL in xfs_file_buffered_write.  

For direct io i_size_write is done in generic_file_direct_write and also
protected by the iolock in xfs_file_dio_aio_write.  It's not as clear here
whether that lock is taken exclusive at that time.  However, this is handled in
xfs_file_aio_write_checks, where we go io exclusive for xfs_zero_eof.  Maybe it
would be best for this to be done more explicitly with respect to the inode
size in xfs_file_dio_aio_write.

Just wanting to show why generic_write_checks is ok protected with just the
iolock...

Reviewed-by: Ben Myers <bpm@xxxxxxx>

<Prev in Thread] Current Thread [Next in Thread>