     }
     return 0;
  }
+@@ -733,3 +770,48 @@
+    }
+    return 0;
+ }
++
++uint64_t get_bsr_start_addr(BSR *bsr, uint32_t *file, uint32_t *block)
++{
++   uint64_t bsr_addr = 0;
++   uint32_t sfile = 0, sblock = 0;
++
++   if (bsr) {
++      if (bsr->voladdr) {
++         bsr_addr = bsr->voladdr->saddr;
++         sfile = bsr_addr>>32;
++         sblock = (uint32_t)bsr_addr;
++         
++      } else if (bsr->volfile && bsr->volblock) {
++         bsr_addr = (((uint64_t)bsr->volfile->sfile)<<32)|bsr->volblock->sblock;
++         sfile = bsr->volfile->sfile;
++         sblock = bsr->volblock->sblock;
++      }
++   }
++
++   if (file && block) {
++      file = sfile;
++      block = sblock;
++   }
++
++   return bsr_addr;
++}
++
++/* DEV > BSR => 1
++ * DEV = BSR => 0
++ * DEV < BSR => -1
++ */
++int cmp_device_bsr_position(DEVICE *dev, BSR *bsr)
++{
++   uint64_t bsr_addr = get_bsr_start_addr(bsr);
++
++   /* TODO: replace by file_addr ? */
++   uint64_t dev_addr = ((uint64_t dev->file)<<32) | dev->block_num;
++
++   if (dev_addr > bsr_addr)
++      return 1;
++   else if (dev_addr == bsr_addr)
++      return 0;
++   else
++      return -1;
++}
+Index: src/stored/read_record.c
+===================================================================
+--- src/stored/read_record.c	(revision 8163)
++++ src/stored/read_record.c	(working copy)
+@@ -344,19 +344,21 @@
+        *   when find_next_bsr() is fixed not to return a bsr already
+        *   completed.
+        */
+-      if (dev->file > bsr->volfile->sfile ||             
+-         (dev->file == bsr->volfile->sfile && dev->block_num > bsr->volblock->sblock)) {
++      uint32_t block, file;
++      /* TODO: use dev->file_addr ? */
++      uint64_t dev_addr = ((uint64_t dev->file)<<32) | dev->block_num;
++      uint64_t bsr_addr = get_bsr_start_addr(bsr, &file, &block);
++
++      if (dev_addr > bsr_addr) {
+          return false;
+       }
+       if (verbose) {
+-         Jmsg(jcr, M_INFO, 0, _("Reposition from (file:block) %u:%u to %u:%u\n"),
+-            dev->file, dev->block_num, bsr->volfile->sfile,
+-            bsr->volblock->sblock);
++         Jmsg(jcr, M_INFO,0, _("Reposition from (file:block) %u:%u to %u:%u\n"),
++              dev->file, dev->block_num, file, block);
+       }
+       Dmsg4(10, "Try_Reposition from (file:block) %u:%u to %u:%u\n",
+-            dev->file, dev->block_num, bsr->volfile->sfile,
+-            bsr->volblock->sblock);
+-      dev->reposition(dcr, bsr->volfile->sfile, bsr->volblock->sblock);
++            dev->file, dev->block_num, file, block);
++      dev->reposition(dcr, file, block);
+       rec->Block = 0;
+    }
+    return false;
+@@ -369,6 +371,7 @@
+ {
+    BSR *bsr = NULL;
+    DEVICE *dev = dcr->dev;
++   uint32_t file, block;
+    /*
+     * Now find and position to first file and block
+     *   on this tape.
+@@ -376,11 +379,11 @@
+    if (jcr->bsr) {
+       jcr->bsr->reposition = true;    /* force repositioning */
+       bsr = find_next_bsr(jcr->bsr, dev);
+-      if (bsr && (bsr->volfile->sfile != 0 || bsr->volblock->sblock != 0)) {
++      
++      if (get_bsr_start_addr(bsr, &file, &block) > 0) {
+          Jmsg(jcr, M_INFO, 0, _("Forward spacing Volume \"%s\" to file:block %u:%u.\n"),
+-            dev->VolHdr.VolumeName,
+-            bsr->volfile->sfile, bsr->volblock->sblock);
+-         dev->reposition(dcr, bsr->volfile->sfile, bsr->volblock->sblock);
++              dev->VolHdr.VolumeName, file, block);
++         dev->reposition(dcr, file, block);
+       }
+    }
+    return bsr;
 Index: src/stored/parse_bsr.c
 ===================================================================
---- src/stored/parse_bsr.c	(révision 8163)
-+++ src/stored/parse_bsr.c	(copie de travail)
+--- src/stored/parse_bsr.c	(revision 8163)
++++ src/stored/parse_bsr.c	(working copy)
 @@ -52,6 +52,7 @@
  static BSR *store_sessid(LEX *lc, BSR *bsr);
  static BSR *store_volfile(LEX *lc, BSR *bsr);

 };
Index: src/cats/sql_get.c
===================================================================
--- src/cats/sql_get.c	(révision 8163)
+++ src/cats/sql_get.c	(copie de travail)
@@ -463,6 +463,8 @@
                Vols[i].EndFile = str_to_uint64(row[5]);
                Vols[i].StartBlock = str_to_uint64(row[6]);

                StorageId = str_to_uint64(row[10]);
Index: src/stored/match_bsr.c
===================================================================
--- src/stored/match_bsr.c	(revision 8174)
+++ src/stored/match_bsr.c	(working copy)
@@ -36,15 +36,6 @@
 
 /*
