]> git.sur5r.net Git - bacula/bacula/commitdiff
Add Bytes/Blocks read by SD during restore
authorKern Sibbald <kern@sibbald.com>
Wed, 21 May 2003 14:22:00 +0000 (14:22 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 21 May 2003 14:22:00 +0000 (14:22 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@526 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/stored/block.c
bacula/src/stored/dev.h
bacula/src/stored/dircmd.c

index e910991967132f0022dcd8fa9c4dd405ac9a1bd7..d2b826139fe0d9a68fc79dc643be2b9357f169bc 100644 (file)
@@ -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.
+
index 7815c8ebfd3dcfa5ed991e9377c04d03ee051a29..7341c79db36621c82559548030dea111927f3bac 100644 (file)
@@ -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,
index 6ebdb310fe2fc37a4b58721e1f1104e8f2ab693c..515ef7df096b1628be4fd5101e658128b5338c86 100644 (file)
@@ -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 */
index 4b0be5edcb81266eb0a7c8ac5bad2342b756915f..a62a3157361f30c7b608f09617579b4d65c4fd25 100644 (file)
@@ -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));