mirror of https://github.com/schoebel/mars
import mars-94.tgz
This commit is contained in:
parent
bd23270e27
commit
1b752e4012
8
mars.h
8
mars.h
|
@ -275,10 +275,10 @@ static const struct generic_aspect_type *BRICK##_aspect_types[BRICK_OBJ_MAX] = {
|
|||
|
||||
#define _CHECK_ATOMIC(atom,OP,minval) \
|
||||
do { \
|
||||
int test = atomic_read(atom); \
|
||||
if (test OP (minval)) { \
|
||||
int __test = atomic_read(atom); \
|
||||
if (__test OP (minval)) { \
|
||||
atomic_set(atom, minval); \
|
||||
MARS_ERR("%d: atomic " #atom " " #OP " " #minval " (%d)\n", __LINE__, test); \
|
||||
MARS_ERR("%d: atomic " #atom " " #OP " " #minval " (%d)\n", __LINE__, __test); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
@ -287,7 +287,7 @@ static const struct generic_aspect_type *BRICK##_aspect_types[BRICK_OBJ_MAX] = {
|
|||
|
||||
#define CHECK_HEAD_EMPTY(head) \
|
||||
if (unlikely(!list_empty(head))) { \
|
||||
INIT_LIST_HEAD(head); \
|
||||
list_del_init(head); \
|
||||
MARS_ERR("%d: list_head " #head " (%p) not empty\n", __LINE__, head); \
|
||||
} \
|
||||
|
||||
|
|
51
mars_aio.c
51
mars_aio.c
|
@ -121,6 +121,8 @@ static int aio_ref_get(struct aio_output *output, struct mref_object *mref)
|
|||
mref->ref_flags = 0;
|
||||
#endif
|
||||
mref_a->do_dealloc = true;
|
||||
atomic_inc(&output->total_alloc_count);
|
||||
atomic_inc(&output->alloc_count);
|
||||
}
|
||||
|
||||
atomic_inc(&mref->ref_count);
|
||||
|
@ -144,6 +146,7 @@ static void aio_ref_put(struct aio_output *output, struct mref_object *mref)
|
|||
mref_a = aio_mref_get_aspect(output, mref);
|
||||
if (mref_a && mref_a->do_dealloc) {
|
||||
kfree(mref->ref_data);
|
||||
atomic_dec(&output->alloc_count);
|
||||
}
|
||||
aio_free_mref(mref);
|
||||
done:;
|
||||
|
@ -163,7 +166,15 @@ void _complete(struct aio_output *output, struct mref_object *mref, int err)
|
|||
} else {
|
||||
mref->ref_flags |= MREF_UPTODATE;
|
||||
}
|
||||
|
||||
cb->cb_fn(cb);
|
||||
|
||||
if (mref->ref_rw) {
|
||||
atomic_dec(&output->write_count);
|
||||
} else {
|
||||
atomic_dec(&output->read_count);
|
||||
}
|
||||
|
||||
aio_ref_put(output, mref);
|
||||
}
|
||||
|
||||
|
@ -175,6 +186,15 @@ static void aio_ref_io(struct aio_output *output, struct mref_object *mref)
|
|||
|
||||
atomic_inc(&mref->ref_count);
|
||||
|
||||
// statistics
|
||||
if (mref->ref_rw) {
|
||||
atomic_inc(&output->total_write_count);
|
||||
atomic_inc(&output->write_count);
|
||||
} else {
|
||||
atomic_inc(&output->total_read_count);
|
||||
atomic_inc(&output->read_count);
|
||||
}
|
||||
|
||||
if (unlikely(!output->filp)) {
|
||||
goto done;
|
||||
}
|
||||
|
@ -496,6 +516,35 @@ static int aio_get_info(struct aio_output *output, struct mars_info *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
//////////////// informational / statistics ///////////////
|
||||
|
||||
static noinline
|
||||
char *aio_statistics(struct aio_brick *brick, int verbose)
|
||||
{
|
||||
struct aio_output *output = brick->outputs[0];
|
||||
char *res = kmalloc(256, GFP_MARS);
|
||||
if (!res)
|
||||
return NULL;
|
||||
|
||||
// FIXME: check for allocation overflows
|
||||
|
||||
sprintf(res, "total reads=%d writes=%d allocs=%d | flying reads=%d writes=%d allocs=%d \n",
|
||||
atomic_read(&output->total_read_count), atomic_read(&output->total_write_count), atomic_read(&output->total_alloc_count),
|
||||
atomic_read(&output->read_count), atomic_read(&output->write_count), atomic_read(&output->alloc_count));
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static noinline
|
||||
void aio_reset_statistics(struct aio_brick *brick)
|
||||
{
|
||||
struct aio_output *output = brick->outputs[0];
|
||||
atomic_set(&output->total_read_count, 0);
|
||||
atomic_set(&output->total_write_count, 0);
|
||||
atomic_set(&output->total_alloc_count, 0);
|
||||
}
|
||||
|
||||
|
||||
//////////////// object / aspect constructors / destructors ///////////////
|
||||
|
||||
static int aio_mref_aspect_init_fn(struct generic_aspect *_ini, void *_init_data)
|
||||
|
@ -659,6 +708,8 @@ static int aio_output_destruct(struct aio_output *output)
|
|||
|
||||
static struct aio_brick_ops aio_brick_ops = {
|
||||
.brick_switch = aio_switch,
|
||||
.brick_statistics = aio_statistics,
|
||||
.reset_statistics = aio_reset_statistics,
|
||||
};
|
||||
|
||||
static struct aio_output_ops aio_output_ops = {
|
||||
|
|
|
@ -41,6 +41,13 @@ struct aio_output {
|
|||
int fd; // FIXME: remove this!
|
||||
struct aio_threadinfo tinfo[3];
|
||||
aio_context_t ctxp;
|
||||
// statistics
|
||||
atomic_t total_read_count;
|
||||
atomic_t total_write_count;
|
||||
atomic_t total_alloc_count;
|
||||
atomic_t read_count;
|
||||
atomic_t write_count;
|
||||
atomic_t alloc_count;
|
||||
};
|
||||
|
||||
MARS_TYPES(aio);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -6,11 +6,6 @@
|
|||
#define REGION_SIZE (1 << REGION_SIZE_BITS)
|
||||
#define TRANS_HASH_MAX 512
|
||||
|
||||
//#define BITMAP_CHECKS
|
||||
#ifdef BITMAP_CHECKS
|
||||
#include <linux/bitmap.h>
|
||||
#endif
|
||||
|
||||
#include <linux/time.h>
|
||||
#include "log_format.h"
|
||||
#include "pairing_heap.h"
|
||||
|
@ -21,6 +16,7 @@ _PAIRING_HEAP_TYPEDEF(mref,)
|
|||
|
||||
struct logger_queue {
|
||||
struct logger_queue *q_dep;
|
||||
atomic_t *q_dep_plus;
|
||||
struct trans_logger_output *q_output;
|
||||
struct list_head q_anchor;
|
||||
struct pairing_heap_mref *heap_high;
|
||||
|
@ -82,32 +78,17 @@ struct trans_logger_mref_aspect {
|
|||
bool is_hashed;
|
||||
bool is_dirty;
|
||||
bool is_collected;
|
||||
bool ignore_this;
|
||||
struct timespec stamp;
|
||||
loff_t log_pos;
|
||||
loff_t fetch_margin;
|
||||
struct generic_callback cb;
|
||||
struct trans_logger_mref_aspect *orig_mref_a;
|
||||
struct writeback_info *wb;
|
||||
struct trans_logger_mref_aspect *base_mref_a;
|
||||
//struct trans_logger_mref_aspect *base_mref_a;
|
||||
struct list_head sub_list;
|
||||
struct list_head sub_head;
|
||||
int total_sub_count;
|
||||
atomic_t current_sub_count;
|
||||
#ifdef BITMAP_CHECKS
|
||||
int shadow_offset;
|
||||
int bitmap_write;
|
||||
int bitmap_write_slave;
|
||||
int bitmap_read;
|
||||
int start_phase1;
|
||||
int end_phase1;
|
||||
int start_phase2;
|
||||
int sub_count;
|
||||
unsigned long dirty_bitmap[4];
|
||||
unsigned long touch_bitmap[4];
|
||||
unsigned long slave_bitmap[4];
|
||||
unsigned long work_bitmap[4];
|
||||
#endif
|
||||
};
|
||||
|
||||
struct trans_logger_brick {
|
||||
|
|
Loading…
Reference in New Issue