X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=bacula%2Fsrc%2Fstored%2Fmount.c;h=efb76029d654fc00e9150ee54c23ea5754589972;hb=36b40d5c7f3ff90565ab73ac75f0dc4f6660ff37;hp=8b8b27bded16206ad2b5440e58ca10e6de13be78;hpb=b28eb8aae39d05b0854b1be378450d9e931a82f0;p=bacula%2Fbacula diff --git a/bacula/src/stored/mount.c b/bacula/src/stored/mount.c index 8b8b27bded..efb76029d6 100644 --- a/bacula/src/stored/mount.c +++ b/bacula/src/stored/mount.c @@ -113,7 +113,9 @@ mount_next_vol: ask = true; /* ask operator to mount tape */ do_find = true; /* re-find a volume after unload */ } - do_swapping(true /*writing*/); + do_unload(); + do_swapping(true /*is_writing*/); + do_load(true /*is_writing*/); if (do_find && !find_a_volume()) { goto no_lock_bail_out; @@ -500,12 +502,30 @@ bool DCR::is_suitable_volume_mounted() return dir_get_volume_info(this, GET_VOL_INFO_FOR_WRITE); } -void DCR::do_swapping(bool is_writing) +bool DCR::do_unload() { if (dev->must_unload()) { Dmsg1(100, "must_unload release %s\n", dev->print_name()); release_volume(); } + return false; +} + +bool DCR::do_load(bool is_writing) +{ + if (dev->must_load()) { + Dmsg1(100, "Must load %s\n", dev->print_name()); + if (autoload_device(this, is_writing, NULL) > 0) { + dev->clear_load(); + return true; + } + return false; + } + return true; +} + +void DCR::do_swapping(bool is_writing) +{ /* * See if we are asked to swap the Volume from another device * if so, unload the other device here, and attach the @@ -528,12 +548,6 @@ void DCR::do_swapping(bool is_writing) } dev->swap_dev = NULL; } - if (dev->must_load()) { - Dmsg1(100, "Must load %s\n", dev->print_name()); - if (autoload_device(this, is_writing, NULL) > 0) { - dev->clear_load(); - } - } }