2008-10-29 10:30:29

by Nick Piggin

[permalink] [raw]
Subject: Re: [patch 0/9] writeback data integrity and other fixes (take 3)

On Wed, Oct 29, 2008 at 05:44:17AM -0400, Christoph Hellwig wrote:
> On Wed, Oct 29, 2008 at 10:21:43AM +0100, Nick Piggin wrote:
> > Please do.
>
> Well, there's one stumling block I haven't made progress on yet:
>
> I've changed the prototype of ->fsync to lose the dentry as we should
> always have a valid file struct. Except that nfsd doesn't on
> directories. So I either need to fake up a file there, or bail out
> and add a ->dir_sync export operation that needs just a dentry.

OK. I don't know much about hthat code, but I would think nfsd
should look as close to the syscall layer as possible. I guess
there must be something prohibitive (some protocol semantics?).

Is there anything that particularly makes it a file operation
as opposed to an inode operation?


2008-10-29 12:22:35

by Jamie Lokier

[permalink] [raw]
Subject: Re: [patch 0/9] writeback data integrity and other fixes (take 3)

Nick Piggin wrote:
> On Wed, Oct 29, 2008 at 05:44:17AM -0400, Christoph Hellwig wrote:
> > On Wed, Oct 29, 2008 at 10:21:43AM +0100, Nick Piggin wrote:
> > > Please do.
> >
> > Well, there's one stumling block I haven't made progress on yet:
> >
> > I've changed the prototype of ->fsync to lose the dentry as we should
> > always have a valid file struct. Except that nfsd doesn't on
> > directories. So I either need to fake up a file there, or bail out
> > and add a ->dir_sync export operation that needs just a dentry.
>
> OK. I don't know much about hthat code, but I would think nfsd
> should look as close to the syscall layer as possible. I guess
> there must be something prohibitive (some protocol semantics?).
>
> Is there anything that particularly makes it a file operation
> as opposed to an inode operation?

In principle, is fsync() required to flush all dirty data written
through any file descriptor ever, or just dirty data written through
the file descriptor used for fsync()?

-- Jamie

2008-10-29 13:32:34

by Ric Wheeler

[permalink] [raw]
Subject: Re: [patch 0/9] writeback data integrity and other fixes (take 3)

Jamie Lokier wrote:
> Nick Piggin wrote:
>
>> On Wed, Oct 29, 2008 at 05:44:17AM -0400, Christoph Hellwig wrote:
>>
>>> On Wed, Oct 29, 2008 at 10:21:43AM +0100, Nick Piggin wrote:
>>>
>>>> Please do.
>>>>
>>> Well, there's one stumling block I haven't made progress on yet:
>>>
>>> I've changed the prototype of ->fsync to lose the dentry as we should
>>> always have a valid file struct. Except that nfsd doesn't on
>>> directories. So I either need to fake up a file there, or bail out
>>> and add a ->dir_sync export operation that needs just a dentry.
>>>
>> OK. I don't know much about hthat code, but I would think nfsd
>> should look as close to the syscall layer as possible. I guess
>> there must be something prohibitive (some protocol semantics?).
>>
>> Is there anything that particularly makes it a file operation
>> as opposed to an inode operation?
>>
>
> In principle, is fsync() required to flush all dirty data written
> through any file descriptor ever, or just dirty data written through
> the file descriptor used for fsync()?
>
> -- Jamie
> --
>
http://www.opengroup.org/onlinepubs/009695399/functions/fsync.html

Is a pointer to what seems to be the official posix spec for this - it
is definitely per file descriptor, not per file system, etc...

What can happen by side effect (depending on the implementation) is that
you can actually force out all data for any file. I found that you can
approach non-fsync speeds for an fsync per file workload by simply
writing all of the files out, then going back and fsync'ing them one at
a time (last file first makes a bit of a difference). With that
technique, you do get the hard promise of full data integrity and high
speed. This is useful when you want to do bulk writes (tar, etc)

ric



2008-10-29 14:56:36

by Chris Mason

[permalink] [raw]
Subject: Re: [patch 0/9] writeback data integrity and other fixes (take 3)

On Wed, 2008-10-29 at 09:32 -0400, Ric Wheeler wrote:
> Jamie Lokier wrote:

> >> Is there anything that particularly makes it a file operation
> >> as opposed to an inode operation?
> >>
> >
> > In principle, is fsync() required to flush all dirty data written
> > through any file descriptor ever, or just dirty data written through
> > the file descriptor used for fsync()?
> >
> > -- Jamie
> > --
> >
> http://www.opengroup.org/onlinepubs/009695399/functions/fsync.html
>
> Is a pointer to what seems to be the official posix spec for this - it
> is definitely per file descriptor, not per file system, etc...
>

Maybe I'm reading Jamie's question wrong, but I think he's saying:

/* open exactly the same file twice */
fd = open("file");
fd2 = open("file");

write(fd, "stuff")
write(fd2, "more stuff")
fsync(fd);

Does the fsync promise "more stuff" will be on disk? I think the answer
should be yes.

-chris



2008-10-29 21:43:47

by Dave Chinner

[permalink] [raw]
Subject: Re: [patch 0/9] writeback data integrity and other fixes (take 3)

On Wed, Oct 29, 2008 at 12:22:35PM +0000, Jamie Lokier wrote:
> Nick Piggin wrote:
> > On Wed, Oct 29, 2008 at 05:44:17AM -0400, Christoph Hellwig wrote:
> > > On Wed, Oct 29, 2008 at 10:21:43AM +0100, Nick Piggin wrote:
> > > > Please do.
> > >
> > > Well, there's one stumling block I haven't made progress on yet:
> > >
> > > I've changed the prototype of ->fsync to lose the dentry as we should
> > > always have a valid file struct. Except that nfsd doesn't on
> > > directories. So I either need to fake up a file there, or bail out
> > > and add a ->dir_sync export operation that needs just a dentry.
> >
> > OK. I don't know much about hthat code, but I would think nfsd
> > should look as close to the syscall layer as possible. I guess
> > there must be something prohibitive (some protocol semantics?).
> >
> > Is there anything that particularly makes it a file operation
> > as opposed to an inode operation?
>
> In principle, is fsync() required to flush all dirty data written
> through any file descriptor ever, or just dirty data written through
> the file descriptor used for fsync()?

fsync() is required to flush the data that is dirty at the time of the
call, as well as any associated metadata needed to reference that data. It
doesn't matter who wrote the data in the first place....

Cheers,

Dave.
--
Dave Chinner
[email protected]