* The question about parallel direct IO in xfs
@ 2012-01-20 3:55 Zheng Liu
2012-01-20 5:13 ` Dave Chinner
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Liu @ 2012-01-20 3:55 UTC (permalink / raw)
To: xfs
Hi all,
Recently we encounter an issue in ext4. The issue is that, when we do a direct
IO, ext4 will acquire inode->i_mutex in generic_file_aio_write(). It declines
the performance. Here is the detailed conversation.
http://www.spinics.net/lists/linux-ext4/msg30058.html
I know that in xfs it uses i_iolock, which is a rw_semaphore, to make parallel
operations in direct IO. But I have a question. As we do some read/write
operations in direct IO, it seems that there has a window to cause data
inconsistency. For example, One thread does a write operation to overlay some
data at a offset. Meanwhile another thread does a read operation at the same
offset. We assume that write is earlier than read. Hence, we should read new
data. Although it is diffculty to occur, it is possible that read is issued to
the disk firstly and we read old data. I don't know whether it exists or not in
xfs. Thank you.
Sorry, I don't subscribe this mailing list. Please CC to me
<gnehzuil.liu@gmail.com>. Thank you.
Regards,
Zheng
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: The question about parallel direct IO in xfs
2012-01-20 3:55 The question about parallel direct IO in xfs Zheng Liu
@ 2012-01-20 5:13 ` Dave Chinner
0 siblings, 0 replies; 2+ messages in thread
From: Dave Chinner @ 2012-01-20 5:13 UTC (permalink / raw)
To: Zheng Liu; +Cc: xfs
On Fri, Jan 20, 2012 at 11:55:08AM +0800, Zheng Liu wrote:
> Hi all,
>
> Recently we encounter an issue in ext4. The issue is that, when we do a direct
> IO, ext4 will acquire inode->i_mutex in generic_file_aio_write(). It declines
> the performance. Here is the detailed conversation.
> http://www.spinics.net/lists/linux-ext4/msg30058.html
>
> I know that in xfs it uses i_iolock, which is a rw_semaphore, to make parallel
> operations in direct IO. But I have a question. As we do some read/write
> operations in direct IO, it seems that there has a window to cause data
> inconsistency.
Yes, there is. That's a feature, not a bug.
> For example, One thread does a write operation to overlay some
> data at a offset. Meanwhile another thread does a read operation at the same
> offset. We assume that write is earlier than read.
Your assumption is wrong.
> Hence, we should read new
> data. Although it is diffculty to occur, it is possible that read is issued to
> the disk firstly and we read old data. I don't know whether it exists or not in
> xfs. Thank you.
Fundamentally, the result of concurrent read and write direct IO
operations to the same offset is undefined because the filesystem
has no control of IO reordering in lower layers of the storage
stack. IOWs, we give no guarantees for IO ordering or coherency of
concurrent direct IO to the same offset.
If your application requires this sort of coherency, then you either
need to use buffered IO or provide these coherency guarantees
yourself because direct IO doesn't provide them. File range locking
is an example of how your application can coordinate it's IO to
avoid this problem.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-01-20 5:13 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-20 3:55 The question about parallel direct IO in xfs Zheng Liu
2012-01-20 5:13 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox