]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/stored/dircmd.c
Add Bytes/Blocks read by SD during restore
[bacula/bacula] / bacula / src / stored / dircmd.c
index 08d653d7705cda5d1b829734afa2210ec3acdce1..a62a3157361f30c7b608f09617579b4d65c4fd25 100644 (file)
@@ -431,11 +431,9 @@ static int read_label(JCR *jcr, DEVICE *dev)
    int stat;
    BSOCK *dir = jcr->dir_bsock;
    DEV_BLOCK *block;
-#ifndef NEW_LOCK
    bsteal_lock_t hold;
    
    steal_device_lock(dev, &hold, BST_DOING_ACQUIRE);
-#endif
    
    jcr->VolumeName[0] = 0;
    block = new_block(dev);
@@ -452,9 +450,7 @@ static int read_label(JCR *jcr, DEVICE *dev)
         break;
    }
    free_block(block);
-#ifndef NEW_LOCK
    return_device_lock(dev, &hold);
-#endif
    return stat;
 }
 
@@ -710,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));