summaryrefslogtreecommitdiff
path: root/src/libostree/ostree-repo-commit.c
diff options
context:
space:
mode:
authorJonathan Lebon <jonathan@jlebon.com>2018-11-02 15:39:34 -0400
committerAtomic Bot <atomic-devel@projectatomic.io>2018-11-05 14:08:54 +0000
commit8eac5be030797607715d5a2d973c55edff78a8a2 (patch)
tree08348f5aa79eef56dbc52a601bbd7742fa74c140 /src/libostree/ostree-repo-commit.c
parent1dcebe8846335a1f306d599fb7172d84aaa7b0a0 (diff)
downloadostree-8eac5be030797607715d5a2d973c55edff78a8a2.tar.gz
lib/commit: Add devino_cache_hits to txn stats
I found this useful while hacking on rpm-ostree but I think it might be useful enough to upstream. This stat is really helpful for validating that a pipeline is hitting the devino cache sweet spot. Closes: #1772 Approved by: cgwalters
Diffstat (limited to 'src/libostree/ostree-repo-commit.c')
-rw-r--r--src/libostree/ostree-repo-commit.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c
index 134024b8..52bc5d29 100644
--- a/src/libostree/ostree-repo-commit.c
+++ b/src/libostree/ostree-repo-commit.c
@@ -3338,6 +3338,9 @@ write_content_to_mtree_internal (OstreeRepo *self,
if (!glnx_shutil_rm_rf_at (dfd_iter->fd, name, cancellable, error))
return FALSE;
}
+ g_mutex_lock (&self->txn_lock);
+ self->txn.stats.devino_cache_hits++;
+ g_mutex_unlock (&self->txn_lock);
return TRUE; /* Early return */
}
}
@@ -3469,6 +3472,10 @@ write_content_to_mtree_internal (OstreeRepo *self,
if (!ostree_mutable_tree_replace_file (mtree, name, loose_checksum,
error))
return FALSE;
+
+ g_mutex_lock (&self->txn_lock);
+ self->txn.stats.devino_cache_hits++;
+ g_mutex_unlock (&self->txn_lock);
}
/* Next fast path - we can "adopt" the file */
else if (can_adopt)