Hi,

JD wrote:
>
>
> On 09/16/2010 09:42 AM, Sameer Naik wrote:
>    
>>
> Remember that a directory can only be opened by
>          DIR *opendir(const char *name);
>          DIR *fdopendir(int fd);
>
> Problem is, how can you fsync a dir if you cannot open it
> with the open(2) system call?
> fsync(2) needs a file descriptor.
> DIR *  is not a file descriptor.
>
> And yet, the man page for fsync says:
>
>          Calling  fsync()  does  not  necessarily  ensure  that the entry
> in the
>          directory containing the file has  also  reached  disk. For
> that  an
>          explicit fsync() on a file descriptor for the directory is also
> needed.
>
> Maybe someone can clear this up a bit?

You can open(2) a directory in read-only mode :

f = create("dir/file",0664);
d = open("dir",O_RDONLY);
fsync(d);
close(d);

The manual says that all dirty pages for the "*file*"
referenced by the descriptor should be flushed
(even pages not written using the descriptor).

But ntfs-3g does not sort the dirty pages by file
so any fsync(2) will flush all the dirty pages in
the partition.

Regards

Jean-Pierre



------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
ntfs-3g-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ntfs-3g-devel

Reply via email to