/*
Bacula® - The Network Backup Solution
- Copyright (C) 2000-2007 Free Software Foundation Europe e.V.
+ Copyright (C) 2000-2008 Free Software Foundation Europe e.V.
The main author of Bacula is Kern Sibbald, with contributions from
many others, a complete list can be found in the file AUTHORS.
return strcmp(((VOLRES *)item1)->vol_name, ((VOLRES *)item2)->vol_name);
}
-
+/*
+ * This allows a given thread to recursively call lock_reservations.
+ * It must, of course, call unlock_... the same number of times.
+ */
void init_reservations_lock()
{
int errstat;
int vol_list_lock_count = 0;
+/*
+ * This allows a given thread to recursively call to lock_volumes()
+ */
void _lock_volumes()
{
int errstat;
Dmsg1(dbglvl, "OK, vol=%s on device.\n", VolumeName);
goto get_out; /* Volume already on this device */
} else {
+ /* Don't release a volume if it is in use */
+ if (!vol->released) {
+ vol = NULL; /* vol in use */
+ goto get_out;
+ }
Dmsg2(dbglvl, "reserve_vol free vol=%s at %p\n", vol->vol_name, vol->vol_name);
unload_autochanger(dcr, -1); /* unload the volume */
free_volume(dev);
/*
* Switch from current device to given device
+ * (not yet used)
*/
void switch_device(DCR *dcr, DEVICE *dev)
{
/*
* Free a Volume from the Volume list if it is no longer used
+ * Note, for tape drives we want to remember where the Volume
+ * was when last used, so rather than free the volume entry,
+ * we simply mark it "released" so when the drive is really
+ * needed for another volume, we can reuse it.
*
- * Returns: true if the Volume found and removed from the list
+ * Returns: true if the Volume found and "removed" from the list
* false if the Volume is not in the list or is in use
*/
bool volume_unused(DCR *dcr)
}
/*
- * Unconditionally release the volume
+ * Unconditionally release the volume entry
*/
bool free_volume(DEVICE *dev)
{
free_volume_list(); /* release temp_vol_list */
vol_list = save_vol_list;
Dmsg0(dbglvl, "deleted temp vol list\n");
- Dmsg0(dbglvl, "lock volumes\n");
+ Dmsg0(dbglvl, "unlock volumes\n");
unlock_volumes();
+ debug_list_volumes("=== After free temp table\n");
}
if (ok) {
Dmsg1(dbglvl, "got vol %s from in-use vols list\n", rctx.VolumeName);