]> git.sur5r.net Git - bacula/bacula/commitdiff
kes Experiment with allowing multiple read jobs.
authorKern Sibbald <kern@sibbald.com>
Wed, 16 Apr 2008 07:29:09 +0000 (07:29 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 16 Apr 2008 07:29:09 +0000 (07:29 +0000)
kes  Move final volume swapping code to DCR method and
     call it from acquire_for_read().
kes  When wrong volume is mounted during read, unload_autochanger.

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

bacula/src/dird/jobq.c
bacula/src/stored/acquire.c
bacula/src/stored/dev.h
bacula/src/stored/mount.c
bacula/src/version.h
bacula/technotes-2.3

index f9f91515a81bbd161005e4c8f8c909b02fde6074..26a3316d6e4904401dc2c89c00d50bd30b89ed00 100644 (file)
@@ -684,18 +684,10 @@ static bool acquire_resources(JCR *jcr)
    }
    if (jcr->rstore) {
       Dmsg1(200, "Rstore=%s\n", jcr->rstore->name());
-      if (jcr->rstore->NumConcurrentReadJobs == 0 &&
-          jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) {
-         /* Simple case, first job */
-         jcr->rstore->NumConcurrentReadJobs = 1;
+      if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) {
+         jcr->rstore->NumConcurrentReadJobs++;
          jcr->rstore->NumConcurrentJobs++;
-         Dmsg0(200, "Set rncj=1\n");
-      /* We can do this only if multi-drive autochanger */
-//    } else if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs
-//       && jcr->rstore->NumConcurrentReadJobs < jcr->rstore->MaxConcurrentReadJobs) {
-//       jcr->rstore->NumConcurrentReadJobs++;
-//       jcr->rstore->NumConcurrentJobs++;
-//       Dmsg1(200, "Inc rncj=%d\n", jcr->rstore->NumConcurrentJobs);
+         Dmsg1(200, "Inc rncj=%d\n", jcr->rstore->NumConcurrentJobs);
       } else {
          Dmsg1(200, "Fail rncj=%d\n", jcr->rstore->NumConcurrentJobs);
          set_jcr_job_status(jcr, JS_WaitStoreRes);
@@ -705,12 +697,7 @@ static bool acquire_resources(JCR *jcr)
    
    if (jcr->wstore) {
       Dmsg1(200, "Wstore=%s\n", jcr->wstore->name());
-      if (jcr->wstore->NumConcurrentJobs == 0 &&
-          jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
-         /* Simple case, first job */
-         jcr->wstore->NumConcurrentJobs = 1;
-         Dmsg0(200, "Set wncj=1\n");
-      } else if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
+      if (jcr->wstore->NumConcurrentJobs < jcr->wstore->MaxConcurrentJobs) {
          jcr->wstore->NumConcurrentJobs++;
          Dmsg1(200, "Inc wncj=%d\n", jcr->wstore->NumConcurrentJobs);
       } else if (jcr->rstore) {
index 16d77130aee7a1f6d4b49e42029d2a53028f83ca..5733a4b80386a149683bee959dc3e6f6ca0a405d 100644 (file)
@@ -192,6 +192,8 @@ bool acquire_device_for_read(DCR *dcr)
          goto get_out;                /* error return */
       }
 
+      dcr->do_swapping();
+
       autoload_device(dcr, 0, NULL);
 
       /*
@@ -236,6 +238,7 @@ bool acquire_device_for_read(DCR *dcr)
          } else {
              bstrncpy(dev->BadVolName, dev->VolHdr.VolumeName, sizeof(dev->BadVolName));
          }
+         unload_autochanger(dcr, -1);
          /* Fall through */
       default:
          Jmsg1(jcr, M_WARNING, 0, "%s", jcr->errmsg);
index a8f7bdf84e905128a64f75848a6b8e39d137b72b..619460ef1d028b9b636ab207dd22861072ee3792 100644 (file)
@@ -533,6 +533,7 @@ public:
    bool is_eod_valid();
    int check_volume_label(bool &ask, bool &autochanger);
    void release_volume();
+   void do_swapping();
 };
 
 /*
index 38db3c7e155db139a5abf260099e1955ea5f69af..5b22b3fa6cf38821331e9b764a7d2cdb025a4887 100644 (file)
@@ -102,34 +102,12 @@ mount_next_vol:
       goto bail_out;
    }
    recycle = false;
+
    if (dev->must_unload()) {
-      Dmsg0(150, "mount_next_volume release=1\n");
-      unload_autochanger(dcr, -1);
-      release_volume();
-      dev->clear_unload();
       ask = true;                     /* ask operator to mount tape */
    }
-   /*
-    * See if we are asked to swap the Volume from another device
-    *  if so, unload the other device here, and attach the
-    *  volume to our drive.
-    */
-   if (dev->swap_dev) {
-      Dmsg1(100, "Swap unloading %s\n", dev->swap_dev->print_name());
-      if (dev->swap_dev->must_unload()) {
-         unload_dev(dcr, dev->swap_dev);
-      }
-      if (dev->vol) {
-         dev->vol->clear_swapping();
-         dev->vol->set_in_use();
-         dev->VolHdr.VolumeName[0] = 0;  /* don't yet have right Volume */
-      }
-      dev->swap_dev = NULL;
-   }
-   if (dev->must_load()) {
-      dev->clear_load();
-      dev->clear_volhdr();               /* force "load" */
-   }
+   do_swapping();
+
    if (!is_suitable_volume_mounted()) {
       bool have_vol = false;
       /* Do we have a candidate volume? */
@@ -492,6 +470,36 @@ bool DCR::is_suitable_volume_mounted()
    return dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE);
 }
 
