mars/mars_if.h

72 lines
1.4 KiB
C
Raw Normal View History

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-03-30 12:02:50 +00:00
#define IF_HASH_MAX 256
2011-03-31 04:41:42 +00:00
#define IF_HASH_CHUNK (1024 * 1024)
2011-03-30 12:02:50 +00:00
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;
2010-12-10 17:40:20 +00:00
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;
2011-03-31 16:16:00 +00:00
// only for statistics
atomic_t read_count;
atomic_t write_count;
atomic_t mref_read_count;
atomic_t 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;
2010-08-05 15:54:48 +00:00
struct generic_object_layout mref_object_layout;
2011-04-21 16:03:04 +00:00
struct mars_info info;
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