mirror of
https://github.com/schoebel/mars
synced 2024-12-26 00:22:31 +00:00
lib_log: use standard chunk_size in log_read()
This commit is contained in:
parent
44f45025f8
commit
146101d034
14
lib_log.c
14
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);
|
||||
|
@ -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
|
||||
|
@ -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 <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/string.h>
|
||||
@ -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!
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user