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))
|
|
|
|
|
2010-12-10 17:40:20 +00:00
|
|
|
#define MAX_BIO 8
|
|
|
|
|
2011-03-30 12:02:50 +00:00
|
|
|
#define IF_HASH_MAX 256
|
|
|
|
#define IF_HASH_CHUNK (1024 * 128)
|
|
|
|
|
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 maxlen;
|
|
|
|
int bio_count;
|
|
|
|
struct page *orig_page;
|
|
|
|
struct bio *orig_bio[MAX_BIO];
|
2010-08-08 14:02:54 +00:00
|
|
|
struct generic_callback cb;
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_input *input;
|
2010-07-23 11:55:18 +00:00
|
|
|
};
|
|
|
|
|
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-03-08 16:45:52 +00:00
|
|
|
atomic_t open_count;
|
2011-03-11 13:57:54 +00:00
|
|
|
atomic_t io_count;
|
2011-03-30 12:02:50 +00:00
|
|
|
atomic_t plugged_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;
|
2010-08-05 15:54:48 +00:00
|
|
|
struct generic_object_layout mref_object_layout;
|
2011-03-30 12:02:50 +00:00
|
|
|
spinlock_t hash_lock[IF_HASH_MAX];
|
|
|
|
struct list_head hash_table[IF_HASH_MAX];
|
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
|
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
|
2011-03-08 16:45:52 +00:00
|
|
|
bool has_closed;
|
2011-03-11 13:57:54 +00:00
|
|
|
// private
|
2011-03-07 10:27:38 +00:00
|
|
|
struct if_output hidden_output;
|
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
|