Re: O_SYNC: How well do we support it?

Peter Rival (frival@zk3.dec.com)
Wed, 05 Jan 2000 14:29:25 -0500


--------------0375543E7D5BD4BB0DB3E305
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

"Stephen C. Tweedie" wrote:

> Hi,
>
> On Thu, 30 Dec 1999 09:53:04 -0500, Peter Rival <frival@zk3.dec.com>
> said:
>
> > I've run into what appears to be a problem with Linux's handling of
> > the O_SYNC flag to open() that has left some of my non-believing
> > colleagues, er, snickering. The basic essence of the story is that it
> > appears that all file IO is done asynchronously.
>
> The filesystem write path used by ext2 has been completely rewritten
> in the 2.3 kernels, and we are still to fix O_SYNC to work with the
> new scheme. Don't worry, it is on the pre-2.4 todo list!
>

Very good to hear. :) I, being the know-nothing in filesystems that I am,
have looked at it a little. I added back the updating of
inode->u.ext2_i.i_osync in ext2_file_write (before and after
generic_file_write), and I added this into generic_file_write right after the
call to write_one_page (which is really block_write_partial_page):

if (file->f_flags & O_SYNC)
writeout_one_page(page);

and that seems to have made some difference in the behavior, but I don't
think that it's all that's necessary. And, I'm not sure that it's even right
;)

Do we know when (approximately) this will be fixed? Also - for the sake of
current testing, could I just simulate it by doing a write() and then a
fsync() (or is it fdatasync()?) each time? Thanks!

- Pete

--------------0375543E7D5BD4BB0DB3E305
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
"Stephen C. Tweedie" wrote:

Hi,

On Thu, 30 Dec 1999 09:53:04 -0500, Peter Rival <frival@zk3.dec.com>
said:

>     I've run into what appears to be a problem with Linux's handling of
> the O_SYNC flag to open() that has left some of my non-believing
> colleagues, er, snickering.  The basic essence of the story is that it
> appears that all file IO is done asynchronously.

The filesystem write path used by ext2 has been completely rewritten
in the 2.3 kernels, and we are still to fix O_SYNC to work with the
new scheme.  Don't worry, it is on the pre-2.4 todo list!
 

Very good to hear. :)  I, being the know-nothing in filesystems that I am, have looked at it a little.  I added back the updating of inode->u.ext2_i.i_osync in ext2_file_write (before and after generic_file_write), and I added this into generic_file_write right after the call to write_one_page (which is really block_write_partial_page):

    if (file->f_flags & O_SYNC)
        writeout_one_page(page);

and that seems to have made some difference in the behavior, but I don't think that it's all that's necessary.  And, I'm not sure that it's even right ;)

Do we know when (approximately) this will be fixed?  Also - for the sake of current testing, could I just simulate it by doing a write() and then a fsync() (or is it fdatasync()?) each time?  Thanks!

 - Pete --------------0375543E7D5BD4BB0DB3E305-- - 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/