+void DCR::do_swapping()
+{
+   if (dev->must_unload()) {
+      Dmsg0(150, "mount_next_volume release=1\n");
+      unload_autochanger(this, -1);
+      release_volume();
+      dev->clear_unload();
+   }
+   /*
+    * See if we are asked to swap the Volume from another device
+    *  if so, unload the other device here, and attach the
+    *  volume to our drive.
+    */
+   if (dev->swap_dev) {
+      Dmsg1(100, "Swap unloading %s\n", dev->swap_dev->print_name());
+      if (dev->swap_dev->must_unload()) {
+         unload_dev(this, dev->swap_dev);
+      }
+      if (dev->vol) {
+         dev->vol->clear_swapping();
+         dev->vol->set_in_use();
+         dev->VolHdr.VolumeName[0] = 0;  /* don't yet have right Volume */
+      }
+      dev->swap_dev = NULL;
+   }
+   if (dev->must_load()) {
+      dev->clear_load();
+      dev->clear_volhdr();               /* force "load" */
+   }
+}
 
 
 /*
index 8f1be54b822b160248d11ab84d81fd4e1db29bf2..938d63051a8656182575d7e01da74ff83ca26c9a 100644 (file)
@@ -4,8 +4,8 @@
 
 #undef  VERSION
 #define VERSION "2.3.18"
-#define BDATE   "12 April 2008"
-#define LSMDATE "12Apr08"
+#define BDATE   "16 April 2008"
+#define LSMDATE "16Apr08"
 
 #define PROG_COPYRIGHT "Copyright (C) %d-2008 Free Software Foundation Europe e.V.\n"
 #define BYEAR "2008"       /* year for copyright messages in progs */
index e10616080bfa2f76c7b87aecab751e6a269e20cc..6940c2f8d8c974ce06ad3ed562fc0a50ec577be6 100644 (file)
@@ -24,6 +24,11 @@ Add long term statistics job table
 
 
 General:
+16Apr08
+kes  Experiment with allowing multiple read jobs.
+kes  Move final volume swapping code to DCR method and
+     call it from acquire_for_read().
+kes  When wrong volume is mounted during read, unload_autochanger.
 15Apr08
 kes  Integrate the libdbi changes from Joao Henrique Freitas
 14Apr08