From: Kern Sibbald Date: Sat, 8 Mar 2003 14:56:06 +0000 (+0000) Subject: Minor change to Maximum File Size X-Git-Tag: Release-1.30~94 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=368588bc390946afd45fae7d41ba1fff1269f097;p=bacula%2Fbacula Minor change to Maximum File Size git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@373 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/stored/block.c b/bacula/src/stored/block.c index 65acac6ea0..3faa66eb0c 100644 --- a/bacula/src/stored/block.c +++ b/bacula/src/stored/block.c @@ -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); diff --git a/bacula/src/stored/dev.c b/bacula/src/stored/dev.c index e19032544d..ac112d5e7c 100644 --- a/bacula/src/stored/dev.c +++ b/bacula/src/stored/dev.c @@ -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)