GNOME Bugzilla – Bug 707733
Much more extensive use of at-relative API
Last modified: 2013-09-08 18:52:30 UTC
To repeat, the benefits of this are twofold: 1) It avoids lots of malloc()/g_object_new(G_TYPE_FILE) inside ostree itself 2) The kernel doesn't have to traverse the pathnames over and over. In particular this avoids having to re-do security checks for each access to directories.
Created attachment 254426 [details] [review] core: Use linkat() for hardlink checkouts too Clean up how we deal with the uncompressed object cache; we now use openat()/linkat() and such just like we do for the main objects/. Use linkat() between the objects and the destination, if possible.
Created attachment 254427 [details] [review] core: Make write_object() a bit more efficient Do as many operations as we can using the original file descriptor while we have it open, rather than writing, closing, then reopening. This necessitated very explicitly special casing symbolic links, mainly due to the lack of lsetxattrat().
Created attachment 254428 [details] [review] core: Make ostree_set_xattrs() private Nothing external uses it. We keep ostree_get_xattrs_for_file() public because it's convenient for external consumers to get xattrs in exactly the format we desire.
Created attachment 254429 [details] [review] core: Use at-relative functions for checking out tree copies too For the cases where we can't hardlink, use at-relative walking of the path where possible. We still don't have lsetxattrat, so we also need to deal with pathnames, but that is now only for symlinks. Again, the advantages of this are a lot less malloc() of pathnames in ostree, and much less time spent traversing paths inside the kernel.
Review of attachment 254426 [details] [review]: Makes sense.
Review of attachment 254428 [details] [review]: OK.
Review of attachment 254429 [details] [review]: This one doesn't diff too well. ::: src/libostree/ostree-repo-checkout.c @@ +50,3 @@ + /* Don't make setuid files in uncompressed cache */ + file_mode = g_file_info_get_attribute_uint32 (src_info, "unix::mode"); + file_mode &= ~(S_ISUID|S_ISGID); Seems like an unrelated bugfix? @@ +640,3 @@ +{ + return checkout_tree_at (self, mode, overwrite_mode, + AT_FDCWD, This is a clever dirty trick.
Review of attachment 254427 [details] [review]: Looks OK.
Attachment 254426 [details] pushed as 9846fb2 - core: Use linkat() for hardlink checkouts too Attachment 254427 [details] pushed as 27c3e78 - core: Make write_object() a bit more efficient Attachment 254428 [details] pushed as 0c2ea54 - core: Make ostree_set_xattrs() private Attachment 254429 [details] pushed as 33e589c - core: Use at-relative functions for checking out tree copies too