From: Kern Sibbald Date: Wed, 21 May 2003 14:22:00 +0000 (+0000) Subject: Add Bytes/Blocks read by SD during restore X-Git-Tag: Release-1.31~130 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=77e0dbbf9e7052667c9a71dfa9af22742c1601df;p=bacula%2Fbacula Add Bytes/Blocks read by SD during restore git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@526 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/kernstodo b/bacula/kernstodo index e910991967..d2b826139f 100644 --- a/bacula/kernstodo +++ b/bacula/kernstodo @@ -37,7 +37,6 @@ For 1.31 release: waiting for a connection from the FD that was never coming. - Make restore more robust in counting error and not immediately bailing out. Also print error message once, but try to continue. -- Make SD keep track of Files, Bytes during restore. - Add code to check that blocks are sequential on restore. - File the Automatically selected: xxx to say Automatically selected Pool: xxx @@ -879,3 +878,5 @@ Done: (see kernsdone for more) - Bug: fix access problems on files restored on WinXP. - Put system type returned by FD into catalog. - Finish WIN32_DATA stream code (bextract, check if can handle stream) +- Make SD keep track of Files, Bytes during restore. + diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 7815c8ebfd..7341c79db3 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -592,6 +592,8 @@ reread: dev->state &= ~(ST_EOF|ST_SHORT); /* clear EOF and short block */ dev->block_num++; + dev->VolCatInfo.VolCatReads++; + dev->VolCatInfo.VolCatRBytes += block->read_len; /* * If we read a short block on disk, diff --git a/bacula/src/stored/dev.h b/bacula/src/stored/dev.h index 6ebdb310fe..515ef7df09 100644 --- a/bacula/src/stored/dev.h +++ b/bacula/src/stored/dev.h @@ -122,6 +122,7 @@ typedef struct s_volume_catalog_info { uint32_t VolCatErrors; /* Number of errors this volume */ uint32_t VolCatWrites; /* Number of writes this volume */ uint32_t VolCatReads; /* Number of reads this volume */ + uint64_t VolCatRBytes; /* Number of bytes read */ uint32_t VolCatRecycles; /* Number of recycles this volume */ int32_t Slot; /* Slot in changer */ uint32_t VolCatMaxJobs; /* Maximum Jobs to write to volume */ diff --git a/bacula/src/stored/dircmd.c b/bacula/src/stored/dircmd.c index 4b0be5edcb..a62a315736 100644 --- a/bacula/src/stored/dircmd.c +++ b/bacula/src/stored/dircmd.c @@ -706,15 +706,27 @@ static int status_cmd(JCR *jcr) bnet_fsend(user, _("Device %s open but no Bacula volume is mounted.\n"), dev_name(dev)); } send_blocked_status(jcr, dev); - bpb = dev->VolCatInfo.VolCatBlocks; - if (bpb <= 0) { - bpb = 1; + if (dev->state & ST_APPEND) { + bpb = dev->VolCatInfo.VolCatBlocks; + if (bpb <= 0) { + bpb = 1; + } + bpb = dev->VolCatInfo.VolCatBytes / bpb; + bnet_fsend(user, _(" Total Bytes=%s Blocks=%s Bytes/block=%s\n"), + edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, b1), + edit_uint64_with_commas(dev->VolCatInfo.VolCatBlocks, b2), + edit_uint64_with_commas(bpb, b3)); + } else { /* reading */ + bpb = dev->VolCatInfo.VolCatReads; + if (bpb <= 0) { + bpb = 1; + } + bpb = dev->VolCatInfo.VolCatRBytes / bpb; + bnet_fsend(user, _(" Total Bytes Read=%s Blocks Read=%s Bytes/block=%s\n"), + edit_uint64_with_commas(dev->VolCatInfo.VolCatRBytes, b1), + edit_uint64_with_commas(dev->VolCatInfo.VolCatReads, b2), + edit_uint64_with_commas(bpb, b3)); } - bpb = dev->VolCatInfo.VolCatBytes / bpb; - bnet_fsend(user, _(" Total Bytes=%s Blocks=%s Bytes/block=%s\n"), - edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, b1), - edit_uint64_with_commas(dev->VolCatInfo.VolCatBlocks, b2), - edit_uint64_with_commas(bpb, b3)); bnet_fsend(user, _(" Positioned at File=%s Block=%s\n"), edit_uint64_with_commas(dev->file, b1), edit_uint64_with_commas(dev->block_num, b2));