iDon't flush cache if it hasn't been modified - dedup - deduplicating backup program Err bitreich.org 70 hgit clone git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ URL:git://bitreich.org/dedup/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/dedup/ bitreich.org 70 1Log /scm/dedup/log.gph bitreich.org 70 1Files /scm/dedup/files.gph bitreich.org 70 1Refs /scm/dedup/refs.gph bitreich.org 70 1Tags /scm/dedup/tag bitreich.org 70 1README /scm/dedup/file/README.gph bitreich.org 70 1LICENSE /scm/dedup/file/LICENSE.gph bitreich.org 70 i--- Err bitreich.org 70 1commit 9ffbdb14b746f421734fd66435a330b033edbad6 /scm/dedup/commit/9ffbdb14b746f421734fd66435a330b033edbad6.gph bitreich.org 70 1parent e0161df4361701471430efb134e1f37906bd6226 /scm/dedup/commit/e0161df4361701471430efb134e1f37906bd6226.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Mon, 18 Feb 2019 13:33:13 +0000 Err bitreich.org 70 i Err bitreich.org 70 iDon't flush cache if it hasn't been modified Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M dedup.c | 6 ++++++ Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 6 insertions(+), 0 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/dedup.c b/dedup.c /scm/dedup/file/dedup.c.gph bitreich.org 70 i@@ -78,6 +78,7 @@ int ifd; Err bitreich.org 70 i int sfd; Err bitreich.org 70 i int cfd; Err bitreich.org 70 i int verbose; Err bitreich.org 70 i+int cache_dirty; Err bitreich.org 70 i char *argv0; Err bitreich.org 70 i Err bitreich.org 70 i /* Err bitreich.org 70 i@@ -285,6 +286,9 @@ flush_cache(void) Err bitreich.org 70 i { Err bitreich.org 70 i struct cent *cent; Err bitreich.org 70 i Err bitreich.org 70 i+ if (!cache_dirty) Err bitreich.org 70 i+ return; Err bitreich.org 70 i+ Err bitreich.org 70 i lseek(cfd, 0, SEEK_SET); Err bitreich.org 70 i RB_FOREACH(cent, cache, &cache_head) Err bitreich.org 70 i xwrite(cfd, ¢->bdescr, sizeof(cent->bdescr)); Err bitreich.org 70 i@@ -451,6 +455,7 @@ dedup(int fd, char *msg) Err bitreich.org 70 i cent = alloc_cent(); Err bitreich.org 70 i cent->bdescr = bdescr; Err bitreich.org 70 i add_cent(cent); Err bitreich.org 70 i+ cache_dirty = 1; Err bitreich.org 70 i Err bitreich.org 70 i enthdr.st.actual_bytes += bdescr.size; Err bitreich.org 70 i enthdr.st.cache_misses++; Err bitreich.org 70 i@@ -583,6 +588,7 @@ rebuild_cache(struct ent *ent, void *arg) Err bitreich.org 70 i memcpy(cent->bdescr.md, md, sizeof(cent->bdescr.md)); Err bitreich.org 70 i cent->bdescr = ent->bdescr[i]; Err bitreich.org 70 i add_cent(cent); Err bitreich.org 70 i+ cache_dirty = 1; Err bitreich.org 70 i } Err bitreich.org 70 i free(buf); Err bitreich.org 70 i return WALK_CONTINUE; Err bitreich.org 70 .