2010-08-08 20:51:20 +00:00
|
|
|
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
|
|
|
|
#ifndef MARS_TRANS_LOGGER_H
|
|
|
|
#define MARS_TRANS_LOGGER_H
|
|
|
|
|
|
|
|
#define REGION_SIZE_BITS 22
|
|
|
|
#define REGION_SIZE (1 << REGION_SIZE_BITS)
|
2010-12-15 11:58:22 +00:00
|
|
|
#define TRANS_HASH_MAX 128
|
2010-08-08 20:51:20 +00:00
|
|
|
|
2010-08-11 16:02:08 +00:00
|
|
|
#include <linux/time.h>
|
2010-12-15 11:58:22 +00:00
|
|
|
#include "log_format.h"
|
2010-11-12 11:18:40 +00:00
|
|
|
#include "pairing_heap.h"
|
2010-08-08 20:51:20 +00:00
|
|
|
|
2010-08-11 16:02:08 +00:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-11-12 11:18:40 +00:00
|
|
|
_PAIRING_HEAP_TYPEDEF(mref,)
|
|
|
|
|
2010-08-11 16:02:08 +00:00
|
|
|
struct logger_queue {
|
|
|
|
struct list_head q_anchor;
|
2010-11-12 11:18:40 +00:00
|
|
|
struct pairing_heap_mref *heap_high;
|
|
|
|
struct pairing_heap_mref *heap_low;
|
|
|
|
loff_t heap_border;
|
2010-08-23 05:06:06 +00:00
|
|
|
spinlock_t q_lock;
|
|
|
|
atomic_t q_queued;
|
|
|
|
atomic_t q_flying;
|
2010-12-15 11:58:22 +00:00
|
|
|
long long q_last_action; // jiffies
|
2010-11-12 11:18:40 +00:00
|
|
|
// tunables
|
2010-12-15 11:58:22 +00:00
|
|
|
int q_max_queued;
|
2010-11-12 11:18:40 +00:00
|
|
|
int q_max_flying;
|
2010-12-15 11:58:22 +00:00
|
|
|
int q_max_jiffies;
|
2010-11-12 11:18:40 +00:00
|
|
|
bool q_ordering;
|
2010-08-08 20:51:20 +00:00
|
|
|
};
|
|
|
|
|
2010-08-11 16:02:08 +00:00
|
|
|
////////////////////////////////////////////////////////////////////
|
|
|
|
|
2010-08-08 20:51:20 +00:00
|
|
|
struct hash_anchor {
|
|
|
|
rwlock_t hash_lock;
|
|
|
|
struct list_head hash_anchor;
|
|
|
|
};
|
|
|
|
|
2010-08-11 16:02:08 +00:00
|
|
|
struct trans_logger_mars_ref_aspect {
|
|
|
|
GENERIC_ASPECT(mars_ref);
|
2010-12-15 11:58:22 +00:00
|
|
|
struct trans_logger_output *output;
|
2010-08-11 16:02:08 +00:00
|
|
|
struct list_head hash_head;
|
|
|
|
struct list_head q_head;
|
2010-11-12 11:18:40 +00:00
|
|
|
struct pairing_heap_mref ph;
|
2010-08-20 10:58:24 +00:00
|
|
|
struct trans_logger_mars_ref_aspect *shadow_ref;
|
2010-12-15 11:58:22 +00:00
|
|
|
void *orig_data;
|
2010-08-11 16:02:08 +00:00
|
|
|
struct timespec stamp;
|
|
|
|
struct generic_callback cb;
|
2010-08-20 10:58:24 +00:00
|
|
|
struct trans_logger_mars_ref_aspect *orig_mref_a;
|
2010-08-11 16:02:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct trans_logger_brick {
|
|
|
|
MARS_BRICK(trans_logger);
|
2010-12-15 11:58:22 +00:00
|
|
|
struct log_status logst;
|
2010-08-23 05:06:06 +00:00
|
|
|
// parameters
|
|
|
|
bool log_reads;
|
|
|
|
int limit_congest; // limit phase1 congestion.
|
2010-08-11 16:02:08 +00:00
|
|
|
};
|
|
|
|
|
2010-08-08 20:51:20 +00:00
|
|
|
struct trans_logger_output {
|
|
|
|
MARS_OUTPUT(trans_logger);
|
|
|
|
struct hash_anchor hash_table[TRANS_HASH_MAX];
|
2010-08-23 05:06:06 +00:00
|
|
|
atomic_t hash_count;
|
2010-08-26 17:12:30 +00:00
|
|
|
atomic_t fly_count;
|
2010-08-20 10:58:24 +00:00
|
|
|
struct task_struct *thread;
|
|
|
|
wait_queue_head_t event;
|
2010-08-11 16:02:08 +00:00
|
|
|
// queues
|
|
|
|
struct logger_queue q_phase1;
|
|
|
|
struct logger_queue q_phase2;
|
|
|
|
struct logger_queue q_phase3;
|
2010-08-20 10:58:24 +00:00
|
|
|
struct logger_queue q_phase4;
|
2010-08-11 16:02:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct trans_logger_input {
|
|
|
|
MARS_INPUT(trans_logger);
|
2010-08-08 20:51:20 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
MARS_TYPES(trans_logger);
|
|
|
|
|
|
|
|
#endif
|