{
JCR *jcr = dcr->jcr;
BSOCK *dir = jcr->dir_bsock;
- bool found = false;
Dmsg2(200, "dir_find_next_appendable_volume: reserved=%d Vol=%s\n",
dcr->reserved_device, dcr->VolumeName);
/*
- * Try the twenty oldest or most available volumes. Note,
+ * Try the fourty oldest or most available volumes. Note,
* the most available could already be mounted on another
* drive, so we continue looking for a not in use Volume.
*/
lock_reservations();
P(vol_info_mutex);
dcr->volume_in_use = false;
- for (int vol_index=1; vol_index < 20; vol_index++) {
+ for (int vol_index=1; vol_index < 40; vol_index++) {
bash_spaces(dcr->media_type);
bash_spaces(dcr->pool_name);
dir->fsend(Find_media, jcr->Job, vol_index, dcr->pool_name, dcr->media_type);
bool ok = do_get_volume_info(dcr);
if (ok) {
if (!is_volume_in_use(dcr)) {
- found = true;
- break;
+ Dmsg0(400, "dir_find_next_appendable_volume return true\n");
+ if (reserve_volume(dcr, dcr->VolumeName) == 0) {
+ Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
+ dcr->dev->print_name());
+ continue;
+ }
+ V(vol_info_mutex);
+ unlock_reservations();
+ return true;
} else {
Dmsg1(100, "Volume %s is in use.\n", dcr->VolumeName);
dcr->volume_in_use = true;
continue;
}
- } else {
- Dmsg2(100, "No vol. index %d return false. dev=%s\n", vol_index,
- dcr->dev->print_name());
- found = false;
- break;
}
- }
- if (found) {
- Dmsg0(400, "dir_find_next_appendable_volume return true\n");
- if (reserve_volume(dcr, dcr->VolumeName) == 0) {
- Dmsg2(100, "Could not reserve volume %s on %s\n", dcr->VolumeName,
- dcr->dev->print_name());
- goto bail_out;
- }
- V(vol_info_mutex);
- unlock_reservations();
- return true;
+ Dmsg2(100, "No vol. index %d return false. dev=%s\n", vol_index,
+ dcr->dev->print_name());
+ break;
}
-bail_out:
dcr->VolumeName[0] = 0;
V(vol_info_mutex);
unlock_reservations();
return false;
}
Dmsg1(100, "Someone woke me for device %s\n", dev->print_name());
- break;
}
set_jcr_job_status(jcr, JS_Running);
dir_send_job_status(jcr);