mars/kernel/mars_aio.h

99 lines
2.1 KiB
C
Raw Normal View History

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>
#define AIO_SUBMIT_MAX_LATENCY 1000 // 1 ms
#define AIO_IO_R_MAX_LATENCY 50000 // 50 ms
#define AIO_IO_W_MAX_LATENCY 150000 // 150 ms
#define AIO_SYNC_MAX_LATENCY 150000 // 150 ms
extern struct threshold aio_submit_threshold;
extern struct threshold aio_io_threshold[2];
extern struct threshold aio_sync_threshold;
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;
unsigned long long enqueue_stamp;
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
bool o_creat;
2011-03-11 13:57:54 +00:00
bool o_direct;
bool o_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;
wait_queue_head_t terminate_event;
2010-11-26 13:45:10 +00:00
spinlock_t lock;
int queued[MARS_PRIO_NR];
2012-12-19 15:19:33 +00:00
atomic_t queued_sum;
2011-05-06 10:25:52 +00:00
atomic_t total_enqueue_count;
bool terminated;
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 mapfree_info *mf;
2010-11-26 13:45:10 +00:00
int fd; // FIXME: remove this!
struct aio_threadinfo tinfo[3];
loff_t old_size;
2010-11-26 13:45:10 +00:00
aio_context_t ctxp;
2011-04-29 09:36:10 +00:00
wait_queue_head_t fdsync_event;
2012-02-01 12:47:35 +00:00
bool fdsync_active;
2011-04-12 15:31:08 +00:00
// statistics
int index;
2011-04-12 15:31:08 +00:00
atomic_t total_read_count;
atomic_t total_write_count;
atomic_t total_alloc_count;
2012-12-20 10:32:47 +00:00
atomic_t total_submit_count;
2012-12-20 11:02:54 +00:00
atomic_t total_again_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;
2012-02-20 09:34:42 +00:00
atomic_t total_mapfree_count;
2011-04-12 15:31:08 +00:00
atomic_t read_count;
atomic_t write_count;
atomic_t alloc_count;
atomic_t submit_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