light: delay shutdown if buffer memory is in use

This commit is contained in:
Thomas Schoebel-Theuer 2012-11-13 10:59:00 +01:00 committed by Thomas Schoebel-Theuer
parent f1d9b0366d
commit 569e70eb90
3 changed files with 13 additions and 5 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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;