Re: Can O_SYNC be implemented by using fsync?

From: Andi Kleen (ak@suse.de)
Date: Sat May 13 2000 - 15:50:37 EST


Ulrich Kunitz <gefm21@uumail.de> writes:

> Hi,
>
> this discusses item 5.1 in Alan's list of outstanding fixes before 2.4.
>
> I'm using fsync to write out all dirty pages/blocks of a file in
> generic_file_write to get O_SYNC behaviour. Patch is included below. It
> is the wrong way to do O_SYNC? I've checked this and it seems to do what
> would be expected and it caused no harm to me.

It is just very very inefficient to do it this way, especially on file systems
that don't use page sized blocks. Fsync does a lot of work while searching
the buffer cache for dirty blocks. For page block sized it is a bit better,
but still rather slow. Implementing O_SYNC directly is preferable I think.

-Andi

-
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 : Mon May 15 2000 - 21:00:23 EST