• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Durably writing resource forks and other extended attributes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Durably writing resource forks and other extended attributes


  • Subject: Durably writing resource forks and other extended attributes
  • From: Sujay Jayakar <email@hidden>
  • Date: Tue, 10 Jul 2018 15:50:07 -0700

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?

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?

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

Thanks,
Sujay

[1]
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
[3]
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

  • Follow-Ups:
    • Re: Durably writing resource forks and other extended attributes
      • From: Vivek Verma <email@hidden>
  • Next by Date: Re: Durably writing resource forks and other extended attributes
  • Next by thread: Re: Durably writing resource forks and other extended attributes
  • Index(es):
    • Date
    • Thread