infra: simplify mars_kill_brick_when_possible()

This commit is contained in:
Thomas Schoebel-Theuer 2020-03-07 06:28:27 +01:00
parent a03d9dbad4
commit 333760bc1a
4 changed files with 9 additions and 10 deletions

View File

@ -407,7 +407,6 @@ int handler_thread(void *data)
}
status = mars_kill_brick_when_possible(handler_global,
&handler_global->brick_anchor,
false, NULL, true);
MARS_DBG("kill handler bricks (when possible) = %d\n", status);
}
@ -854,7 +853,6 @@ static int _server_thread(void *data)
show_statistics(server_global, "server");
status = mars_kill_brick_when_possible(server_global,
&server_global->brick_anchor,
false, NULL, true);
MARS_DBG("kill server bricks (when possible) = %d\n", status);

View File

@ -6336,30 +6336,24 @@ static int _main_thread(void *data)
if (!mars_global->global_power.button) {
status = mars_kill_brick_when_possible(mars_global,
&mars_global->brick_anchor,
false, (void*)&copy_brick_type, true);
MARS_DBG("kill copy bricks (when possible) = %d\n", status);
}
status = mars_kill_brick_when_possible(mars_global,
&mars_global->brick_anchor,
false, NULL, false);
MARS_DBG("kill main bricks (when possible) = %d\n", status);
status = mars_kill_brick_when_possible(mars_global,
&mars_global->brick_anchor,
false, (void*)&client_brick_type, true);
MARS_DBG("kill client bricks (when possible) = %d\n", status);
status = mars_kill_brick_when_possible(mars_global,
&mars_global->brick_anchor,
false, (void*)&aio_brick_type, true);
MARS_DBG("kill aio bricks (when possible) = %d\n", status);
status = mars_kill_brick_when_possible(mars_global,
&mars_global->brick_anchor,
false, (void*)&sio_brick_type, true);
MARS_DBG("kill sio bricks (when possible) = %d\n", status);
status = mars_kill_brick_when_possible(mars_global,
&mars_global->brick_anchor,
false, (void*)&bio_brick_type, true);
MARS_DBG("kill bio bricks (when possible) = %d\n", status);

View File

@ -169,7 +169,10 @@ extern struct mars_brick *mars_make_brick(struct mars_global *global, struct mar
extern int mars_free_brick(struct mars_brick *brick);
extern int mars_kill_brick(struct mars_brick *brick);
extern int mars_kill_brick_all(struct mars_global *global, struct list_head *anchor, bool use_dent_link);
extern int mars_kill_brick_when_possible(struct mars_global *global, struct list_head *anchor, bool use_dent_link, const struct mars_brick_type *type, bool even_on);
extern int mars_kill_brick_when_possible(struct mars_global *global,
bool use_dent_link,
const struct mars_brick_type *type,
bool even_on);
// mid-level brick instantiation (identity is based on path strings)

View File

@ -2627,8 +2627,12 @@ done:
}
EXPORT_SYMBOL_GPL(mars_kill_brick_all);
int mars_kill_brick_when_possible(struct mars_global *global, struct list_head *anchor, bool use_dent_link, const struct mars_brick_type *type, bool even_on)
int mars_kill_brick_when_possible(struct mars_global *global,
bool use_dent_link,
const struct mars_brick_type *type,
bool even_on)
{
struct list_head *anchor = &global->brick_anchor;
int return_status = 0;
struct list_head *tmp;