2010-07-07 14:09:16 +00:00
|
|
|
// (c) 2010 Thomas Schoebel-Theuer / 1&1 Internet AG
|
|
|
|
#ifndef MARS_BUF_H
|
|
|
|
#define MARS_BUF_H
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
2010-07-23 11:55:18 +00:00
|
|
|
#include <asm/atomic.h>
|
2010-07-07 14:09:16 +00:00
|
|
|
|
2010-08-11 16:02:08 +00:00
|
|
|
//#define MARS_BUF_HASH_MAX 512
|
|
|
|
#define MARS_BUF_HASH_MAX 2048
|
2010-07-07 14:09:16 +00:00
|
|
|
|
2010-08-05 15:54:48 +00:00
|
|
|
struct buf_mars_ref_aspect {
|
|
|
|
GENERIC_ASPECT(mars_ref);
|
2010-08-07 15:02:16 +00:00
|
|
|
struct buf_head *rfa_bf;
|
|
|
|
struct list_head rfa_pending_head;
|
2010-08-04 17:32:04 +00:00
|
|
|
struct list_head tmp_head;
|
2010-08-08 14:02:54 +00:00
|
|
|
struct generic_callback cb;
|
2010-07-07 14:09:16 +00:00
|
|
|
};
|
|
|
|
|
2010-08-09 16:57:56 +00:00
|
|
|
struct cache_anchor {
|
|
|
|
spinlock_t hash_lock;
|
|
|
|
struct list_head hash_anchor;
|
|
|
|
};
|
|
|
|
|
2010-07-07 14:09:16 +00:00
|
|
|
struct buf_brick {
|
|
|
|
MARS_BRICK(buf);
|
2010-07-23 11:55:18 +00:00
|
|
|
/* brick parameters */
|
2010-07-07 14:09:16 +00:00
|
|
|
int backing_order;
|
|
|
|
int backing_size;
|
|
|
|
int max_count;
|
2010-07-23 11:55:18 +00:00
|
|
|
|
|
|
|
/* internals */
|
2010-08-07 15:02:16 +00:00
|
|
|
spinlock_t brick_lock;
|
2010-08-09 16:57:56 +00:00
|
|
|
atomic_t alloc_count;
|
|
|
|
atomic_t hashed_count;
|
2010-08-05 15:54:48 +00:00
|
|
|
atomic_t nr_io_pending;
|
2010-08-09 16:57:56 +00:00
|
|
|
atomic_t nr_collisions;
|
2010-08-05 15:54:48 +00:00
|
|
|
struct generic_object_layout mref_object_layout;
|
2010-07-07 14:09:16 +00:00
|
|
|
|
|
|
|
// lists for caching
|
|
|
|
struct list_head free_anchor; // members are not hashed
|
2010-08-07 07:59:34 +00:00
|
|
|
struct list_head lru_anchor; // members are hashed and not in use
|
2010-08-09 16:57:56 +00:00
|
|
|
struct cache_anchor cache_anchors[MARS_BUF_HASH_MAX]; // hash table
|
2010-07-07 14:09:16 +00:00
|
|
|
|
|
|
|
// for creation of bios
|
|
|
|
struct mars_info base_info;
|
|
|
|
int got_info;
|
|
|
|
int bvec_max;
|
2010-08-05 15:54:48 +00:00
|
|
|
|
|
|
|
// statistics
|
|
|
|
unsigned long last_jiffies;
|
|
|
|
atomic_t hit_count;
|
|
|
|
atomic_t miss_count;
|
|
|
|
atomic_t io_count;
|
2010-07-07 14:09:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct buf_input {
|
|
|
|
MARS_INPUT(buf);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct buf_output {
|
|
|
|
MARS_OUTPUT(buf);
|
|
|
|
};
|
|
|
|
|
|
|
|
MARS_TYPES(buf);
|
|
|
|
|
|
|
|
struct buf_head {
|
2010-07-23 11:55:18 +00:00
|
|
|
void *bf_data;
|
2010-08-07 15:02:16 +00:00
|
|
|
spinlock_t bf_lock;
|
2010-08-07 07:59:34 +00:00
|
|
|
struct buf_brick *bf_brick;
|
2010-08-07 15:02:16 +00:00
|
|
|
loff_t bf_pos;
|
|
|
|
unsigned int bf_base_index;
|
|
|
|
int bf_flags;
|
|
|
|
atomic_t bf_count;
|
|
|
|
int bf_bio_status;
|
|
|
|
atomic_t bf_bio_count;
|
2010-07-07 14:09:16 +00:00
|
|
|
// lists for caching
|
2010-08-05 15:54:48 +00:00
|
|
|
//struct list_head bf_mref_anchor; // all current mref members
|
2010-08-07 15:02:16 +00:00
|
|
|
struct list_head bf_lru_head;
|
|
|
|
struct list_head bf_hash_head;
|
2010-07-07 14:09:16 +00:00
|
|
|
// lists for IO
|
2010-08-07 15:02:16 +00:00
|
|
|
struct list_head bf_io_pending_anchor;
|
|
|
|
struct list_head bf_postpone_anchor;
|
2010-07-07 14:09:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|