From f05f4e26eddf851f00b9f7d953dc26757c6ae205 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 3 Sep 2009 14:39:09 +0200 Subject: [PATCH] Use MaxFileSize device configuration in btape Make less tweaks in random buffer in btape --- bacula/src/stored/btape.c | 24 +++++++++++++----------- bacula/technotes | 2 ++ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/bacula/src/stored/btape.c b/bacula/src/stored/btape.c index afd6a41610..f375e8e67c 100644 --- a/bacula/src/stored/btape.c +++ b/bacula/src/stored/btape.c @@ -76,6 +76,7 @@ DCR *dcr; DEVRES *device = NULL; int exit_code = 0; +#define REC_SIZE 32768 /* Forward referenced subroutines */ static void do_tape_cmds(); @@ -1842,6 +1843,7 @@ static void fillcmd() char buf1[100], buf2[100]; int fd; uint32_t i; + uint64_t write_eof; uint32_t min_block_size; struct tm tm; @@ -1853,7 +1855,7 @@ static void fillcmd() BlockNumber = 0; exit_code = 0; - Pmsg0(-1, _("\n" + Pmsg1(-1, _("\n" "This command simulates Bacula writing to a tape.\n" "It requires either one or two blank tapes, which it\n" "will label and write.\n\n" @@ -1861,14 +1863,15 @@ static void fillcmd() "the tapes that are in slots 1 and 2, otherwise, you will\n" "be prompted to insert the tapes when necessary.\n\n" "It will print a status approximately\n" -"every 322 MB, and write an EOF every 3.2 GB. If you have\n" +"every 322 MB, and write an EOF every %s. If you have\n" "selected the simple test option, after writing the first tape\n" "it will rewind it and re-read the last block written.\n\n" "If you have selected the multiple tape test, when the first tape\n" "fills, it will ask for a second, and after writing a few more \n" "blocks, it will stop. Then it will begin re-reading the\n" "two tapes.\n\n" -"This may take a long time -- hours! ...\n\n")); +"This may take a long time -- hours! ...\n\n"), + edit_uint64_with_suffix(dev->max_file_size, buf1)); get_cmd(_("Do you want to run the simplified test (s) with one tape\n" "or the complete multiple tape (m) test: (s/m) ")); @@ -1890,6 +1893,7 @@ static void fillcmd() /* Use fixed block size to simplify read back */ min_block_size = dev->min_block_size; dev->min_block_size = dev->max_block_size; + write_eof = dev->max_file_size / REC_SIZE; /*compute when we add EOF*/ set_volume_name("TestVolume1", 1); dir_ask_sysop_to_create_appendable_volume(dcr); dev->set_append(); /* force volume to be relabeled */ @@ -1921,8 +1925,6 @@ static void fillcmd() memset(&rec, 0, sizeof(rec)); rec.data = get_memory(100000); /* max record size */ - -#define REC_SIZE 32768 rec.data_len = REC_SIZE; /* @@ -1961,8 +1963,8 @@ static void fillcmd() /* Mix up the data just a bit */ uint32_t *lp = (uint32_t *)rec.data; lp[0] += lp[13]; - for (i=1; i < (rec.data_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i++) { - lp[i] += lp[i-1]; + for (i=1; i < (rec.data_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i+=100) { + lp[i] += lp[0]; } Dmsg4(250, "before write_rec FI=%d SessId=%d Strm=%s len=%d\n", @@ -1996,9 +1998,9 @@ static void fillcmd() block->BlockNumber, dev->file, dev->block_num, edit_uint64_with_commas(dev->VolCatInfo.VolCatBytes, ec1), (float)kbs); } - /* Every 32000 blocks (approx 2GB) write an EOF. + /* Every X blocks (dev->max_file_size) write an EOF. */ - if ((block->BlockNumber % 32000) == 0) { + if ((block->BlockNumber % write_eof) == 0) { now = time(NULL); (void)localtime_r(&now, &tm); strftime(buf1, sizeof(buf1), "%H:%M:%S", &tm); @@ -2549,8 +2551,8 @@ static void rawfill_cmd() fflush(stdout); } p[0] += p[13]; - for (i=1; i<(block->buf_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i++) { - p[i] += p[i-1]; + for (i=1; i<(block->buf_len-sizeof(uint32_t))/sizeof(uint32_t)-1; i+=100) { + p[i] += p[0]; } continue; } diff --git a/bacula/technotes b/bacula/technotes index ce88f34648..fc0fe514cc 100644 --- a/bacula/technotes +++ b/bacula/technotes @@ -3,6 +3,8 @@ General: 03Sep09 +ebl Use MaxFileSize device configuration in btape +ebl Make less tweaks in random buffer in btape ebl Fix #1364 and #1363 about compression buffer error. 01Sep09 kes Many debug code fixes in regression scripts -- 2.39.5