2010-11-26 13:45:10 +00:00
|
|
|
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
|
2011-03-07 10:27:38 +00:00
|
|
|
#ifndef MARS_AIO_H
|
|
|
|
#define MARS_AIO_H
|
2010-11-26 13:45:10 +00:00
|
|
|
|
|
|
|
#include <linux/aio.h>
|
|
|
|
#include <linux/syscalls.h>
|
|
|
|
|
2011-07-05 07:07:06 +00:00
|
|
|
//#define USE_CLEVER_SYNC // TODO: NYI (should result in better write performance)
|
2011-07-01 14:07:56 +00:00
|
|
|
#ifdef USE_CLEVER_SYNC
|
|
|
|
|
|
|
|
#include "lib_pairing_heap.h"
|
|
|
|
|
|
|
|
_PAIRING_HEAP_TYPEDEF(sync,);
|
|
|
|
|
|
|
|
struct q_sync {
|
|
|
|
struct pairing_heap_sync *heap[MARS_PRIO_NR];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct aio_mref_aspect {
|
2010-12-15 12:13:18 +00:00
|
|
|
GENERIC_ASPECT(mref);
|
2011-07-01 14:07:56 +00:00
|
|
|
#ifdef USE_CLEVER_SYNC
|
|
|
|
struct pairing_heap_sync heap_head;
|
|
|
|
#endif
|
2010-11-26 13:45:10 +00:00
|
|
|
struct list_head io_head;
|
2011-03-10 11:40:06 +00:00
|
|
|
long long start_jiffies;
|
2010-11-26 13:45:10 +00:00
|
|
|
int resubmit;
|
2011-06-30 13:15:52 +00:00
|
|
|
int alloc_len;
|
2010-12-10 17:40:20 +00:00
|
|
|
bool do_dealloc;
|
2010-11-26 13:45:10 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct aio_brick {
|
|
|
|
MARS_BRICK(aio);
|
2011-03-11 13:57:54 +00:00
|
|
|
// parameters
|
|
|
|
int readahead;
|
|
|
|
bool o_direct;
|
|
|
|
bool o_fdsync;
|
2011-04-29 09:36:10 +00:00
|
|
|
bool wait_during_fdsync;
|
2010-11-26 13:45:10 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct aio_input {
|
|
|
|
MARS_INPUT(aio);
|
2010-11-26 13:45:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct aio_threadinfo {
|
2011-05-19 11:36:00 +00:00
|
|
|
struct list_head mref_list[MARS_PRIO_NR];
|
2011-03-07 10:27:38 +00:00
|
|
|
struct aio_output *output;
|
2010-11-26 13:45:10 +00:00
|
|
|
struct task_struct *thread;
|
|
|
|
wait_queue_head_t event;
|
|
|
|
spinlock_t lock;
|
2011-02-23 20:48:06 +00:00
|
|
|
bool terminated;
|
2011-05-06 10:25:52 +00:00
|
|
|
atomic_t total_enqueue_count;
|
|
|
|
atomic_t total_dequeue_count;
|
2010-11-26 13:45:10 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct aio_output {
|
|
|
|
MARS_OUTPUT(aio);
|
2010-11-26 13:45:10 +00:00
|
|
|
// private
|
|
|
|
struct file *filp;
|
|
|
|
int fd; // FIXME: remove this!
|
|
|
|
struct aio_threadinfo tinfo[3];
|
|
|
|
aio_context_t ctxp;
|
2011-04-29 09:36:10 +00:00
|
|
|
wait_queue_head_t fdsync_event;
|
|
|
|
volatile bool fdsync_active;
|
2011-04-12 15:31:08 +00:00
|
|
|
// statistics
|
|
|
|
atomic_t total_read_count;
|
|
|
|
atomic_t total_write_count;
|
|
|
|
atomic_t total_alloc_count;
|
2011-04-29 09:36:10 +00:00
|
|
|
atomic_t total_delay_count;
|
2011-05-06 10:25:52 +00:00
|
|
|
atomic_t total_msleep_count;
|
|
|
|
atomic_t total_fdsync_count;
|
2011-04-29 09:36:10 +00:00
|
|
|
atomic_t total_fdsync_wait_count;
|
2011-04-12 15:31:08 +00:00
|
|
|
atomic_t read_count;
|
|
|
|
atomic_t write_count;
|
|
|
|
atomic_t alloc_count;
|
2010-11-26 13:45:10 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
MARS_TYPES(aio);
|
2010-11-26 13:45:10 +00:00
|
|
|
|
|
|
|
#endif
|