From 90e04dd4f4c1bcad214b4ac5dd4ffbc55bbe0763 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Sat, 25 Nov 2006 15:55:25 +0000 Subject: [PATCH] Updates for debugging disk seek git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3700 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/match_bsr.c | 47 +++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/bacula/src/stored/match_bsr.c b/bacula/src/stored/match_bsr.c index ab7c6899fe..7e3a0e1668 100755 --- a/bacula/src/stored/match_bsr.c +++ b/bacula/src/stored/match_bsr.c @@ -43,6 +43,8 @@ #include "lib/fnmatch.h" #endif +const int dbglevel = 10; + /* Forward references */ static int match_volume(BSR *bsr, BSR_VOLUME *volume, VOLUME_LABEL *volrec, bool done); static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, bool done); @@ -179,10 +181,10 @@ BSR *find_next_bsr(BSR *root_bsr, DEVICE *dev) if (!root_bsr || !root_bsr->use_positioning || !root_bsr->reposition || no_file_seek) { - Dmsg2(300, "No nxt_bsr use_pos=%d repos=%d\n", root_bsr->use_positioning, root_bsr->reposition); + Dmsg2(dbglevel, "No nxt_bsr use_pos=%d repos=%d\n", root_bsr->use_positioning, root_bsr->reposition); return NULL; } - Dmsg2(300, "use_pos=%d repos=%d\n", root_bsr->use_positioning, root_bsr->reposition); + Dmsg2(dbglevel, "use_pos=%d repos=%d\n", root_bsr->use_positioning, root_bsr->reposition); root_bsr->mount_next_volume = false; for (bsr=root_bsr; bsr; bsr=bsr->next) { if (bsr->done || !match_volume(bsr, bsr->volume, &dev->VolHdr, 1)) { @@ -266,7 +268,7 @@ static BSR *find_smallest_volfile(BSR *found_bsr, BSR *bsr) bool is_this_bsr_done(BSR *bsr, DEV_RECORD *rec) { BSR *rbsr = rec->bsr; - Dmsg1(300, "match_set %d\n", rbsr != NULL); + Dmsg1(dbglevel, "match_set %d\n", rbsr != NULL); if (!rbsr) { return false; } @@ -275,7 +277,7 @@ bool is_this_bsr_done(BSR *bsr, DEV_RECORD *rec) if (rbsr->count && rbsr->found >= rbsr->count) { rbsr->done = true; rbsr->root->reposition = true; - Dmsg2(500, "is_end_this_bsr set reposition=1 count=%d found=%d\n", + Dmsg2(dbglevel, "is_end_this_bsr set reposition=1 count=%d found=%d\n", rbsr->count, rbsr->found); return true; } @@ -292,36 +294,36 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, SESSION_LABEL *sessrec, bool done) { if (bsr->done) { - Dmsg0(300, "bsr->done set\n"); + Dmsg0(dbglevel, "bsr->done set\n"); goto no_match; } if (!match_volume(bsr, bsr->volume, volrec, 1)) { - Dmsg2(300, "bsr fail vol=%s != rec vol=%s\n", bsr->volume->VolumeName, + Dmsg2(dbglevel, "bsr fail vol=%s != rec vol=%s\n", bsr->volume->VolumeName, volrec->VolumeName); goto no_match; } if (!match_volfile(bsr, bsr->volfile, rec, 1)) { - Dmsg2(300, "Fail on file. bsr=%d rec=%d\n", bsr->volfile->efile, + Dmsg2(dbglevel, "Fail on file. bsr=%d rec=%d\n", bsr->volfile->efile, rec->File); goto no_match; } if (!match_sesstime(bsr, bsr->sesstime, rec, 1)) { - Dmsg2(300, "Fail on sesstime. bsr=%d rec=%d\n", + Dmsg2(dbglevel, "Fail on sesstime. bsr=%d rec=%d\n", bsr->sesstime->sesstime, rec->VolSessionTime); goto no_match; } /* NOTE!! This test MUST come after the sesstime test */ if (!match_sessid(bsr, bsr->sessid, rec)) { - Dmsg2(300, "Fail on sessid. bsr=%d rec=%d\n", + Dmsg2(dbglevel, "Fail on sessid. bsr=%d rec=%d\n", bsr->sessid->sessid, rec->VolSessionId); goto no_match; } /* NOTE!! This test MUST come after sesstime and sessid tests */ if (!match_findex(bsr, bsr->FileIndex, rec, 1)) { - Dmsg2(300, "Fail on findex. bsr=%d rec=%d\n", - bsr->FileIndex->findex2, rec->FileIndex); + Dmsg3(dbglevel, "Fail on findex=%d. bsr=%d,%d\n", + rec->FileIndex, bsr->FileIndex->findex, bsr->FileIndex->findex2); goto no_match; } /* @@ -343,28 +345,28 @@ static int match_all(BSR *bsr, DEV_RECORD *rec, VOLUME_LABEL *volrec, * the rec->bsr = bsr optimization above. */ if (!match_jobid(bsr, bsr->JobId, sessrec, 1)) { - Dmsg0(300, "fail on JobId\n"); + Dmsg0(dbglevel, "fail on JobId\n"); goto no_match; } if (!match_job(bsr, bsr->job, sessrec, 1)) { - Dmsg0(300, "fail on Job\n"); + Dmsg0(dbglevel, "fail on Job\n"); goto no_match; } if (!match_client(bsr, bsr->client, sessrec, 1)) { - Dmsg0(300, "fail on Client\n"); + Dmsg0(dbglevel, "fail on Client\n"); goto no_match; } if (!match_job_type(bsr, bsr->JobType, sessrec, 1)) { - Dmsg0(300, "fail on Job type\n"); + Dmsg0(dbglevel, "fail on Job type\n"); goto no_match; } if (!match_job_level(bsr, bsr->JobLevel, sessrec, 1)) { - Dmsg0(300, "fail on Job level\n"); + Dmsg0(dbglevel, "fail on Job level\n"); goto no_match; } if (!match_stream(bsr, bsr->stream, rec, 1)) { - Dmsg0(300, "fail on stream\n"); + Dmsg0(dbglevel, "fail on stream\n"); goto no_match; } return 1; @@ -472,7 +474,7 @@ static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, bool d if (!(rec->state & REC_ISTAPE)) { return 1; /* All File records OK for this match */ } -// Dmsg3(300, "match_volfile: sfile=%d efile=%d recfile=%d\n", +// Dmsg3(dbglevel, "match_volfile: sfile=%d efile=%d recfile=%d\n", // volfile->sfile, volfile->efile, rec->File); if (volfile->sfile <= rec->File && volfile->efile >= rec->File) { return 1; @@ -489,7 +491,7 @@ static int match_volfile(BSR *bsr, BSR_VOLFILE *volfile, DEV_RECORD *rec, bool d if (volfile->done && done) { bsr->done = true; bsr->root->reposition = true; - Dmsg2(300, "bsr done from volfile rec=%d volefile=%d\n", + Dmsg2(dbglevel, "bsr done from volfile rec=%d volefile=%d\n", rec->File, volfile->efile); } return 0; @@ -526,7 +528,7 @@ static int match_sesstime(BSR *bsr, BSR_SESSTIME *sesstime, DEV_RECORD *rec, boo if (sesstime->done && done) { bsr->done = true; bsr->root->reposition = true; - Dmsg0(300, "bsr done from sesstime\n"); + Dmsg0(dbglevel, "bsr done from sesstime\n"); } return 0; } @@ -561,18 +563,21 @@ static int match_findex(BSR *bsr, BSR_FINDEX *findex, DEV_RECORD *rec, bool done return 1; /* no specification matches all */ } if (findex->findex <= rec->FileIndex && findex->findex2 >= rec->FileIndex) { + Dmsg3(dbglevel, "Match on findex=%d. bsr=%d,%d\n", + rec->FileIndex, findex->findex, findex->findex2); return 1; } if (rec->FileIndex > findex->findex2) { findex->done = true; } if (findex->next) { + Dmsg0(dbglevel, "Next findex link\n"); return match_findex(bsr, findex->next, rec, findex->done && done); } if (findex->done && done) { bsr->done = true; bsr->root->reposition = true; - Dmsg1(300, "bsr done from findex %d\n", rec->FileIndex); + Dmsg1(dbglevel, "bsr done from findex %d\n", rec->FileIndex); } return 0; } -- 2.39.5