From 146101d0346cdde420258f764d072a08a5754068 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Fri, 4 Jan 2013 14:05:00 +0100 Subject: [PATCH] lib_log: use standard chunk_size in log_read() --- lib_log.c | 14 +++----------- lib_log.h | 1 + mars_trans_logger.c | 16 ++++++++++++---- mars_trans_logger.h | 3 --- sy_old/mars_light.c | 7 ------- 5 files changed, 16 insertions(+), 25 deletions(-) diff --git a/lib_log.c b/lib_log.c index 3f6442da..93cc359a 100644 --- a/lib_log.c +++ b/lib_log.c @@ -8,8 +8,6 @@ //#define MARS_DEBUGGING //#define IO_DEBUGGING -#define MAX_RESERVE PAGE_SIZE - #include "lib_log.h" atomic_t global_mref_flying = ATOMIC_INIT(0); @@ -182,8 +180,8 @@ void *log_reserve(struct log_status *logst, struct log_header *lh) int offset; int status; - if (unlikely(lh->l_len <= 0 || lh->l_len > MAX_RESERVE)) { - MARS_ERR("trying to write %d bytes, max allowed = %d\n", lh->l_len, (int)PAGE_SIZE); + if (unlikely(lh->l_len <= 0 || lh->l_len > logst->max_size)) { + MARS_ERR("trying to write %d bytes, max allowed = %d\n", lh->l_len, logst->max_size); goto err; } @@ -524,9 +522,6 @@ restart: status = 0; mref = logst->read_mref; if (!mref || logst->do_free) { - int chunk_offset; - int chunk_rest; - if (mref) { GENERIC_INPUT_CALL(logst->input, mref_put, mref); logst->read_mref = NULL; @@ -540,10 +535,7 @@ restart: goto done; } mref->ref_pos = logst->log_pos; - chunk_offset = logst->log_pos & (loff_t)(logst->chunk_size - 1); - chunk_rest = logst->chunk_size - chunk_offset; - mref->ref_len = chunk_rest + logst->chunk_size * 4; - MARS_IO("log_pos = %lld chunk_offset = %d chunk_rest = %d ref_len = %d\n", logst->log_pos, chunk_offset, chunk_rest, mref->ref_len); + mref->ref_len = logst->chunk_size; mref->ref_prio = logst->io_prio; status = GENERIC_INPUT_CALL(logst->input, mref_get, mref); diff --git a/lib_log.h b/lib_log.h index be1ed6a0..ad96d1d6 100644 --- a/lib_log.h +++ b/lib_log.h @@ -96,6 +96,7 @@ struct log_status { // tunables int align_size; // alignment between requests int chunk_size; // must be at least 8K (better 64k) + int max_size; // max payload length int io_prio; bool do_crc; // informational diff --git a/mars_trans_logger.c b/mars_trans_logger.c index be306088..4cd1ad73 100644 --- a/mars_trans_logger.c +++ b/mars_trans_logger.c @@ -19,6 +19,12 @@ #define DO_WRITEBACK // otherwise FAKE IO #define APPLY_DATA +// tuning +#define CONF_TRANS_CHUNKSIZE (128 * 1024) +#define CONF_TRANS_MAX_MREF_SIZE PAGE_SIZE +//#define CONF_TRANS_ALIGN PAGE_SIZE // FIXME: does not work +#define CONF_TRANS_ALIGN 0 + #include #include #include @@ -739,8 +745,8 @@ int trans_logger_ref_get(struct trans_logger_output *output, struct mref_object get_lamport(&mref_a->stamp); - if (mref->ref_len > brick->max_mref_size && brick->max_mref_size > 0) - mref->ref_len = brick->max_mref_size; + if (mref->ref_len > CONF_TRANS_MAX_MREF_SIZE && CONF_TRANS_MAX_MREF_SIZE > 0) + mref->ref_len = CONF_TRANS_MAX_MREF_SIZE; // ensure that REGION_SIZE boundaries are obeyed by hashing base_offset = mref->ref_pos & (loff_t)(REGION_SIZE - 1); @@ -2324,8 +2330,10 @@ void _init_input(struct trans_logger_input *input) init_logst(logst, (void*)input, 0); logst->signal_event = &brick->worker_event; - logst->align_size = brick->align_size; - logst->chunk_size = brick->chunk_size; + logst->align_size = CONF_TRANS_ALIGN; + logst->chunk_size = CONF_TRANS_CHUNKSIZE; + logst->max_size = CONF_TRANS_MAX_MREF_SIZE; + input->inf.inf_min_pos = start_pos; input->inf.inf_max_pos = start_pos; // ATTENTION: this remains correct as far as our replay code _never_ kicks off any requests in parallel (which is current state of the "art", relying on BBU caching for performance). WHENEVER YOU CHANGE THIS some day, you MUST maintain the correct end_pos here! diff --git a/mars_trans_logger.h b/mars_trans_logger.h index 90b2d3c1..bd82cba8 100644 --- a/mars_trans_logger.h +++ b/mars_trans_logger.h @@ -145,9 +145,6 @@ struct trans_logger_brick { // parameters struct mars_limiter *replay_limiter; int shadow_mem_limit; // max # master shadows - int max_mref_size;// shorten mrefs to this maxlen - int align_size; // alignment between requests - int chunk_size; // must be at least 8K (better 64k) bool replay_mode; // mode of operation bool continuous_replay_mode; // mode of operation bool log_reads; // additionally log pre-images diff --git a/sy_old/mars_light.c b/sy_old/mars_light.c index 19e84297..6cb8e0df 100644 --- a/sy_old/mars_light.c +++ b/sy_old/mars_light.c @@ -128,10 +128,6 @@ int mars_mem_percent = 20; EXPORT_SYMBOL_GPL(mars_mem_percent); #define CONF_TRANS_SHADOW_LIMIT (1024 * 128) // don't fill the hashtable too much -#define CONF_TRANS_CHUNKSIZE (128 * 1024) -#define CONF_TRANS_MAX_MREF_SIZE PAGE_SIZE -//#define CONF_TRANS_ALIGN 512 -#define CONF_TRANS_ALIGN 0 //#define TRANS_FAKE @@ -200,9 +196,6 @@ int _set_trans_params(struct mars_brick *_brick, void *private) trans_brick->debug_shortcut = true; #endif - trans_brick->max_mref_size = CONF_TRANS_MAX_MREF_SIZE; - trans_brick->align_size = CONF_TRANS_ALIGN; - trans_brick->chunk_size = CONF_TRANS_CHUNKSIZE; } MARS_INF("name = '%s' path = '%s'\n", _brick->brick_name, _brick->brick_path); return 1;