]> git.sur5r.net Git - bacula/bacula/commitdiff
- Apply Mike Acar's suggestion when looking for the next volume
authorKern Sibbald <kern@sibbald.com>
Fri, 3 Sep 2004 17:14:54 +0000 (17:14 +0000)
committerKern Sibbald <kern@sibbald.com>
Fri, 3 Sep 2004 17:14:54 +0000 (17:14 +0000)
  to check purged volumes for recycling before doing a purge.
- Make some improvements to CDROM disk.
- Take another crack at ignoring drive open() errors during
  polling.

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1579 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/dird/next_vol.c
bacula/src/stored/device.c
bacula/src/stored/protos.h
bacula/src/version.h

index 687d85cdf872b5b9ba18d4dabff1280a6e7e91f0..0f95284cb04beea8476e4dbc9381f42dab7ed4cc 100644 (file)
@@ -72,23 +72,29 @@ int find_next_volume_for_append(JCR *jcr, MEDIA_DBR *mr, bool create)
         ok = find_recycled_volume(jcr, InChanger, mr);
          Dmsg2(100, "find_recycled_volume %d FW=%d\n", ok, mr->FirstWritten);
         if (!ok) {
-           /*
-            * 3. Try pruning Volumes
+           /* 
+            * 3. Try recycling any purged volume
             */
-           prune_volumes(jcr);  
            ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
-           if (InChanger) {
-              InChanger = false;
-              if (!ok) {
-                 continue;           /* retry again accepting any volume */
-              }
-           }
-            Dmsg2(200, "find_recycled_volume2 %d FW=%d\n", ok, mr->FirstWritten);
-           if (!ok && create) {
+           if (!ok) {
               /*
-                * 4. Try "creating" a new Volume
+               * 4. Try pruning Volumes
                */
-              ok = newVolume(jcr, mr);
+              prune_volumes(jcr);  
+              ok = recycle_oldest_purged_volume(jcr, InChanger, mr);
+              if (InChanger) {
+                 InChanger = false;
+                 if (!ok) {
+                    continue;           /* retry again accepting any volume */
+                 }
+              }
+               Dmsg2(200, "find_recycled_volume2 %d FW=%d\n", ok, mr->FirstWritten);
+              if (!ok && create) {
+                 /*
+                   * 5. Try "creating" a new Volume
+                  */
+                 ok = newVolume(jcr, mr);
+              }
            }
         }
 
index 795119542226a9c6e617817d6336f351f8f27b9a..8b4f39be4d5110b3ad47fbcca908d0f3c20d9f97 100644 (file)
@@ -260,14 +260,14 @@ void set_new_file_parameters(DCR *dcr)
  *    that we can get the filename; the device_name for
  *    a file is the directory only. 
  *
- *   Retuns: 0 on failure
- *          1 on success
+ *   Returns: false on failure
+ *           true  on success
  */
-int first_open_device(DEVICE *dev)
+bool first_open_device(DEVICE *dev)
 {
    Dmsg0(120, "start open_output_device()\n");
    if (!dev) {
-      return 0;
+      return false;
    }
 
    lock_device(dev);
@@ -276,7 +276,7 @@ int first_open_device(DEVICE *dev)
    if (!dev_is_tape(dev)) {
       Dmsg0(129, "Device is file, deferring open.\n");
       unlock_device(dev);
-      return 1;
+      return true;
    }
 
    if (!(dev->state & ST_OPENED)) {
@@ -290,19 +290,19 @@ int first_open_device(DEVICE *dev)
       if (open_dev(dev, NULL, mode) < 0) {
          Emsg1(M_FATAL, 0, _("dev open failed: %s\n"), dev->errmsg);
         unlock_device(dev);
-        return 0;
+        return false;
       }
    }
    Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
 
    unlock_device(dev);
-   return 1;
+   return true;
 }
 
 /* 
  * Make sure device is open, if not do so 
  */
-int open_device(JCR *jcr, DEVICE *dev)
+bool open_device(JCR *jcr, DEVICE *dev)
 {
    /* Open device */
    if  (!(dev_state(dev, ST_OPENED))) {
@@ -313,12 +313,15 @@ int open_device(JCR *jcr, DEVICE *dev)
          mode = OPEN_READ_WRITE;
        }
        if (open_dev(dev, jcr->VolCatInfo.VolCatName, mode) < 0) {
-          Jmsg2(jcr, M_FATAL, 0, _("Unable to open device %s. ERR=%s\n"), 
-            dev_name(dev), strerror_dev(dev));
-         return 0;
+         /* If polling, ignore the error */
+         if (!dev->poll) {
+             Jmsg2(jcr, M_FATAL, 0, _("Unable to open device %s. ERR=%s\n"), 
+               dev_name(dev), strerror_dev(dev));
+         }
+         return false;
        }
    }
-   return 1;
+   return true;
 }
 
 void dev_lock(DEVICE *dev)
index e8aacfd71464e22d995bd85dc2fe478a8f7d0c42..6898968a29311199d8f2627c68c9e2d6e6c16dc3 100644 (file)
@@ -119,8 +119,8 @@ uint32_t dev_file(DEVICE *dev);
 bool     dev_is_tape(DEVICE *dev);
 
 /* From device.c */
-int      open_device(JCR *jcr, DEVICE *dev);
-int      first_open_device(DEVICE *dev);
+bool     open_device(JCR *jcr, DEVICE *dev);
+bool     first_open_device(DEVICE *dev);
 bool     fixup_device_block_write_error(DCR *dcr, DEV_BLOCK *block);
 void     _lock_device(const char *file, int line, DEVICE *dev);
 void     _unlock_device(const char *file, int line, DEVICE *dev);
index d14993f0c198bf29628a221d44bda004db4ec0c9..81a4f94f2fccfd7f422edd8aa8e63a31b91e4450 100644 (file)
@@ -1,8 +1,8 @@
 /* */
 #undef  VERSION
 #define VERSION "1.35.3"
-#define BDATE   "02 September 2004"
-#define LSMDATE "02Sep04"
+#define BDATE   "03 September 2004"
+#define LSMDATE "03Sep04"
 
 /* Debug flags */
 #undef  DEBUG