infra: make killing of useless bricks selectable

This commit is contained in:
Thomas Schoebel-Theuer 2013-01-22 12:10:12 +01:00
parent 4cbd11372e
commit 34dac0689b
4 changed files with 15 additions and 1 deletions

1
mars.h
View File

@ -176,6 +176,7 @@ struct mars_info {
const char *brick_path; \
struct mars_global *global; \
int brick_version; \
bool killme; \
void (*show_status)(struct mars_brick *brick, bool shutdown); \
struct mars_brick {

View File

@ -408,6 +408,10 @@ int handler_thread(void *data)
0);
if (likely(prev)) {
status = generic_connect((void*)brick->inputs[0], (void*)prev->outputs[0]);
if (unlikely(status < 0)) {
MARS_ERR("#%d cannot connect to '%s'\n", sock->s_debug_nr, path);
}
prev->killme = true;
} else {
MARS_ERR("#%d cannot find brick '%s'\n", sock->s_debug_nr, path);
}

View File

@ -211,6 +211,7 @@ int _set_client_params(struct mars_brick *_brick, void *private)
struct client_cookie *clc = private;
client_brick->io_timeout = 0;
client_brick->limit_mode = clc ? clc->limit_mode : false;
client_brick->killme = true;
MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path);
return 1;
}
@ -228,6 +229,7 @@ int _set_sio_params(struct mars_brick *_brick, void *private)
}
sio_brick->o_direct = false; // important!
sio_brick->o_fdsync = true;
sio_brick->killme = true;
MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path);
return 1;
}
@ -250,6 +252,7 @@ int _set_aio_params(struct mars_brick *_brick, void *private)
aio_brick->o_creat = clc && clc->create_mode;
aio_brick->o_direct = false; // important!
aio_brick->o_fdsync = true;
aio_brick->killme = true;
MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path);
return 1;
}
@ -276,6 +279,7 @@ int _set_bio_params(struct mars_brick *_brick, void *private)
bio_brick->do_noidle = BIO_NOIDLE;
bio_brick->do_sync = BIO_SYNC;
bio_brick->do_unplug = BIO_UNPLUG;
bio_brick->killme = true;
MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path);
return 1;
}
@ -325,6 +329,7 @@ int _set_copy_params(struct mars_brick *_brick, void *private)
copy_brick->io_prio = COPY_PRIO;
copy_brick->verify_mode = cc->verify_mode;
copy_brick->repair_mode = true;
copy_brick->killme = true;
MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path);
/* Determine the copy area, switch on/off when necessary

View File

@ -1216,7 +1216,11 @@ restart:
brick = container_of(tmp, struct mars_brick, global_brick_link);
}
// only kill the right brick types
if (brick->type != type) {
if (type && brick->type != type) {
continue;
}
// only kill marked bricks
if (!brick->killme) {
continue;
}
// only kill unconnected bricks