import mars-120.tgz

This commit is contained in:
Thomas Schoebel-Theuer 2011-07-28 12:41:06 +01:00
parent 866ac28322
commit f51293dced
10 changed files with 43 additions and 26 deletions

22
Kconfig
View File

@ -7,12 +7,12 @@ config MARS
---help---
Experimental storage System. Only compile as modules!
config MARS_HUNG
tristate "hangup on kernel stacktrace (only for debugging)"
depends on MARS
default n
---help---
Experimental storage System.
#config MARS_HUNG
# tristate "hangup on kernel stacktrace (only for debugging)"
# depends on MARS
# default n
# ---help---
# Experimental storage System.
config MARS_DUMMY
tristate "MARS dummy brick"
@ -43,28 +43,28 @@ config MARS_BIO
Experimental storage System.
config MARS_AIO
tristate "interface to a linux file"
tristate "interface to a linux file (Asynchronous IO)"
depends on MARS
default m
---help---
Experimental storage System.
config MARS_SIO
tristate "interface to a linux file, synchronous"
tristate "interface to a linux file, synchronous (currently unused)"
depends on MARS
default m
---help---
Experimental storage System.
config MARS_BUF
tristate "buffer brick"
tristate "buffer brick (currently unused)"
depends on MARS
default m
---help---
Experimental storage System.
config MARS_USEBUF
tristate "usebuf brick"
tristate "usebuf brick (currently unused)"
depends on MARS
default m
---help---
@ -99,7 +99,7 @@ config MARS_COPY
Experimental storage System.
config MARS_LIGHT
tristate "MARS Light main"
tristate "MARS Light main (protoype, will be replaced)"
depends on MARS
default m
---help---

View File

@ -8,11 +8,13 @@
void init_logst(struct log_status *logst, struct mars_input *input, struct mars_output *output, loff_t start_pos)
{
memset(logst, sizeof(*logst), 0);
struct mars_brick *brick;
memset(logst, 0, sizeof(struct log_status));
logst->input = input;
logst->output = output;
logst->log_pos = start_pos;
init_waitqueue_head(&logst->event);
brick = input->brick;
}
EXPORT_SYMBOL_GPL(init_logst);

View File

@ -117,7 +117,7 @@ ELEM_TYPE *q_##PREFIX##_fetch(struct PREFIX##_queue *q) \
elem = container_of(q->heap_high, ELEM_TYPE, ph); \
\
if (unlikely(KEYCMP(KEYFN(elem), &q->last_pos) < 0)) { \
MARS_ERR("backskip pos %lld -> %lld\n", q->last_pos, KEYFN(elem)); \
MARS_ERR("backskip pos %lld -> %lld\n", (long long)q->last_pos, (long long)KEYFN(elem)); \
} \
memcpy(&q->last_pos, KEYFN(elem), sizeof(q->last_pos)); \
\

4
mars.h
View File

@ -43,7 +43,7 @@ extern long long mars_global_memlimit;
#define _MARS_FMT(_fmt) "[%s] " __BASE_FILE__ " %d %s(): " _fmt, current->comm, __LINE__, __FUNCTION__
#define _MARS_MSG(_dump, PREFIX, _fmt, _args...) do { say(PREFIX _MARS_FMT(_fmt), ##_args); MARS_DELAY; if (_dump) brick_dump_stack(); } while (0)
#define _MARS_MSG(_stacktrace, PREFIX, _fmt, _args...) do { say(PREFIX _MARS_FMT(_fmt), ##_args); MARS_DELAY; if (_stacktrace) dump_stack(); } while (0)
#define MARS_FAT(_fmt, _args...) _MARS_MSG(true, MARS_FATAL, _fmt, ##_args)
#define MARS_ERR(_fmt, _args...) _MARS_MSG(true, MARS_ERROR, _fmt, ##_args)
@ -57,7 +57,7 @@ extern long long mars_global_memlimit;
#endif
#ifdef IO_DEBUGGING
#define MARS_IO(_fmt, _args...) _MARS_MSG(MARS_DEBUG, _fmt, ##_args)
#define MARS_IO(_fmt, _args...) _MARS_MSG(false, MARS_DEBUG, _fmt, ##_args)
#else
#define MARS_IO(_args...) /*empty*/
#endif

View File

