From: Jaroslav Kysela Date: Thu, 3 Dec 2015 09:26:51 +0000 (+0100) Subject: DVR: config - replace cleanup threshold low/high with free/used X-Git-Tag: v4.2.1~1392 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=11c5330ee2ddfaa6fdd0026a93803fdd0156d302;p=thirdparty%2Ftvheadend.git DVR: config - replace cleanup threshold low/high with free/used --- diff --git a/src/dvr/dvr.h b/src/dvr/dvr.h index 70ed2cfd4..2fba8abee 100644 --- a/src/dvr/dvr.h +++ b/src/dvr/dvr.h @@ -54,8 +54,8 @@ typedef struct dvr_config { uint32_t dvr_extra_time_post; uint32_t dvr_update_window; int dvr_running; - uint32_t dvr_cleanup_threshold_low; - uint32_t dvr_cleanup_threshold_high; + uint32_t dvr_cleanup_threshold_free; + uint32_t dvr_cleanup_threshold_used; muxer_config_t dvr_muxcnf; diff --git a/src/dvr/dvr_config.c b/src/dvr/dvr_config.c index 08ed46562..b7f2bf601 100644 --- a/src/dvr/dvr_config.c +++ b/src/dvr/dvr_config.c @@ -186,8 +186,8 @@ dvr_config_create(const char *name, const char *uuid, htsmsg_t *conf) cfg->dvr_warm_time = 30; cfg->dvr_update_window = 24 * 3600; cfg->dvr_pathname = strdup("$t$n.$x"); - cfg->dvr_cleanup_threshold_low = 200; - cfg->dvr_cleanup_threshold_high = 2000; + cfg->dvr_cleanup_threshold_free = 200; + cfg->dvr_cleanup_threshold_used = 2000; /* Muxer config */ cfg->dvr_muxcnf.m_cache = MC_CACHE_DONTKEEP; @@ -517,10 +517,10 @@ dvr_config_save(dvr_config_t *cfg) lock_assert(&global_lock); dvr_config_storage_check(cfg); - if (cfg->dvr_cleanup_threshold_low < 50) - cfg->dvr_cleanup_threshold_low = 50; // as checking is only periodically, lower is not save - if (cfg->dvr_cleanup_threshold_high < cfg->dvr_cleanup_threshold_high) - cfg->dvr_cleanup_threshold_high = cfg->dvr_cleanup_threshold_low + 50; + if (cfg->dvr_cleanup_threshold_free < 50) + cfg->dvr_cleanup_threshold_free = 50; // as checking is only periodically, lower is not save + if (cfg->dvr_cleanup_threshold_used < cfg->dvr_cleanup_threshold_used) + cfg->dvr_cleanup_threshold_used = cfg->dvr_cleanup_threshold_free + 50; if (cfg->dvr_removal_days != DVR_RET_FOREVER && cfg->dvr_removal_days > cfg->dvr_retention_days) cfg->dvr_retention_days = DVR_RET_ONREMOVE; @@ -984,17 +984,17 @@ const idclass_t dvr_config_class = { }, { .type = PT_U32, - .id = "storage-cleanup-low", + .id = "storage-mfree", .name = N_("Maintain free storage space (MiB)"), - .off = offsetof(dvr_config_t, dvr_cleanup_threshold_low), + .off = offsetof(dvr_config_t, dvr_cleanup_threshold_free), .def.i = 200, .group = 2, }, { .type = PT_U32, - .id = "storage-cleanup-high", + .id = "storage-mused", .name = N_("Maintain used storage space (MiB)"), - .off = offsetof(dvr_config_t, dvr_cleanup_threshold_high), + .off = offsetof(dvr_config_t, dvr_cleanup_threshold_used), .def.i = 2000, .group = 2, }, diff --git a/src/dvr/dvr_vfsmgr.c b/src/dvr/dvr_vfsmgr.c index 7a13576c4..e44fed591 100644 --- a/src/dvr/dvr_vfsmgr.c +++ b/src/dvr/dvr_vfsmgr.c @@ -73,10 +73,10 @@ dvr_disk_space_cleanup(dvr_config_t *cfg) filesystemId = diskdata.f_fsid; availBytes = diskdata.f_bsize * (int64_t)diskdata.f_bavail; - requiredBytes = MIB(cfg->dvr_cleanup_threshold_low); + requiredBytes = MIB(cfg->dvr_cleanup_threshold_free); diskBytes = diskdata.f_bsize * (int64_t)diskdata.f_blocks; usedBytes = diskBytes - availBytes; - maximalBytes = MIB(cfg->dvr_cleanup_threshold_high); + maximalBytes = MIB(cfg->dvr_cleanup_threshold_used); configName = cfg != dvr_config_find_by_name(NULL) ? cfg->dvr_config_name : "Default profile"; /* When deleting a file from the disk, the system needs some time to actually do this */ @@ -192,8 +192,8 @@ dvr_disk_space_check() { availBytes = diskdata.f_bsize * (int64_t)diskdata.f_bavail; usedBytes = (diskdata.f_bsize * (int64_t)diskdata.f_blocks) - availBytes; - requiredBytes = MIB(cfg->dvr_cleanup_threshold_low); - maximalBytes = MIB(cfg->dvr_cleanup_threshold_high); + requiredBytes = MIB(cfg->dvr_cleanup_threshold_free); + maximalBytes = MIB(cfg->dvr_cleanup_threshold_used); if (availBytes < requiredBytes || maximalBytes > usedBytes) { LIST_FOREACH(de, &dvrentries, de_global_link) {