1 #ifndef _BCACHE_BLOCKDEV_TYPES_H
2 #define _BCACHE_BLOCKDEV_TYPES_H
4 #include "keybuf_types.h"
5 #include "stats_types.h"
6 #include "super_types.h"
17 struct bkey_i_inode_blockdev inode;
18 struct mutex inode_lock;
20 #define BCACHEDEVNAME_SIZE 12
21 char name[BCACHEDEVNAME_SIZE];
26 #define BCACHE_DEV_CLOSING 0
27 #define BCACHE_DEV_DETACHING 1
28 #define BCACHE_DEV_UNLINK_DONE 2
32 atomic_t *stripe_sectors_dirty;
33 unsigned long *full_dirty_stripes;
35 struct bio_set bio_split;
39 int (*ioctl)(struct bcache_device *, fmode_t, unsigned, unsigned long);
43 /* Used to track sequential IO so it can be skipped */
44 struct hlist_node hash;
47 unsigned long last_io;
53 struct list_head list;
54 struct bcache_device disk;
56 //struct backingdev_sb sb;
59 struct backingdev_sb *sb;
60 struct block_device *bdev;
64 struct closure sb_write;
65 struct semaphore sb_write_mutex;
67 /* Refcount on the cache set. Always nonzero when we're caching. */
69 struct work_struct detach;
72 * Device might not be running if it's dirty and the cache set hasn't
78 * Writes take a shared lock from start to finish; scanning for dirty
79 * data to refill the rb tree requires an exclusive lock.
81 struct rw_semaphore writeback_lock;
84 * Nonzero, and writeback has a refcount (d->count), iff there is dirty
85 * data in the cache. Protected by writeback_lock; must have an
86 * shared lock to set and exclusive lock to clear.
90 /* for dynamic rate control of writeback */
91 struct bch_pd_controller writeback_pd;
92 struct delayed_work writeback_pd_update;
93 unsigned writeback_pd_update_seconds;
95 struct task_struct *writeback_thread;
96 struct keybuf writeback_keys;
97 mempool_t writeback_io_pool;
98 mempool_t writeback_page_pool;
100 /* For tracking sequential IO */
101 #define RECENT_IO_BITS 7
102 #define RECENT_IO (1 << RECENT_IO_BITS)
103 struct io io[RECENT_IO];
104 struct hlist_head io_hash[RECENT_IO + 1];
105 struct list_head io_lru;
108 struct cache_accounting accounting;
110 /* The rest of this all shows up in sysfs */
111 unsigned sequential_cutoff;
115 unsigned bypass_torture_test:1;
117 unsigned partial_stripes_expensive:1;
118 unsigned writeback_metadata:1;
119 unsigned writeback_running:1;
120 unsigned char writeback_percent;
123 #endif /* _BCACHE_BLOCKDEV_TYPES_H */