]> git.sur5r.net Git - bacula/bacula/commitdiff
Minor change to Maximum File Size
authorKern Sibbald <kern@sibbald.com>
Sat, 8 Mar 2003 14:56:06 +0000 (14:56 +0000)
committerKern Sibbald <kern@sibbald.com>
Sat, 8 Mar 2003 14:56:06 +0000 (14:56 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@373 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/src/stored/block.c
bacula/src/stored/dev.c

index 65acac6ea06120aa9adba6f2cab6dbd0e0578079..3faa66eb0c41a855dccb6ce2828b0ecbee7266ee 100644 (file)
@@ -362,6 +362,17 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
       return 0;
    }
 
+   /* Limit maximum File size on volume to user specified value */
+   if (dev->state & ST_TAPE) {
+      if ((dev->max_file_size > 0) && 
+         (dev->file_addr+block->binbuf) >= dev->max_file_size) {
+        if (weof_dev(dev, 1) != 0) {            /* write eof */
+            Jmsg(jcr, M_ERROR, 0, "%s", dev->errmsg);
+           /* Plunge on anyway -- if tape is bad we will die on write */
+        }
+      }
+   }
+
    dev->VolCatInfo.VolCatWrites++;
    Dmsg1(500, "Write block of %u bytes\n", wlen);      
    if ((uint32_t)(stat=write(dev->fd, block->buf, (size_t)wlen)) != wlen) {
@@ -436,16 +447,10 @@ int write_block_to_dev(JCR *jcr, DEVICE *dev, DEV_BLOCK *block)
    dev->file_addr += wlen;
    dev->EndBlock = dev->block_num;
    dev->EndFile  = dev->file;
-
-   /* Limit maximum File size on volume to user specified value */
-   if (dev->state & ST_TAPE) {
-      if ((dev->max_file_size > 0) && dev->file_addr >= dev->max_file_size) {
-        weof_dev(dev, 1);               /* write eof */
-      }
-   }
-
    dev->block_num++;
    block->BlockNumber++;
+
+
    Dmsg2(190, "write_block: wrote block %d bytes=%d\n", dev->block_num,
       wlen);
    empty_block(block);
index e19032544d6251c6092e8edbf9a52f437bbdeef8..ac112d5e7cc18afc9298f7eec50740ab4a05b593 100644 (file)
@@ -885,6 +885,8 @@ bsr_dev(DEVICE *dev, int num)
 
 /*
  * Write an end of file on the device
+ *   Returns: 0 on success
+ *           non-zero on failure
  */
 int 
 weof_dev(DEVICE *dev, int num)