Dmsg1(100, "Walk attached jcrs. Volume=%s\n", dev->VolCatInfo.VolCatName);
for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
Dmsg1(100, "create JobMedia for Job %s\n", mjcr->Job);
- mjcr->end_block = dev->block_num;
- mjcr->end_file = dev->file;
+ if (dev->state & ST_TAPE) {
+ mjcr->EndBlock = dev->EndBlock;
+ mjcr->EndFile = dev->EndFile;
+ Dmsg2(200, "Fixup EndFile=%u EndBlock=%u\n", mjcr->EndFile, mjcr->EndBlock);
+ } else {
+ mjcr->EndBlock = (uint32_t)dev->file_addr;
+ mjcr->EndFile = (uint32_t)(dev->file_addr >> 32);
+ }
if (!dir_create_jobmedia_record(mjcr)) {
Jmsg(mjcr, M_ERROR, 0, _("Could not create JobMedia record for Volume=%s Job=%s\n"),
dev->VolCatInfo.VolCatName, mjcr->Job);
unblock_device(dev);
return 0; /* device locked */
}
- Dmsg0(190, "Back from update_vol_info\n");
+ Dmsg0(100, "Back from update_vol_info\n");
strcpy(PrevVolName, dev->VolCatInfo.VolCatName);
strcpy(dev->VolHdr.PrevVolName, PrevVolName);
* empty label_blk, and nothing will be written.
*/
Dmsg0(190, "write label block to dev\n");
- if (!write_block_to_dev(dev, label_blk)) {
+ if (!write_block_to_dev(jcr, dev, label_blk)) {
Pmsg1(0, "write_block_to_device Volume label failed. ERR=%s",
strerror_dev(dev));
free_block(label_blk);
/* Write overflow block to tape */
Dmsg0(190, "Write overflow block to dev\n");
- if (!write_block_to_dev(dev, block)) {
+ if (!write_block_to_dev(jcr, dev, block)) {
Pmsg1(0, "write_block_to_device overflow block failed. ERR=%s",
strerror_dev(dev));
free_block(label_blk);
free_block(label_blk);
for (JCR *mjcr=NULL; (mjcr=next_attached_jcr(dev, mjcr)); ) {
/* Set new start/end positions */
- mjcr->start_block = dev->block_num;
- mjcr->start_file = dev->file;
+ if (dev->state & ST_TAPE) {
+ mjcr->StartBlock = dev->block_num;
+ mjcr->StartFile = dev->file;
+ } else {
+ mjcr->StartBlock = (uint32_t)dev->file_addr;
+ mjcr->StartFile = (uint32_t)(dev->file_addr >> 32);
+ }
mjcr->VolFirstFile = mjcr->JobFiles;
mjcr->run_time += time(NULL) - wait_time; /* correct run time */
}
dev->no_wait_id = pthread_self(); /* allow us to continue */
}
+
+
/*
* Unblock the device, and wake up anyone who went to sleep.
*/