@ -156,6 +156,10 @@ static int aio_ref_get(struct aio_output *output, struct mref_object *mref)
struct aio_mref_aspect *mref_a = aio_mref_get_aspect(output, mref);
if (!mref_a)
return -EILSEQ;
if (mref->ref_len <= 0) {
MARS_ERR("bad ref_len = %d\n", mref->ref_len);
return -ENOMEM;
}
mref->ref_data = mars_alloc(mref->ref_pos, (mref_a->alloc_len = mref->ref_len));
if (!mref->ref_data) {
MARS_ERR("ENOMEM %d bytes\n", mref->ref_len);

View File

@ -65,7 +65,7 @@ void *mars_alloc(loff_t pos, int len)
#ifdef USE_KERNEL_PAGES
int order = MARS_MAX_ORDER;
if (unlikely(len > (PAGE_SIZE << order) || len <=0)) {
MARS_ERR("trying to allocate %d bytes (max = %d)\n", len, (PAGE_SIZE << order));
MARS_ERR("trying to allocate %d bytes (max = %d)\n", len, (int)(PAGE_SIZE << order));
return NULL;
}
#endif

View File

@ -48,7 +48,7 @@ int mars_create_sockaddr(struct sockaddr_storage *addr, const char *spec)
char *tmp_spec;
int status = 0;
memset(addr, sizeof(*addr), 0);
memset(addr, 0, sizeof(*addr));
sockaddr->sin_family = AF_INET;
sockaddr->sin_port = htons(MARS_DEFAULT_PORT);

View File

@ -5,6 +5,7 @@
//#define BRICK_DEBUGGING
//#define MARS_DEBUGGING
//#define IO_DEBUGGING
//#define REPLAY_DEBUGGING
//#define STAT_DEBUGGING // here means: display full statistics
//#define HASH_DEBUGGING
@ -26,6 +27,13 @@
#include "mars.h"
#ifdef REPLAY_DEBUGGING
#define MARS_RPL(_fmt, _args...) _MARS_MSG(false, "REPLAY ", _fmt, ##_args)
#else
#define MARS_RPL(_args...) /*empty*/
#endif
///////////////////////// own type definitions ////////////////////////
#include "mars_trans_logger.h"
@ -1967,9 +1975,9 @@ void trans_logger_log(struct trans_logger_output *output)
fw_input = brick->inputs[TL_INPUT_FW_LOG1];
fw_logst = &fw_input->logst;
init_logst(fw_logst, (void*)fw_input, (void*)&fw_input->hidden_output, 0);
fw_logst->align_size = brick->align_size;
fw_logst->chunk_size = brick->chunk_size;
init_logst(fw_logst, (void*)fw_input, (void*)&fw_input->hidden_output, 0);
bw_input = brick->inputs[TL_INPUT_BW_LOG1];
@ -1978,9 +1986,9 @@ void trans_logger_log(struct trans_logger_output *output)
bw_input = fw_input;
bw_logst = fw_logst;
} else if (bw_input != fw_input) {
init_logst(bw_logst, (void*)bw_input, (void*)&bw_input->hidden_output, 0);
bw_logst->align_size = brick->align_size;
bw_logst->chunk_size = brick->chunk_size;
init_logst(bw_logst, (void*)bw_input, (void*)&bw_input->hidden_output, 0);
}
start_pos = brick->log_start_pos;
@ -2328,14 +2336,13 @@ void trans_logger_replay(struct trans_logger_output *output)
brick->replay_code = 0; // indicates "running"
MARS_INF("starting replay from %lld to %lld\n", brick->replay_start_pos, brick->replay_end_pos);
start_pos = brick->replay_start_pos;
init_logst(&input->logst, (void*)input, (void*)&input->hidden_output, start_pos);
input->logst.align_size = brick->align_size;
input->logst.chunk_size = brick->chunk_size;
init_logst(&input->logst, (void*)input, (void*)&input->hidden_output, brick->replay_start_pos);
start_pos = brick->replay_start_pos;
input->logst.log_pos = start_pos;
MARS_INF("starting replay from %lld to %lld\n", start_pos, brick->replay_end_pos);
brick->current_pos = start_pos;
input->replay_min_pos = start_pos;
input->replay_max_pos = start_pos; // FIXME: this is wrong.
@ -2366,7 +2373,10 @@ void trans_logger_replay(struct trans_logger_output *output)
MARS_ERR("cannot read logfile data, status = %d\n", status);
break;
}
new_finished_pos = input->logst.log_pos + input->logst.offset;
MARS_RPL("read %lld %lld\n", finished_pos, new_finished_pos);
if ((!status && len <= 0) ||
new_finished_pos > brick->replay_end_pos) { // EOF -> wait until kthread_should_stop()
MARS_DBG("EOF at %lld (old = %lld, end_pos = %lld)\n", new_finished_pos, finished_pos, brick->replay_end_pos);
@ -2383,6 +2393,7 @@ void trans_logger_replay(struct trans_logger_output *output)
MARS_IO("ignoring pos = %lld len = %d code = %d\n", lh.l_pos, lh.l_len, lh.l_code);
} else if (likely(buf && len)) {
status = apply_data(brick, lh.l_pos, buf, len);
MARS_RPL("apply %lld %lld (pos=%lld status=%d)\n", finished_pos, new_finished_pos, lh.l_pos, status);
if (unlikely(status < 0)) {
brick->replay_code = status;
MARS_ERR("cannot apply data at pos = %lld len = %d, status = %d\n", lh.l_pos, len, status);

View File

@ -2215,7 +2215,7 @@ static int make_sync(void *buf, struct mars_dent *dent)
goto done;
size_dent = (void*)mars_find_dent(global, tmp);
if (!size_dent || !size_dent->new_link) {
MARS_ERR("cannot determine size\n", tmp);
MARS_ERR("cannot determine size '%s'\n", tmp);
status = -ENOENT;
goto done;
}

View File

@ -1194,7 +1194,7 @@ static int __init init_sy(void)
return -ENOMEM;
}
if (IS_ERR(mars_tfm)) {
MARS_ERR("alloc crypto hash failed, status = %d\n", PTR_ERR(mars_tfm));
MARS_ERR("alloc crypto hash failed, status = %d\n", (int)PTR_ERR(mars_tfm));
return PTR_ERR(mars_tfm);
}
#if 0