]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/dird/next_vol.c
- Apply Mike Acar's suggestion when looking for the next volume
[bacula/bacula] / bacula / src / dird / next_vol.c
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);
+              }
            }
         }