Commit b40bdeb0 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Convert the -l argument into two params. For now setting them any

other way than -l does you no good.
parent 085f6d2d
......@@ -186,6 +186,10 @@ struct params {
double shortlived;
struct vre_limits vre_limits;
/* VSM dimensions */
ssize_t vsm_space;
ssize_t vsl_space;
};
/*
......
......@@ -81,7 +81,7 @@ void mgt_sandbox_solaris_privsep(void);
#endif
/* mgt_shmem.c */
void mgt_SHM_Init(const char *arg);
void mgt_SHM_Init(void);
void mgt_SHM_Pid(void);
/* stevedore_mgt.c */
......
......@@ -336,7 +336,6 @@ main(int argc, char * const *argv)
const char *b_arg = NULL;
const char *f_arg = NULL;
const char *i_arg = NULL;
const char *l_arg = NULL; /* default in mgt_shmem.c */
const char *h_arg = "critbit";
const char *M_arg = NULL;
const char *n_arg = NULL;
......@@ -349,6 +348,7 @@ main(int argc, char * const *argv)
struct cli cli[1];
struct vpf_fh *pfh = NULL;
char *dirname;
char **av;
unsigned clilim;
/*
......@@ -459,7 +459,19 @@ main(int argc, char * const *argv)
i_arg = optarg;
break;
case 'l':
l_arg = optarg;
av = VAV_Parse(optarg, NULL, ARGV_COMMA);
AN(av);
if (av[0] != NULL)
ARGV_ERR("\t-l ...: %s", av[0]);
if (av[1] != NULL) {
MCF_ParamSet(cli, "vsl_space", av[1]);
cli_check(cli);
}
if (av[1] != NULL && av[2] != NULL) {
MCF_ParamSet(cli, "vsm_space", av[2]);
cli_check(cli);
}
VAV_Free(av);
break;
case 'M':
M_arg = optarg;
......@@ -611,7 +623,7 @@ main(int argc, char * const *argv)
HSH_config(h_arg);
mgt_SHM_Init(l_arg);
mgt_SHM_Init();
AZ(VSB_finish(vident));
......
......@@ -1085,6 +1085,26 @@ static const struct parspec input_parspec[] = {
0,
"10000", ""},
{ "vsl_space", tweak_bytes,
&mgt_param.vsl_space, 1024*1024, HUGE_VAL,
"The amount of space to allocate for the VSL fifo buffer"
" in the VSM memory segment."
" If you make this too small, varnish{ncsa|log} etc will"
" not be able to keep up."
" Making it too large just costs memory resources.",
MUST_RESTART,
"80M", "bytes"},
{ "vsm_space", tweak_bytes,
&mgt_param.vsm_space, 1024*1024, HUGE_VAL,
"The amount of space to allocate for stats counters"
" in the VSM memory segment."
" If you make this too small, some counters will be"
" invisible."
" Making it too large just costs memory resources.",
MUST_RESTART,
"1M", "bytes"},
{ NULL, NULL, NULL }
};
......
......@@ -105,9 +105,7 @@
#include "vapi/vsc_int.h"
#include "vapi/vsl_int.h"
#include "vapi/vsm_int.h"
#include "vav.h"
#include "vmb.h"
#include "vnum.h"
#ifndef MAP_HASSEMAPHORE
#define MAP_HASSEMAPHORE 0 /* XXX Linux */
......@@ -227,67 +225,15 @@ mgt_shm_atexit(void)
}
void
mgt_SHM_Init(const char *l_arg)
mgt_SHM_Init(void)
{
int i, fill;
const char *q;
uintmax_t size, s1, s2, ps;
char **av, **ap;
uintmax_t size, ps;
uint32_t *vsl_log_start;
if (l_arg == NULL)
l_arg = "";
fill = 1;
av = VAV_Parse(l_arg, NULL, ARGV_COMMA);
AN(av);
if (av[0] != NULL)
ARGV_ERR("\t-l ...: %s", av[0]);
ap = av + 1;
/* Size of SHMLOG */
if (*ap != NULL && **ap != '\0') {
q = VNUM_2bytes(*ap, &s1, 0);
if (q != NULL)
ARGV_ERR("\t-l[1] ...: %s\n", q);
} else {
s1 = 80 * 1024 * 1024;
}
if (*ap != NULL)
ap++;
/* Size of space for other stuff */
if (*ap != NULL && **ap != '\0') {
q = VNUM_2bytes(*ap, &s2, 0);
if (q != NULL)
ARGV_ERR("\t-l[2] ...: %s\n", q);
} else {
s2 = 1024 * 1024;
}
if (*ap != NULL)
ap++;
/* Fill or not ? */
if (*ap != NULL) {
if (**ap == '\0')
fill = 1;
else if (!strcmp(*ap, "-"))
fill = 0;
else if (!strcmp(*ap, "+"))
fill = 1;
else
ARGV_ERR("\t-l[3] ...: Must be \"-\" or \"+\"\n");
ap++;
} else {
fill = 1;
}
if (*ap != NULL)
ARGV_ERR("\t-l ...: Too many sub-args\n");
VAV_Free(av);
size = s1 + s2;
size = mgt_param.vsl_space + mgt_param.vsm_space;
ps = getpagesize();
size += ps - 1;
size &= ~(ps - 1);
......@@ -326,7 +272,7 @@ mgt_SHM_Init(const char *l_arg)
AN(cache_param);
*cache_param = mgt_param;
vsl_log_start = VSM_Alloc(s1, VSL_CLASS, "", "");
vsl_log_start = VSM_Alloc(mgt_param.vsl_space, VSL_CLASS, "", "");
AN(vsl_log_start);
vsl_log_start[1] = VSL_ENDMARKER;
VWMB();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment