iRework get_chunk_size() to return the size rather than the offset - 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 b1c7996c39784e81f73e4b1189f9b5786caad974 /scm/dedup/commit/b1c7996c39784e81f73e4b1189f9b5786caad974.gph bitreich.org 70 1parent 66a94e3ce6d7c193d13d0bad4b1b8f7ecd51f5d2 /scm/dedup/commit/66a94e3ce6d7c193d13d0bad4b1b8f7ecd51f5d2.gph bitreich.org 70 hAuthor: sin URL:mailto:sin@2f30.org bitreich.org 70 iDate: Fri, 22 Feb 2019 19:32:12 +0000 Err bitreich.org 70 i Err bitreich.org 70 iRework get_chunk_size() to return the size rather than the offset Err bitreich.org 70 i Err bitreich.org 70 iDiffstat: Err bitreich.org 70 i M chunker.c | 13 ++++++------- Err bitreich.org 70 i Err bitreich.org 70 i1 file changed, 6 insertions(+), 7 deletions(-) Err bitreich.org 70 i--- Err bitreich.org 70 1diff --git a/chunker.c b/chunker.c /scm/dedup/file/chunker.c.gph bitreich.org 70 i@@ -43,8 +43,6 @@ get_chunk_size(struct chunker *chunker) Err bitreich.org 70 i if (chunk_size < WINSIZE) Err bitreich.org 70 i return chunk_size; Err bitreich.org 70 i Err bitreich.org 70 i- bp = chunker->buf; Err bitreich.org 70 i- Err bitreich.org 70 i /* Err bitreich.org 70 i * To achieve better deduplication, we chunk blocks based on a Err bitreich.org 70 i * recurring pattern occuring on the data stream. A fixed window Err bitreich.org 70 i@@ -53,14 +51,15 @@ get_chunk_size(struct chunker *chunker) Err bitreich.org 70 i * When the rolling hash matches a given pattern the block is chunked Err bitreich.org 70 i * at the end of that window. Err bitreich.org 70 i */ Err bitreich.org 70 i+ bp = &chunker->buf[chunker->rpos]; Err bitreich.org 70 i fp = buzh_init(bp, WINSIZE); Err bitreich.org 70 i- for (i = chunker->rpos; i < chunker->wpos - WINSIZE; i++) { Err bitreich.org 70 i- chunk_size = i + WINSIZE; Err bitreich.org 70 i+ for (i = 0; i < chunk_size - WINSIZE; i++) { Err bitreich.org 70 i if (i > 0) Err bitreich.org 70 i- fp = buzh_update(fp, bp[i - 1], bp[chunk_size - 1], Err bitreich.org 70 i+ fp = buzh_update(fp, bp[i - 1], bp[i + WINSIZE - 1], Err bitreich.org 70 i WINSIZE); Err bitreich.org 70 i- if (match_pattern(chunker, chunk_size, fp) == 1) Err bitreich.org 70 i- return chunk_size; Err bitreich.org 70 i+ if (match_pattern(chunker, i + WINSIZE, fp) == 1) Err bitreich.org 70 i+ return i + WINSIZE; Err bitreich.org 70 i+ Err bitreich.org 70 i } Err bitreich.org 70 i return chunk_size; Err bitreich.org 70 i } Err bitreich.org 70 .