light: make MIN_SPACE runtime configurable

This commit is contained in:
Thomas Schoebel-Theuer 2012-08-14 16:32:06 +02:00 committed by Thomas Schoebel-Theuer
parent 44f58e7004
commit ebeaa7c7c0
4 changed files with 21 additions and 4 deletions

10
Kconfig
View File

@ -184,12 +184,16 @@ config MARS_MIN_SPACE_BASE
depends on MARS_MIN_SPACE
default 8
---help---
when this limit is exceeded, all write requests to /mars/
when this limit is exceeded, transaction logging to /mars/
will stop. This affects not only write IO to /dev/mars/*,
but also logfile transfers etc.
but also logfile transfers etc. As a consequence, writes
on the primary will directly go to the device, and the secondaries
will be outdated.
In order to retain full operations, you _need_ to implement
your own monitoring which _must_ warn you long before this
hard limit catches you.
hard limit catches you. If it already has caught you, it
will be too late: you have to recover by hand, e.g. by
starting a full sync.
config MARS_MIN_SPACE_PERCENT
int "free space in /mars/ (hard limit in percent)"

View File

@ -159,7 +159,7 @@ EXPORT_SYMBOL_GPL(mars_mem_percent);
#define COPY_PRIO MARS_PRIO_LOW
#ifdef CONFIG_MARS_MIN_SPACE
#define EXHAUSTED_LIMIT(max) ((max) / 100 * CONFIG_MARS_MIN_SPACE_PERCENT + CONFIG_MARS_MIN_SPACE_BASE * 1024 * 1024)
#define EXHAUSTED_LIMIT(max) ((max) / 100 * CONFIG_MARS_MIN_SPACE_PERCENT + global_free_space * 1024 * 1024)
#define EXHAUSTED(x,max) ((x) <= EXHAUSTED_LIMIT(max))
#else
#define EXHAUSTED_LIMIT(max) 0
@ -3920,6 +3920,9 @@ static void __exit exit_light(void)
int global_logrot_auto = CONFIG_MARS_LOGROT_AUTO;
EXPORT_SYMBOL_GPL(global_logrot_auto);
int global_free_space = CONFIG_MARS_MIN_SPACE_BASE;
EXPORT_SYMBOL_GPL(global_free_space);
static int __init init_light(void)
{
int status = 0;

View File

@ -190,6 +190,15 @@ ctl_table mars_table[] = {
.proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec,
},
{
.ctl_name = CTL_UNNUMBERED,
.procname = "free_space_mb",
.data = &global_free_space,
.maxlen = sizeof(int),
.mode = 0600,
.proc_handler = &proc_dointvec,
.strategy = &sysctl_intvec,
},
#ifdef CONFIG_MARS_LOADAVG_LIMIT
{
.ctl_name = CTL_UNNUMBERED,

View File

@ -11,6 +11,7 @@
#define MARS_PATH_MAX 256
extern int global_logrot_auto;
extern int global_free_space;
extern char *my_id(void);