2010-06-14 14:27:40 +00:00
|
|
|
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
|
2011-03-07 10:27:38 +00:00
|
|
|
#ifndef MARS_IF_H
|
|
|
|
#define MARS_IF_H
|
2010-06-20 18:55:34 +00:00
|
|
|
|
2010-12-10 17:40:20 +00:00
|
|
|
#include <linux/semaphore.h>
|
|
|
|
|
2010-07-05 15:56:58 +00:00
|
|
|
#define HT_SHIFT 6 //????
|
|
|
|
#define MARS_MAX_SEGMENT_SIZE (1U << (9+HT_SHIFT))
|
|
|
|
|
2011-03-31 04:41:42 +00:00
|
|
|
#define MAX_BIO 32
|
2010-12-10 17:40:20 +00:00
|
|
|
|
2011-12-08 15:38:04 +00:00
|
|
|
//#define USE_TIMER (HZ/10) // use this ONLY for debugging
|
2011-07-15 10:12:06 +00:00
|
|
|
|
2011-11-30 14:23:44 +00:00
|
|
|
/* I don't want to enhance / intrude into struct bio for compatibility reasons
|
|
|
|
* (support for a variety of kernel versions).
|
|
|
|
* The following is just a silly workaround which could be removed again.
|
|
|
|
*/
|
|
|
|
struct bio_wrapper {
|
|
|
|
struct bio *bio;
|
|
|
|
atomic_t bi_comp_cnt;
|
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_mref_aspect {
|
2010-12-15 12:13:18 +00:00
|
|
|
GENERIC_ASPECT(mref);
|
2010-12-10 17:40:20 +00:00
|
|
|
struct list_head plug_head;
|
2011-03-30 12:02:50 +00:00
|
|
|
struct list_head hash_head;
|
|
|
|
int hash_index;
|
2010-12-10 17:40:20 +00:00
|
|
|
int bio_count;
|
2011-04-21 16:03:04 +00:00
|
|
|
int current_len;
|
2011-04-08 09:52:46 +00:00
|
|
|
int max_len;
|
2011-04-21 16:03:04 +00:00
|
|
|
bool is_kmapped;
|
|
|
|
struct page *orig_page;
|
2011-11-30 14:23:44 +00:00
|
|
|
struct bio_wrapper *orig_biow[MAX_BIO];
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_input *input;
|
2010-07-23 11:55:18 +00:00
|
|
|
};
|
|
|
|
|
2013-04-12 11:43:43 +00:00
|
|
|
struct if_hash_anchor;
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_input {
|
|
|
|
MARS_INPUT(if);
|
2011-03-24 16:05:46 +00:00
|
|
|
// TODO: move this to if_brick (better systematics)
|
2010-12-10 17:40:20 +00:00
|
|
|
struct list_head plug_anchor;
|
2010-06-14 14:27:40 +00:00
|
|
|
struct request_queue *q;
|
|
|
|
struct gendisk *disk;
|
|
|
|
struct block_device *bdev;
|
2011-07-15 10:12:06 +00:00
|
|
|
#ifdef USE_TIMER
|
|
|
|
struct timer_list timer;
|
|
|
|
#endif
|
2012-08-08 13:50:41 +00:00
|
|
|
unsigned long capacity;
|
2011-03-30 12:02:50 +00:00
|
|
|
atomic_t plugged_count;
|
2011-05-19 11:36:00 +00:00
|
|
|
atomic_t flying_count;
|
2011-03-31 16:16:00 +00:00
|
|
|
// only for statistics
|
2011-05-19 11:36:00 +00:00
|
|
|
atomic_t read_flying_count;
|
|
|
|
atomic_t write_flying_count;
|
2011-08-05 09:26:24 +00:00
|
|
|
atomic_t total_reada_count;
|
2011-05-19 11:36:00 +00:00
|
|
|
atomic_t total_read_count;
|
|
|
|
atomic_t total_write_count;
|
2011-07-15 10:12:06 +00:00
|
|
|
atomic_t total_empty_count;
|
2013-01-03 08:49:52 +00:00
|
|
|
atomic_t total_fire_count;
|
|
|
|
atomic_t total_skip_sync_count;
|
2011-05-19 11:36:00 +00:00
|
|
|
atomic_t total_mref_read_count;
|
|
|
|
atomic_t total_mref_write_count;
|
2010-06-18 11:44:14 +00:00
|
|
|
spinlock_t req_lock;
|
2010-12-10 17:40:20 +00:00
|
|
|
struct semaphore kick_sem;
|
2013-04-12 11:43:43 +00:00
|
|
|
struct if_hash_anchor *hash_table;
|
2010-06-14 14:27:40 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_output {
|
|
|
|
MARS_OUTPUT(if);
|
2010-06-14 14:27:40 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_brick {
|
|
|
|
MARS_BRICK(if);
|
2011-03-11 13:57:54 +00:00
|
|
|
// parameters
|
2012-08-08 13:50:41 +00:00
|
|
|
loff_t dev_size;
|
2011-03-30 12:02:50 +00:00
|
|
|
int max_plugged;
|
2011-03-11 13:57:54 +00:00
|
|
|
int readahead;
|
2011-03-24 16:05:46 +00:00
|
|
|
bool skip_sync;
|
2011-03-11 13:57:54 +00:00
|
|
|
// inspectable
|
2013-05-04 19:54:12 +00:00
|
|
|
atomic_t open_count;
|
2011-03-11 13:57:54 +00:00
|
|
|
// private
|
2011-11-08 12:33:13 +00:00
|
|
|
struct semaphore switch_sem;
|
2012-11-15 12:53:26 +00:00
|
|
|
struct say_channel *say_channel;
|
2010-08-10 17:39:30 +00:00
|
|
|
};
|
|
|
|
|
2011-03-07 10:27:38 +00:00
|
|
|
MARS_TYPES(if);
|
2010-06-20 18:55:34 +00:00
|
|
|
|
|
|
|
#endif
|