Re: Durably writing resource forks and other extended attributes
Re: Durably writing resource forks and other extended attributes
- Subject: Re: Durably writing resource forks and other extended attributes
- From: Vivek Verma <email@hidden>
- Date: Wed, 25 Jul 2018 12:35:00 +0530
> On Jul 11, 2018, at 4:20 AM, Sujay Jayakar <email@hidden> 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 (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden