aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/extent_io.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/extent_io.h')
-rw-r--r--fs/btrfs/extent_io.h55
1 files changed, 29 insertions, 26 deletions
diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
index a11a92ee2d3..7b2f0c3e792 100644
--- a/fs/btrfs/extent_io.h
+++ b/fs/btrfs/extent_io.h
@@ -76,15 +76,15 @@ struct extent_io_ops {
76 struct extent_state *state); 76 struct extent_state *state);
77 int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end, 77 int (*writepage_end_io_hook)(struct page *page, u64 start, u64 end,
78 struct extent_state *state, int uptodate); 78 struct extent_state *state, int uptodate);
79 int (*set_bit_hook)(struct inode *inode, struct extent_state *state, 79 void (*set_bit_hook)(struct inode *inode, struct extent_state *state,
80 int *bits); 80 int *bits);
81 int (*clear_bit_hook)(struct inode *inode, struct extent_state *state, 81 void (*clear_bit_hook)(struct inode *inode, struct extent_state *state,
82 int *bits); 82 int *bits);
83 int (*merge_extent_hook)(struct inode *inode, 83 void (*merge_extent_hook)(struct inode *inode,
84 struct extent_state *new, 84 struct extent_state *new,
85 struct extent_state *other); 85 struct extent_state *other);
86 int (*split_extent_hook)(struct inode *inode, 86 void (*split_extent_hook)(struct inode *inode,
87 struct extent_state *orig, u64 split); 87 struct extent_state *orig, u64 split);
88 int (*write_cache_pages_lock_hook)(struct page *page); 88 int (*write_cache_pages_lock_hook)(struct page *page);
89}; 89};
90 90
@@ -108,8 +108,6 @@ struct extent_state {
108 wait_queue_head_t wq; 108 wait_queue_head_t wq;
109 atomic_t refs; 109 atomic_t refs;
110 unsigned long state; 110 unsigned long state;
111 u64 split_start;
112 u64 split_end;
113 111
114 /* for use by the FS */ 112 /* for use by the FS */
115 u64 private; 113 u64 private;
@@ -120,8 +118,6 @@ struct extent_state {
120struct extent_buffer { 118struct extent_buffer {
121 u64 start; 119 u64 start;
122 unsigned long len; 120 unsigned long len;
123 char *map_token;
124 char *kaddr;
125 unsigned long map_start; 121 unsigned long map_start;
126 unsigned long map_len; 122 unsigned long map_len;
127 struct page *first_page; 123 struct page *first_page;
@@ -130,14 +126,26 @@ struct extent_buffer {
130 struct rcu_head rcu_head; 126 struct rcu_head rcu_head;
131 atomic_t refs; 127 atomic_t refs;
132 128
133 /* the spinlock is used to protect most operations */ 129 /* count of read lock holders on the extent buffer */
134 spinlock_t lock; 130 atomic_t write_locks;
131 atomic_t read_locks;
132 atomic_t blocking_writers;
133 atomic_t blocking_readers;
134 atomic_t spinning_readers;
135 atomic_t spinning_writers;
136
137 /* protects write locks */
138 rwlock_t lock;
135 139
136 /* 140 /* readers use lock_wq while they wait for the write
137 * when we keep the lock held while blocking, waiters go onto 141 * lock holders to unlock
138 * the wq
139 */ 142 */
140 wait_queue_head_t lock_wq; 143 wait_queue_head_t write_lock_wq;
144
145 /* writers use read_lock_wq while they wait for readers
146 * to unlock
147 */
148 wait_queue_head_t read_lock_wq;
141}; 149};
142 150
143static inline void extent_set_compress_type(unsigned long *bio_flags, 151static inline void extent_set_compress_type(unsigned long *bio_flags,
@@ -279,15 +287,10 @@ int clear_extent_buffer_uptodate(struct extent_io_tree *tree,
279int extent_buffer_uptodate(struct extent_io_tree *tree, 287int extent_buffer_uptodate(struct extent_io_tree *tree,
280 struct extent_buffer *eb, 288 struct extent_buffer *eb,
281 struct extent_state *cached_state); 289 struct extent_state *cached_state);
282int map_extent_buffer(struct extent_buffer *eb, unsigned long offset,
283 unsigned long min_len, char **token, char **map,
284 unsigned long *map_start,
285 unsigned long *map_len, int km);
286int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset, 290int map_private_extent_buffer(struct extent_buffer *eb, unsigned long offset,
287 unsigned long min_len, char **token, char **map, 291 unsigned long min_len, char **map,
288 unsigned long *map_start, 292 unsigned long *map_start,
289 unsigned long *map_len, int km); 293 unsigned long *map_len);
290void unmap_extent_buffer(struct extent_buffer *eb, char *token, int km);
291int extent_range_uptodate(struct extent_io_tree *tree, 294int extent_range_uptodate(struct extent_io_tree *tree,
292 u64 start, u64 end); 295 u64 start, u64 end);
293int extent_clear_unlock_delalloc(struct inode *inode, 296int extent_clear_unlock_delalloc(struct inode *inode,