iDon't keep all snapshots in memory during walk - 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 f450209a3a8f19f21652cb32dd4ff1ce1efdd8fd /scm/dedup/commit/f450209a3a8f19f21652cb32dd4ff1ce1efdd8fd.gph bitreich.org 70 1parent 9af5dd1c8a0f4ed051b7247ca759263f5cfee054 /scm/dedup/commit/9af5dd1c8a0f4ed051b7247ca759263f5cfee054.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Thu, 21 Feb 2019 18:24:52 +0000 Err bitreich.org 70 i Err bitreich.org 70 iDon't keep all snapshots in memory during walk Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M dedup.c | 11 +++++++---- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 7 insertions(+), 4 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@@ -574,12 +574,14 @@ rebuild_cache(struct snapshot *snap, void *arg) Err bitreich.org 70 i void Err bitreich.org 70 i walk(int (*fn)(struct snapshot *, void *), void *arg) Err bitreich.org 70 i { Err bitreich.org 70 i- struct snapshot *snap; Err bitreich.org 70 i uint64_t i; Err bitreich.org 70 i Err bitreich.org 70 i- snap = alloc_snap(); Err bitreich.org 70 i xlseek(ifd, sizeof(snaphdr), SEEK_SET); Err bitreich.org 70 i for (i = 0; i < snaphdr.nr_snapshots; i++) { Err bitreich.org 70 i+ struct snapshot *snap; Err bitreich.org 70 i+ int ret; Err bitreich.org 70 i+ Err bitreich.org 70 i+ snap = alloc_snap(); Err bitreich.org 70 i if (xread(ifd, snap, sizeof(*snap)) == 0) Err bitreich.org 70 i errx(1, "read: unexpected EOF"); Err bitreich.org 70 i Err bitreich.org 70 i@@ -588,10 +590,11 @@ walk(int (*fn)(struct snapshot *, void *), void *arg) Err bitreich.org 70 i snap->nr_blk_descs * sizeof(snap->blk_desc[0])) == 0) Err bitreich.org 70 i errx(1, "read: unexpected EOF"); Err bitreich.org 70 i Err bitreich.org 70 i- if ((*fn)(snap, arg) == WALK_STOP) Err bitreich.org 70 i+ ret = (*fn)(snap, arg); Err bitreich.org 70 i+ free(snap); Err bitreich.org 70 i+ if (ret == WALK_STOP) Err bitreich.org 70 i break; Err bitreich.org 70 i } Err bitreich.org 70 i- free_snap(snap); Err bitreich.org 70 i } Err bitreich.org 70 i Err bitreich.org 70 i void Err bitreich.org 70 .