Hi all,
>> 2. Is fsync() supposed to sync all outstanding writes for that file
>> handle only, or for the inode that is referenced by it?
>
>>From SingleUnix:
>
> The fsync() function can be used by an application to indicate that
> all data for the open file description named by fildes is to be
> transferred to the storage device associated with the file described
> by fildes in an implementation-dependent manner. The fsync()
> function does not return until the system has completed that action
> or until an error is detected.
>
>So it should flush for all file handles.
I think we disagree. It says "... all data for the open file descriptor
named by fildes...." and not "...all data for the file described by
fildes...." They really talk about the descriptor, not the file itself.
".... to be transferred to the storage device associated with the
file described by fildes...." Here they talk about the underlying
inode.
>> 3. Why does the fsync() file operation have a dentry argument?
>
>History. :)
So why not throw it out in 2.3?
>> 4. [offtopic?] Why does the ioctl() file operation have an inode
>> argument?
>
>Same answer?
Same answer for me too.
>> 5. I was doing fdatasync() yesterday (currently it does the same as
>> fsync(), I'm trying to fix that) when I had the following thoughts:
>
>I already have fdatasync diffs for 2.2, I'll try to merge into 2.3 at
>some point.
I'm inclined to believe you have lots of patches lying around which
you'll just merge into 2.3 and never tell anyone about (because you're
perfect?). Or perhaps this is the "linux developer e-mail problem"?
If you say you did it people will complain that you're not releasing it.
If you release it people will complain that it doesn't work. So, just
don't release it, don't tell about it. Close?
>> 2. So, it would likely be correct not to sync the inode itself on a
>> fdatasync()
>
>No.
That's why I came back on myself later on.
>> 6. I was planning on doing fdatasync by something like:
>> int (*fsync)(struct file *filp, int sync_metadata); or
>> int (*fsync)(struct file *filp, int full_fsync); or
>> int (*fsync)(struct file *filp, int sync_all);
>
>I've done it by splitting the inode dirty flag into two separate bits,
>one for fdatasync inode dirty state (ie. excluding timestamps) and one
>which includes timestamp dirty state too. And yes, I had to add a
>fdatasync argument to the VFS fsync() method.
Yes, I split the dirty bits as well. But as it's no longer needed.... Well,
had fun anyway.
So you added the fdatasync argument to the fsync method? I assume
you removed the dentry argument as well?
Lennert