dcr->is_reserved(), dcr->VolumeName, nb_retry);
Mmsg(jcr->errmsg, "Unknown error\n");
+ bool can_create = !dcr->dev->is_fs_nearly_full(dcr->dev->min_free_space);
+
/*
* Try the thirty oldest or most available volumes. Note,
* the most available could already be mounted on another
lastVolume[0] = 0;
for (int vol_index=1; vol_index < nb_retry; vol_index++) {
/* Have we still some space to create a new volume? */
- bool can_create = dcr->dev->is_nospace()==false;
bash_spaces(dcr->media_type);
bash_spaces(dcr->pool_name);
dir->fsend(Find_media, jcr->JobId, vol_index, dcr->pool_name, dcr->media_type,
/* Get freespace values */
void DEVICE::get_freespace(uint64_t *freeval, uint64_t *totalval)
{
- get_os_device_freespace();
- P(freespace_mutex);
- if (is_freespace_ok()) {
- *freeval = free_space;
- *totalval = total_space;
- } else {
- *freeval = *totalval = 0;
+ if (get_os_device_freespace()) {
+ P(freespace_mutex);
+ if (is_freespace_ok()) {
+ *freeval = free_space;
+ *totalval = total_space;
+ } else {
+ *freeval = *totalval = 0;
+ }
+ V(freespace_mutex);
}
- V(freespace_mutex);
}
/* Set freespace values */
*/
bool DEVICE::is_fs_nearly_full(uint64_t threshold)
{
- uint64_t freeval, totalval;
- if (is_file()) {
- get_freespace(&freeval, &totalval);
- if (totalval > 0) {
- if (freeval < threshold) {
- return true;
- }
- }
- }
return false;
}
*/
bool DEVICE::get_os_device_freespace()
{
- int64_t freespace, totalspace;
-
- if (!is_file()) {
- return true;
- }
- if (fs_get_free_space(dev_name, &freespace, &totalspace) == 0) {
- set_freespace(freespace, totalspace, 0, true);
- Mmsg(errmsg, "");
- return true;
-
- } else {
- set_freespace(0, 0, 0, false); /* No valid freespace */
- }
return false;
}
};
void get_freespace(uint64_t *freeval, uint64_t *totalval); /* in dev.c */
void set_freespace(uint64_t freeval, uint64_t totalval, int errnoval, bool valid); /* in dev.c */
- bool is_fs_nearly_full(uint64_t threshold);
+ virtual bool is_fs_nearly_full(uint64_t threshold);
bool is_volume_to_unload() const { \
return m_unload && strcmp(VolHdr.VolumeName, LoadedVolName) == 0; };
void set_load() { m_load = true; };
void set_slot(int32_t slot); /* in dev.c */
void clear_slot(); /* in dev.c */
bool update_freespace(); /* in dev.c */
- bool get_os_device_freespace(); /* in dev.c */
+ virtual bool get_os_device_freespace(); /* in dev.c */
void notify_newvol_in_attached_dcrs(const char *VolumeName); /* in dev.c */
void notify_newfile_in_attached_dcrs();/* in dev.c */
void attach_dcr_to_dev(DCR *dcr); /* in acquire.c */
return true;
}
-
/*
* (Un)mount the device
*/
capabilities |= CAP_LSEEK;
return 0;
}
+
+bool file_dev::is_fs_nearly_full(uint64_t threshold)
+{
+ uint64_t freeval, totalval;
+ get_freespace(&freeval, &totalval);
+ if (totalval > 0) {
+ if (freeval < threshold) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool file_dev::get_os_device_freespace()
+{
+ int64_t freespace, totalspace;
+ if (fs_get_free_space(dev_name, &freespace, &totalspace) == 0) {
+ set_freespace(freespace, totalspace, 0, true);
+ Mmsg(errmsg, "");
+ return true;
+
+ } else {
+ set_freespace(0, 0, 0, false); /* No valid freespace */
+ }
+ return false;
+}
bool set_immutable(const char *vol_name);
bool clear_immutable(const char *vol_name);
bool check_volume_protection_time(const char *vol_name);
+ bool get_os_device_freespace();
+ bool is_fs_nearly_full(uint64_t threshold);
};
#endif /* __FILE_DEV_ */