unlock_volumes();
Dmsg3(100, "%d writers, %d reserve, dev=%s\n", dev->num_writers, dev->num_reserved(),
dev->print_name());
- debug_list_volumes("acquire:release_device()");
/* If no writers, close if file or !CAP_ALWAYS_OPEN */
* 2. dlock() simple mutex that locks the device structure. A dlock
* can be acquired while a device is blocked if it is not
* locked.
- * 3. r_dlock "recursive" dlock, when means that a dlock (mutex)
+ * 3. r_dlock(locked) "recursive" dlock, when means that a dlock (mutex)
* will be acquired on the device if it is not blocked
* by some other thread. If the device was blocked by
* the current thread, it will acquire the lock.
* If some other thread has set a block on the device,
* this call will wait until the device is unblocked.
+ * Can be called with locked true, which means the
+ * dlock is already set
*
* A lock is normally set when modifying the device structure.
* A r_lock is normally acquired when you want to block the device
* DEVICE::dlock() does P(m_mutex) (in dev.h)
* DEVICE::dunlock() does V(m_mutex)
*
- * DEVICE::r_dlock() allows locking the device when this thread
- already has the device blocked.
- * dlock()
+ * DEVICE::r_dlock(locked) allows locking the device when this thread
+ * already has the device blocked.
+ * if (!locked)
+ * dlock()
* if blocked and not same thread that locked
* pthread_cond_wait
* leaves device locked
void free_volume_lists();
void list_volumes(void sendit(const char *msg, int len, void *sarg), void *arg);
bool is_volume_in_use(DCR *dcr);
-void debug_list_volumes(const char *imsg);
extern int vol_list_lock_count;
void add_read_volume(JCR *jcr, const char *VolumeName);
void remove_read_volume(JCR *jcr, const char *VolumeName);
/* Forward referenced functions */
static void free_vol_item(VOLRES *vol);
static VOLRES *new_vol_item(DCR *dcr, const char *VolumeName);
+static void debug_list_volumes(const char *imsg);
/*
* For append volumes the key is the VolumeName.
debug_nolock = false
};
-void debug_list_volumes(const char *imsg)
+static void debug_list_volumes(const char *imsg)
{
VOLRES *vol;
POOL_MEM msg(PM_MESSAGE);