> On Jul 11, 2018, at 4:20 AM, Sujay Jayakar <sujaya...@dropbox.com> wrote:
> 
> Hi all,
> 
> I'm trying to write file's contents, resource fork, and extended attributes 
> durably on both HFS+ and APFS.  My current approach is to use `write` and 
> `fsetxattr` to the write to the file and then `fcntl(fd, F_FULLFSYNC)` 
> afterwards.  Is this sufficient?
> 

yes.

> Looking at the HFS+ source, I was able to find that...
> Regular files have their content synced on `F_FULLSYNC`, as expected [1].
> All files' resource forks are synced immediately on `fsetxattr` [2].
> It looks like we skip syncing data on directory nodes [3].  If an xattr on a 
> directory is large enough to be in an extent, does this skip waiting on its 
> blocks to be flushed?
> What about extended attributes, both inline and extent-based? 

They are synchronous writes. resource forks are seperately sync'ed in fsetxattr 
because they behave slightly differently than all other extended attributes.

> 
> Next, what guarantees do we have for resource forks and extended attributes 
> with `F_FULLSYNC` on APFS?

same as HFS.

> 
> Thanks,
> Sujay
> 
> [1] 
> https://github.com/apple/darwin-xnu/blob/xnu-2782.1.97/bsd/hfs/hfs_vnops.c#L3011
>  
> <https://github.com/apple/darwin-xnu/blob/xnu-2782.1.97/bsd/hfs/hfs_vnops.c#L3011>
> [2] 
> https://github.com/apple/darwin-xnu/blob/xnu-2782.1.97/bsd/hfs/hfs_xattr.c#L926
>  
> <https://github.com/apple/darwin-xnu/blob/xnu-2782.1.97/bsd/hfs/hfs_xattr.c#L926>
> [3] 
> https://github.com/apple/darwin-xnu/blob/xnu-2782.1.97/bsd/hfs/hfs_vnops.c#L2896
>  
> <https://github.com/apple/darwin-xnu/blob/xnu-2782.1.97/bsd/hfs/hfs_vnops.c#L2896>
> 
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/filesystem-dev/vivek_verma%40apple.com
> 
> This email sent to vivek_ve...@apple.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (Filesystem-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/filesystem-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to