Re: REQ_FLUSH, REQ_FUA and open/close of block devices

From: Christoph Hellwig
Date: Sun May 22 2011 - 08:04:15 EST

On Sun, May 22, 2011 at 01:00:41PM +0100, Alex Bligh wrote:
> I think what you are saying is that when the request with REQ_FUA arrives,
> it will have been immediately preceded by a REQ_FLUSH. Therefore, I will
> only have the data attached to the request with REQ_FUA to flush anyway, so
> an fdatasync() does no harm performance wise. That's what I'm currently
> doing if sync_file_range() is not supported. It sounds like that's what I
> should be doing all the time. If you don't mind, I shall borrow your
> text above and put it in the source.

Sure, feel free to borrow it. Note that I have a mid-term plan to
actually use REQ_FUA without preceeding REQ_FLUSH in XFS, but even in
that case the write cache probably won't be too full.

Long term someone who cares enough should simple submit patches
for range fsync/fdatasync syscalls. We already have all the
infrastructure for it in the kernel, as it's used by the O_SYNC/O_DSYNC
implementation and nfsd, so it's just the actually syscall entry points
that need to be added.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at