From 760fb7176c267c5d690ee88c3459976b386ae8ed Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Mon, 8 Dec 2003 20:58:07 +0000 Subject: [PATCH] Fix overzelous VolCatFiles updating by removing from askdir.c and doing only when appropriate git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@841 91ce42f0-d328-0410-95d8-f526ca767f89 --- bacula/src/stored/acquire.c | 2 ++ bacula/src/stored/askdir.c | 1 - bacula/src/stored/block.c | 4 ++++ bacula/src/stored/device.c | 1 + 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bacula/src/stored/acquire.c b/bacula/src/stored/acquire.c index 6991f271b5..5cfb31bb6f 100644 --- a/bacula/src/stored/acquire.c +++ b/bacula/src/stored/acquire.c @@ -307,6 +307,7 @@ int release_device(JCR *jcr, DEVICE *dev) if (dev_can_write(dev)) { weof_dev(dev, 1); } + dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */ dev->VolCatInfo.VolCatJobs++; /* increment number of jobs */ /* Note! do volume update before close, which zaps VolCatInfo */ Dmsg0(100, "dir_update_vol_info. Release0\n"); @@ -324,6 +325,7 @@ int release_device(JCR *jcr, DEVICE *dev) jcr->VolCatInfo.VolCatName, jcr->Job); } Dmsg0(100, "dir_update_vol_info. Release1\n"); + dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */ dev->VolCatInfo.VolCatJobs++; /* increment number of jobs */ dir_update_volume_info(jcr, dev, 0); /* send Volume info to Director */ } diff --git a/bacula/src/stored/askdir.c b/bacula/src/stored/askdir.c index c7a8e4616e..1307a09751 100644 --- a/bacula/src/stored/askdir.c +++ b/bacula/src/stored/askdir.c @@ -172,7 +172,6 @@ int dir_update_volume_info(JCR *jcr, DEVICE *dev, int label) return 0; } - dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */ Dmsg1(100, "Update cat VolFiles=%d\n", dev->file); /* Just labeled or relabeled the tape */ if (label) { diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 86eb95c4ad..c74902de4b 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -415,6 +415,7 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) } /* Don't do update after second EOF or file count will be wrong */ Dmsg0(100, "dir_update_volume_info\n"); + dev->VolCatInfo.VolCatFiles = dev->file; dir_update_volume_info(jcr, dev, 0); if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) { /* write eof */ Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); @@ -434,12 +435,14 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) block->write_failed = true; dev->state |= (ST_EOF | ST_EOT | ST_WEOT); Dmsg0(100, "dir_update_volume_info\n"); + dev->VolCatInfo.VolCatFiles = dev->file; dir_update_volume_info(jcr, dev, 0); return 0; } /* Do bookkeeping to handle EOF just written */ Dmsg0(100, "dir_update_volume_info\n"); + dev->VolCatInfo.VolCatFiles = dev->file; dir_update_volume_info(jcr, dev, 0); if (!dir_create_jobmedia_record(jcr)) { Jmsg(jcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=\"%s\" Job=%s\n"), @@ -499,6 +502,7 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); } Dmsg0(100, "dir_update_volume_info\n"); + dev->VolCatInfo.VolCatFiles = dev->file; dir_update_volume_info(jcr, dev, 0); if (dev_cap(dev, CAP_TWOEOF) && weof_dev(dev, 1) != 0) { /* end the tape */ Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg); diff --git a/bacula/src/stored/device.c b/bacula/src/stored/device.c index 0fad7a420f..eaacb8fcd4 100644 --- a/bacula/src/stored/device.c +++ b/bacula/src/stored/device.c @@ -109,6 +109,7 @@ int fixup_device_block_write_error(JCR *jcr, DEVICE *dev, DEV_BLOCK *block) bstrncpy(dev->VolCatInfo.VolCatStatus, "Full", sizeof(dev->VolCatInfo.VolCatStatus)); Dmsg2(100, "Call update_vol_info Stat=%s Vol=%s\n", dev->VolCatInfo.VolCatStatus, dev->VolCatInfo.VolCatName); + dev->VolCatInfo.VolCatFiles = dev->file; /* set number of files */ dev->VolCatInfo.VolCatJobs++; /* increment number of jobs */ if (!dir_update_volume_info(jcr, dev, 0)) { /* send Volume info to Director */ P(dev->mutex); -- 2.39.5