summaryrefslogtreecommitdiff
path: root/src/libotutil/ot-variant-utils.c
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2012-08-27 16:07:39 -0400
committerColin Walters <walters@verbum.org>2012-08-27 16:07:39 -0400
commit4d2f77074802ac8b2d05f7cdfecef9bebfba2647 (patch)
tree5b9897555b6f55d1985dacbda6829876f706c601 /src/libotutil/ot-variant-utils.c
parent2396608754060e9e7a68843b65e4d3b8f4a4b5f2 (diff)
downloadostree-4d2f77074802ac8b2d05f7cdfecef9bebfba2647.tar.gz
core: Use O_NOATIME to open metadata
We really don't need atime for metadata, it's just a speed hit.
Diffstat (limited to 'src/libotutil/ot-variant-utils.c')
-rw-r--r--src/libotutil/ot-variant-utils.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c
index 93b69b84..973dbf16 100644
--- a/src/libotutil/ot-variant-utils.c
+++ b/src/libotutil/ot-variant-utils.c
@@ -118,11 +118,16 @@ ot_util_variant_map (GFile *src,
const char *path = NULL;
ot_lvariant GVariant *ret_variant = NULL;
GMappedFile *mfile = NULL;
+ int fd;
path = ot_gfile_get_path_cached (src);
- mfile = g_mapped_file_new (path, FALSE, error);
+ if (!ot_unix_open_noatime (path, &fd, error))
+ goto out;
+ mfile = g_mapped_file_new_from_fd (fd, FALSE, error);
if (!mfile)
goto out;
+ if (!ot_unix_close (fd, error))
+ goto out;
ret_variant = g_variant_new_from_data (type,
g_mapped_file_get_contents (mfile),