]> git.sur5r.net Git - bacula/bacula/commitdiff
FSF to file on restore
authorKern Sibbald <kern@sibbald.com>
Wed, 4 Dec 2002 20:15:22 +0000 (20:15 +0000)
committerKern Sibbald <kern@sibbald.com>
Wed, 4 Dec 2002 20:15:22 +0000 (20:15 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@231 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/stored/acquire.c
bacula/src/stored/btape.c
bacula/src/stored/butil.c
bacula/src/stored/mount.c
bacula/src/stored/parse_bsr.c

index c42cb4c63b3661dd895b9e8e11e620773edd270d..7f2acd5f5a05b88f883475a4b82a7e901ef7d9b5 100644 (file)
@@ -14,23 +14,15 @@ Testing to do: (painful)
 
 
 For 1.28 release:
-- Make BSR accept count (total files to be restored).
-- Make BSR return next_block when it knows record is not
-  in block, done when count is reached, and possibly other
-  optimizations. I.e. add a state word.
-- Continue improving the restore process (handling
-  of tapes, efficiency improvements e.g. use FSF to
-  position the tape, ...)
-- Add code to fast seek to proper place on tape/file
-  when doing Restore. If it doesn't work, try linear
-  search as before.
+- Add code to put VolFile in bsr for restore command.
 - Add code to reject whole blocks if not wanted on restore.
+- Add watchdog timeout for child processes start_child_timer()
+  end_child_timer();
 
 - Figure out how to allow multiple simultaneous file Volumes on
   a single device.
 - Start working on Base jobs.
 - Implement FileOptions (see end of this document)
-- Replace popen() and pclose() -- fail safe and timeout, no SIG dep.
 - Ensure that restore of differential jobs works (check SQL).
 - Make sure the MaxVolFiles is fully implemented in SD
 - Flush all the daemon messages at the end of every job.
@@ -40,7 +32,6 @@ For 1.28 release:
 - Need return status on read_cb() from read_records(). Need multiple
   records -- one per Job, maybe a JCR or some other structure with
   a block and a record.
-- Think about how to make Bacula work better with File archives.
 
 - Work more on how to to a Bacula restore beginning with
   just a Bacula tape and a boot floppy (bare metal recovery).
@@ -113,6 +104,7 @@ For 1.28 release:
 - Handle ctl-c in Console
 - Implement LabelTemplate (at least first cut).
 - Implement script driven addition of File daemon to config files.
+- Think about how to make Bacula work better with File archives.
 
 - see setgroup and user for Bacula p4-5 of stunnel.c
 - Implement new serialize subroutines
@@ -619,3 +611,7 @@ Done: (see kernsdone for more)
 - Make Job err if WriteBootstrap fails.
 - Test that mod of restore options works.
 - Test that week position schedule code works.
+- Make BSR accept count (total files to be restored).
+- Add code to fast seek to proper place on tape/file when doing Restore.
+- Replace popen() and pclose() -- fail safe and timeout, no SIG dep.
+
index 612721160d5272bef6186cc11f7a3994741507a0..9dd7f3a5d37bbf0c7c2fd5d6f35375072c6101df 100644 (file)
@@ -41,6 +41,7 @@ int acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
 {
    int stat = 0;
    int tape_previously_mounted;
+   VOL_LIST *vol;
 
    lock_device(dev);
    block_device(dev, BST_DOING_ACQUIRE);
@@ -53,6 +54,14 @@ int acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       goto get_out;
    }
 
+   /* Find next Volume, if any */
+   vol = jcr->VolList;
+   jcr->CurVolume++;
+   for (int i=1; i<jcr->CurVolume; i++) {
+      vol = vol->next;
+   }
+   pm_strcpy(&jcr->VolumeName, vol->VolumeName);
+
    for (;;) {
       if (job_cancelled(jcr)) {
          Mmsg0(&dev->errmsg, _("Job cancelled.\n"));
@@ -72,7 +81,6 @@ int acquire_device_for_read(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
          }
           Dmsg1(129, "open_dev %s OK\n", dev_name(dev));
       }
-      /* ***FIXME*** this is probably not necessary */
       dev->state &= ~ST_LABEL;          /* force reread of label */
       Dmsg0(200, "calling read-vol-label\n");
       switch (read_dev_volume_label(jcr, dev, block)) {
@@ -114,6 +122,10 @@ default_path:
    dev->state |= ST_READ;
    attach_jcr_to_device(dev, jcr);    /* attach jcr to device */
    stat = 1;                         /* good return */
+   if ((dev->state & ST_TAPE) && vol->start_file > 0) {
+      Dmsg1(100, "====== Got start_file = %d\n", vol->start_file);
+      fsf_dev(dev, vol->start_file);
+   }
 
 get_out:
    P(dev->mutex); 
index 0a38b1b38a316addb901e06b4e77af33ffb05f4f..28f769700caca1da5df322dc68c92aa33d4c6f68 100644 (file)
@@ -944,7 +944,10 @@ static void unfillcmd()
    end_of_tape = 0;
    get_cmd("Mount first of two tapes. Press enter when ready: "); 
    
+   free_vol_list(jcr);
    pm_strcpy(&jcr->VolumeName, "TestVolume1");
+   jcr->bsr = NULL;
+   create_vol_list(jcr);
    close_dev(dev);
    dev->state &= ~ST_READ;
    if (!acquire_device_for_read(jcr, dev, block)) {
@@ -1259,7 +1262,11 @@ static int my_mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       end_of_tape = 1;
       return 0;
    }
+
+   free_vol_list(jcr);
    pm_strcpy(&jcr->VolumeName, "TestVolume2");
+   jcr->bsr = NULL;
+   create_vol_list(jcr);
    close_dev(dev);
    dev->state &= ~ST_READ; 
    if (!acquire_device_for_read(jcr, dev, block)) {
index e27f52c97336b8f682510e875478b42af37efcf8..318408428ab6d22dc5e3da0f09645413ee140374 100644 (file)
@@ -104,7 +104,6 @@ DEVICE *setup_to_access_device(JCR *jcr, int read_access)
 
    create_vol_list(jcr);
 
-   Dmsg1(100, "Volume=%s\n", jcr->VolumeName);
    if (read_access) {
       if (!acquire_device_for_read(jcr, dev, block)) {
         Emsg0(M_ERROR, 0, dev->errmsg);
index e32579ad0c007f5271c9ac220a75cc19d6853746..1a88f1ea7de4f93aeea236e9a7653ba2dfe1c89a 100644 (file)
@@ -342,15 +342,6 @@ int mount_next_read_volume(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
     * End Of Tape -- mount next Volume (if another specified)
     */
    if (jcr->NumVolumes > 1 && jcr->CurVolume < jcr->NumVolumes) {
-      VOL_LIST *vol = jcr->VolList;
-      /* Find next Volume */
-      jcr->CurVolume++;
-      for (int i=1; i<jcr->CurVolume; i++) {
-        vol = vol->next;
-      }
-      pm_strcpy(&jcr->VolumeName, vol->VolumeName);
-      Dmsg1(400, "There is another volume %s.\n", jcr->VolumeName);
-
       close_dev(dev);
       dev->state &= ~ST_READ; 
       if (!acquire_device_for_read(jcr, dev, block)) {
index 553854985f48cb78b51004bcead61c0727c26579..3cc924e8c0bbc60849bc93a9b968ca8b041c399f 100755 (executable)
@@ -720,6 +720,10 @@ void free_vol_list(JCR *jcr)
    jcr->VolList = NULL;
 }
 
+/*
+ * Create a list of Volumes (and Slots and Start positions) to be
+ *  used in the current restore job.
+ */
 void create_vol_list(JCR *jcr)
 {
    char *p, *n;
@@ -729,17 +733,16 @@ void create_vol_list(JCR *jcr)
     * Build a list of volumes to be processed
     */
    jcr->NumVolumes = 0;
-   jcr->CurVolume = 1;
+   jcr->CurVolume = 0;
    if (jcr->bsr) {
       BSR *bsr = jcr->bsr;
       if (!bsr->volume || !bsr->volume->VolumeName) {
         return;
       }
-      strcpy(jcr->VolumeName, bsr->volume->VolumeName); /* setup first volume */
       for ( ; bsr; bsr=bsr->next) {
         BSR_VOLUME *bsrvol;
         BSR_VOLFILE *volfile;
-        uint32_t sfile = 0;
+        uint32_t sfile = UINT32_MAX;
 
         /* Find minimum start file so that we can forward space to it */
         for (volfile = bsr->volfile; volfile; volfile=volfile->next) {