From cfa0f370032b93c85ecce7601c4bfcdd564be68a Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Wed, 10 Sep 2008 18:22:23 +0000 Subject: [PATCH] Always print Verify hash differences. Rename variable to make the code slightly more readable. git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7583 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/AUTHORS | 1 + bacula/src/dird/verify.c | 9 ++------- bacula/src/filed/backup.c | 10 ++++++---- bacula/src/filed/verify.c | 7 ++++--- bacula/src/version.h | 4 ++-- bacula/technotes-2.5 | 5 ++++- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/bacula/AUTHORS b/bacula/AUTHORS index a1ae6dabf4..42269bdb44 100644 --- a/bacula/AUTHORS +++ b/bacula/AUTHORS @@ -93,5 +93,6 @@ Thorsten Enge Tim Oberfoell Tomas Cameron Tullio Andreatta +Ulrich Leodolter Wolfgang Denk Yves Orton diff --git a/bacula/src/dird/verify.c b/bacula/src/dird/verify.c index b05846d886..723a4915d1 100644 --- a/bacula/src/dird/verify.c +++ b/bacula/src/dird/verify.c @@ -730,13 +730,8 @@ int get_attributes_and_compare_to_catalog(JCR *jcr, JobId_t JobId) db_escape_string(jcr, jcr->db, buf, Opts_Digest, strlen(Opts_Digest)); if (strcmp(buf, fdbr.Digest) != 0) { prt_fname(jcr); - if (debug_level >= 10) { - Jmsg(jcr, M_INFO, 0, _(" %s not same. File=%s Cat=%s\n"), - stream_to_ascii(stream), buf, fdbr.Digest); - } else { - Jmsg(jcr, M_INFO, 0, _(" %s differs.\n"), - stream_to_ascii(stream)); - } + Jmsg(jcr, M_INFO, 0, _(" %s differs. File=%s Cat=%s\n"), + stream_to_ascii(stream), buf, fdbr.Digest); stat = JS_Differences; } do_Digest = CRYPTO_DIGEST_NONE; diff --git a/bacula/src/filed/backup.c b/bacula/src/filed/backup.c index 26dddc0fe1..07bbc264d1 100644 --- a/bacula/src/filed/backup.c +++ b/bacula/src/filed/backup.c @@ -831,19 +831,21 @@ int send_data(JCR *jcr, int stream, FF_PKT *ff_pkt, DIGEST *digest, /* Check for sparse blocks */ if (ff_pkt->flags & FO_SPARSE) { ser_declare; - bool haveBlock = true; + bool allZeros = false; if (sd->msglen == rsize && fileAddr+sd->msglen < (uint64_t)ff_pkt->statp.st_size || ((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) && (uint64_t)ff_pkt->statp.st_size == 0)) { - haveBlock = !is_buf_zero(rbuf, rsize); + allZeros = is_buf_zero(rbuf, rsize); } - if (haveBlock) { + if (!allZeros) { + /* Put file address as first data in buffer */ ser_begin(wbuf, SPARSE_FADDR_SIZE); ser_uint64(fileAddr); /* store fileAddr in begin of buffer */ } fileAddr += sd->msglen; /* update file address */ - if (!haveBlock) { + /* Skip block of all zeros */ + if (allZeros) { continue; /* skip block of zeros */ } } diff --git a/bacula/src/filed/verify.c b/bacula/src/filed/verify.c index 54971ccdd9..424f178f62 100644 --- a/bacula/src/filed/verify.c +++ b/bacula/src/filed/verify.c @@ -346,15 +346,16 @@ static int read_digest(BFILE *bfd, DIGEST *digest, JCR *jcr) while ((n=bread(bfd, buf, bufsiz)) > 0) { /* Check for sparse blocks */ if (ff_pkt->flags & FO_SPARSE) { - bool haveBlock = true; + bool allZeros = false; if (n == bufsiz && fileAddr+n < (uint64_t)ff_pkt->statp.st_size || ((ff_pkt->type == FT_RAW || ff_pkt->type == FT_FIFO) && (uint64_t)ff_pkt->statp.st_size == 0)) { - haveBlock = !is_buf_zero(buf, bufsiz); + allZeros = is_buf_zero(buf, bufsiz); } fileAddr += n; /* update file address */ - if (!haveBlock) { + /* Skip any block of all zeros */ + if (allZeros) { continue; /* skip block of zeros */ } } diff --git a/bacula/src/version.h b/bacula/src/version.h index 10c63b9963..90e0380474 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -4,8 +4,8 @@ #undef VERSION #define VERSION "2.5.3" -#define BDATE "08 September 2008" -#define LSMDATE "8Sep08" +#define BDATE "10 September 2008" +#define LSMDATE "10Sep08" #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n" #define BYEAR "2008" /* year for copyright messages in progs */ diff --git a/bacula/technotes-2.5 b/bacula/technotes-2.5 index 89f05cdc29..4de45456d3 100644 --- a/bacula/technotes-2.5 +++ b/bacula/technotes-2.5 @@ -61,9 +61,12 @@ plugin remove reader/writer in FOPTS???? General: +10Sep08 +kes Always print Verify hash differences. Rename variable to make the + code slightly more readable. 09Sep08 kes Correct tests for MaxFullInterval as reported by - Ulrich Leodolter. + Ulrich Leodolter .. kes Fix MaxDiffInterval code as well. kes Enable Win32 plugin load code in lib. kes Make Verify code that computes disk checksums use the same -- 2.39.5