mirror of
https://github.com/schoebel/mars
synced 2025-01-30 03:42:48 +00:00
light: delay shutdown if buffer memory is in use
This commit is contained in:
parent
f1d9b0366d
commit
569e70eb90
@ -500,8 +500,10 @@ err:
|
||||
|
||||
////////////////// own brick / input / output operations //////////////////
|
||||
|
||||
static atomic_t global_mshadow_count = ATOMIC_INIT(0);
|
||||
static atomic64_t global_mshadow_used = ATOMIC64_INIT(0);
|
||||
atomic_t global_mshadow_count = ATOMIC_INIT(0);
|
||||
EXPORT_SYMBOL_GPL(global_mshadow_count);
|
||||
atomic64_t global_mshadow_used = ATOMIC64_INIT(0);
|
||||
EXPORT_SYMBOL_GPL(global_mshadow_used);
|
||||
|
||||
static noinline
|
||||
int trans_logger_get_info(struct trans_logger_output *output, struct mars_info *info)
|
||||
|
@ -18,6 +18,8 @@
|
||||
///////////////////////// global tuning ////////////////////////
|
||||
|
||||
extern int trans_logger_mem_usage; // in KB
|
||||
extern atomic_t global_mshadow_count;
|
||||
extern atomic64_t global_mshadow_used;
|
||||
|
||||
struct writeback_group {
|
||||
rwlock_t lock;
|
||||
|
@ -3877,11 +3877,15 @@ static int light_thread(void *data)
|
||||
rest_space = _global.remaining_space - EXHAUSTED_LIMIT(_global.total_space);
|
||||
_make_alivelink("rest-space", rest_space);
|
||||
|
||||
#if 1
|
||||
if (!_global.global_power.button) {
|
||||
mars_kill_brick_all(&_global, &_global.server_anchor, false);
|
||||
int used = atomic_read(&global_mshadow_count);
|
||||
if (used > 0) {
|
||||
MARS_INF("global shutdown delayed: there are %d buffers in use, occupying %ld bytes\n", used, atomic64_read(&global_mshadow_used));
|
||||
} else {
|
||||
MARS_INF("global shutdown of all bricks...\n");
|
||||
mars_kill_brick_all(&_global, &_global.server_anchor, false);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MARS_DBG("-------- start worker ---------\n");
|
||||
_global.deleted_min = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user