mirror of
https://github.com/schoebel/mars
synced 2024-12-27 00:52:21 +00:00
infra: disable say_logging by default
This commit is contained in:
parent
bef8f30ab1
commit
11358d0279
@ -160,7 +160,7 @@ struct say_channel *find_channel(const void *id)
|
||||
struct say_channel *res = default_channel;
|
||||
struct say_channel *ch;
|
||||
|
||||
if (cannot_schedule())
|
||||
if (!default_channel || cannot_schedule())
|
||||
return res;
|
||||
|
||||
down_read(&say_mutex);
|
||||
@ -197,7 +197,7 @@ void bind_to_channel(struct say_channel *ch, struct task_struct *whom)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (cannot_schedule())
|
||||
if (!default_channel || !ch || cannot_schedule())
|
||||
return;
|
||||
|
||||
down_write(&say_mutex);
|
||||
@ -230,7 +230,7 @@ struct say_channel *get_binding(struct task_struct *whom)
|
||||
struct say_channel *ch;
|
||||
int i;
|
||||
|
||||
if (cannot_schedule())
|
||||
if (!default_channel || cannot_schedule())
|
||||
return NULL;
|
||||
|
||||
down_read(&say_mutex);
|
||||
@ -253,7 +253,7 @@ void remove_binding_from(struct say_channel *ch, struct task_struct *whom)
|
||||
bool found = false;
|
||||
int i;
|
||||
|
||||
if (cannot_schedule())
|
||||
if (!default_channel || !ch || cannot_schedule())
|
||||
return;
|
||||
|
||||
down_write(&say_mutex);
|
||||
@ -273,7 +273,7 @@ EXPORT_SYMBOL_GPL(remove_binding_from);
|
||||
|
||||
void remove_binding(struct task_struct *whom)
|
||||
{
|
||||
if (cannot_schedule())
|
||||
if (!default_channel || cannot_schedule())
|
||||
return;
|
||||
|
||||
down_write(&say_mutex);
|
||||
@ -284,6 +284,9 @@ EXPORT_SYMBOL_GPL(remove_binding);
|
||||
|
||||
void rollover_channel(struct say_channel *ch)
|
||||
{
|
||||
if (!default_channel || cannot_schedule())
|
||||
return;
|
||||
|
||||
if (!ch) {
|
||||
ch = find_channel(current);
|
||||
}
|
||||
@ -296,7 +299,7 @@ void rollover_all(void)
|
||||
{
|
||||
struct say_channel *ch;
|
||||
|
||||
if (cannot_schedule())
|
||||
if (!default_channel || cannot_schedule())
|
||||
return;
|
||||
|
||||
down_read(&say_mutex);
|
||||
@ -428,6 +431,9 @@ struct say_channel *make_channel(const char *name, bool must_exist)
|
||||
struct say_channel *res = NULL;
|
||||
struct say_channel *ch;
|
||||
|
||||
if (must_exist && !default_channel)
|
||||
return NULL;
|
||||
|
||||
if (cannot_schedule()) {
|
||||
printk(KERN_ERR "trying to make channel in atomic\n");
|
||||
return NULL;
|
||||
@ -480,6 +486,9 @@ void _say(struct say_channel *ch, int class, va_list args, bool use_args, const
|
||||
int rest;
|
||||
int written;
|
||||
|
||||
if (!default_channel)
|
||||
return;
|
||||
|
||||
if (unlikely(!ch))
|
||||
return;
|
||||
if (unlikely(ch->ch_delete && ch != default_channel)) {
|
||||
@ -520,6 +529,9 @@ void say_to(struct say_channel *ch, int class, const char *fmt, ...)
|
||||
va_list args;
|
||||
unsigned long flags;
|
||||
|
||||
if (!default_channel)
|
||||
return;
|
||||
|
||||
if (!class && !brick_say_debug)
|
||||
return;
|
||||
|
||||
@ -569,6 +581,9 @@ void brick_say_to(struct say_channel *ch, int class, bool dump, const char *pref
|
||||
va_list args;
|
||||
unsigned long flags;
|
||||
|
||||
if (!default_channel)
|
||||
return;
|
||||
|
||||
if (!class && !brick_say_debug)
|
||||
return;
|
||||
|
||||
@ -884,8 +899,16 @@ int _say_thread(void *data)
|
||||
|
||||
void init_say(void)
|
||||
{
|
||||
default_channel = make_channel(CONFIG_MARS_LOGDIR, true);
|
||||
say_thread = kthread_create(_say_thread, NULL, "brick_say");
|
||||
/* Only initialize once */
|
||||
if (default_channel)
|
||||
return;
|
||||
|
||||
default_channel = make_channel(CONFIG_MARS_LOGDIR, false);
|
||||
if (!default_channel)
|
||||
return;
|
||||
|
||||
if (!say_thread)
|
||||
say_thread = kthread_create(_say_thread, NULL, "brick_say");
|
||||
if (IS_ERR(say_thread)) {
|
||||
say_thread = NULL;
|
||||
} else {
|
||||
|
@ -3334,7 +3334,7 @@ int make_log_init(void *buf, struct mars_dent *dent)
|
||||
if (unlikely(!rot->log_say)) {
|
||||
char *name = path_make("%s/logstatus-%s", parent_path, my_id());
|
||||
if (likely(name)) {
|
||||
rot->log_say = make_channel(name, false);
|
||||
rot->log_say = make_channel(name, true);
|
||||
brick_string_free(name);
|
||||
}
|
||||
}
|
||||
@ -6250,6 +6250,8 @@ static int main_worker(struct mars_global *global, struct mars_dent *dent, bool
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SAY_TEST_STR CONFIG_MARS_LOGDIR "/5.total.log"
|
||||
|
||||
static int _main_thread(void *data)
|
||||
{
|
||||
long long last_rollover = jiffies;
|
||||
@ -6276,11 +6278,17 @@ static int _main_thread(void *data)
|
||||
(void *)&bio_brick_type,
|
||||
NULL
|
||||
};
|
||||
struct kstat dummy;
|
||||
int say_status;
|
||||
struct list_head *tmp;
|
||||
int trigger_mode;
|
||||
int status;
|
||||
loff_t memlimit;
|
||||
|
||||
say_status = mars_stat(SAY_TEST_STR, &dummy, true);
|
||||
if (!say_status)
|
||||
init_say();
|
||||
|
||||
MARS_DBG("-------- NEW ROUND %d ---------\n", atomic_read(&server_handler_count));
|
||||
|
||||
/* Static memlimit */
|
||||
@ -6528,6 +6536,11 @@ static int __init init_main(void)
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
/* This must come first to be effective */
|
||||
status = mars_stat(SAY_TEST_STR, &dummy, true);
|
||||
if (!status)
|
||||
init_say();
|
||||
|
||||
#ifdef MARS_HAS_PREPATCH
|
||||
// bump the min_free limit
|
||||
if (min_free_kbytes < new_limit)
|
||||
@ -6536,8 +6549,6 @@ static int __init init_main(void)
|
||||
|
||||
printk(KERN_INFO "loading MARS, BUILDTAG=%s BUILDHOST=%s BUILDDATE=%s\n", BUILDTAG, BUILDHOST, BUILDDATE);
|
||||
|
||||
init_say(); // this must come first
|
||||
|
||||
/* be careful: order is important!
|
||||
*/
|
||||
DO_INIT(brick_mem);
|
||||
|
@ -1058,7 +1058,8 @@ void bind_to_dent(struct mars_dent *dent, struct say_channel **ch)
|
||||
break;
|
||||
}
|
||||
if (test->d_use_channel && test->d_path) {
|
||||
dent->d_say_channel = make_channel(test->d_path, true);
|
||||
dent->d_say_channel = make_channel(test->d_path,
|
||||
true);
|
||||
break;
|
||||
}
|
||||
test = test->d_parent;
|
||||
|
Loading…
Reference in New Issue
Block a user