Re: Can O_SYNC be implemented by using fsync?

From: Ulrich Kunitz (gefm21@uumail.de)
Date: Tue May 16 2000 - 02:29:09 EST


Alan Cox wrote:

> O_SYNC applies to the write() not the blocks. That is you want to do
>
> while(blocks)
> {
> stuff it in cache
> if(sync)
> queue_the_io
> }
> if(!sync)
> return;
> while(queued_ios_left)
> wait
Hi Alan,

that's exactly what I understand. This is a way that's done for O_SYNC
on block devices.

My trouble is where to queue the io for file systems. If it's done in
a_ops->commit_write(), currently you would only queue page size data
chunks. That results in poorer overall performance
than fsync() for some folks, who are writing 256K data chunks.

There are two options:

(1) queuing pages in an upper layer
(2) introduce a dirty page list for an inode

(1) can be implemented in creating a generic_buffer_file_write(). Or it
could be done by changing the address space operations interface. The
latter would help also to make generic_buffer_fdatasync() to a
generic_fdatasync().

(2) could help fsync() also. The inode has to be locked during an append
to the dirty list. On the page and inode structure a pointer has to
be added. As far as I can see now, no interface changes are needed.

I argue for implementing the syncing stuff on the page cache, this way
you could use the code also for NFS (fsync(), fdatasync() and/or O_SYNC).

I have an experimental but working patch for (1) and I could clean that
up the next days.

-- 
Ulrich Kunitz (gefm21@uumail.de)

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue May 23 2000 - 21:00:10 EST