David Sterba | c1d7c51 | 2018-04-03 19:23:33 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2008 Oracle. All rights reserved. |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 4 | */ |
David Sterba | c1d7c51 | 2018-04-03 19:23:33 +0200 | [diff] [blame] | 5 | |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 6 | #include <linux/sched.h> |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 7 | #include <linux/pagemap.h> |
| 8 | #include <linux/spinlock.h> |
| 9 | #include <linux/page-flags.h> |
Chris Mason | 4881ee5 | 2008-07-24 09:51:08 -0400 | [diff] [blame] | 10 | #include <asm/bug.h> |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 11 | #include "ctree.h" |
| 12 | #include "extent_io.h" |
| 13 | #include "locking.h" |
| 14 | |
Eric Sandeen | 48a3b63 | 2013-04-25 20:41:01 +0000 | [diff] [blame] | 15 | static void btrfs_assert_tree_read_locked(struct extent_buffer *eb); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 16 | |
David Sterba | e4e9fd0 | 2018-08-24 14:45:20 +0200 | [diff] [blame] | 17 | #ifdef CONFIG_BTRFS_DEBUG |
| 18 | static void btrfs_assert_spinning_writers_get(struct extent_buffer *eb) |
| 19 | { |
| 20 | WARN_ON(atomic_read(&eb->spinning_writers)); |
| 21 | atomic_inc(&eb->spinning_writers); |
| 22 | } |
| 23 | |
| 24 | static void btrfs_assert_spinning_writers_put(struct extent_buffer *eb) |
| 25 | { |
| 26 | WARN_ON(atomic_read(&eb->spinning_writers) != 1); |
| 27 | atomic_dec(&eb->spinning_writers); |
| 28 | } |
| 29 | |
| 30 | static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb) |
| 31 | { |
| 32 | WARN_ON(atomic_read(&eb->spinning_writers)); |
| 33 | } |
| 34 | |
David Sterba | 225948d | 2018-08-24 15:53:42 +0200 | [diff] [blame^] | 35 | static void btrfs_assert_spinning_readers_get(struct extent_buffer *eb) |
| 36 | { |
| 37 | atomic_inc(&eb->spinning_readers); |
| 38 | } |
| 39 | |
| 40 | static void btrfs_assert_spinning_readers_put(struct extent_buffer *eb) |
| 41 | { |
| 42 | WARN_ON(atomic_read(&eb->spinning_readers) == 0); |
| 43 | atomic_dec(&eb->spinning_readers); |
| 44 | } |
| 45 | |
David Sterba | e4e9fd0 | 2018-08-24 14:45:20 +0200 | [diff] [blame] | 46 | #else |
| 47 | static void btrfs_assert_spinning_writers_get(struct extent_buffer *eb) { } |
| 48 | static void btrfs_assert_spinning_writers_put(struct extent_buffer *eb) { } |
| 49 | static void btrfs_assert_no_spinning_writers(struct extent_buffer *eb) { } |
David Sterba | 225948d | 2018-08-24 15:53:42 +0200 | [diff] [blame^] | 50 | static void btrfs_assert_spinning_readers_put(struct extent_buffer *eb) { } |
| 51 | static void btrfs_assert_spinning_readers_get(struct extent_buffer *eb) { } |
David Sterba | e4e9fd0 | 2018-08-24 14:45:20 +0200 | [diff] [blame] | 52 | #endif |
| 53 | |
David Sterba | b95be2d | 2018-04-04 01:43:05 +0200 | [diff] [blame] | 54 | void btrfs_set_lock_blocking_read(struct extent_buffer *eb) |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 55 | { |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 56 | /* |
David Sterba | b95be2d | 2018-04-04 01:43:05 +0200 | [diff] [blame] | 57 | * No lock is required. The lock owner may change if we have a read |
| 58 | * lock, but it won't change to or away from us. If we have the write |
| 59 | * lock, we are the owner and it'll never change. |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 60 | */ |
| 61 | if (eb->lock_nested && current->pid == eb->lock_owner) |
| 62 | return; |
David Sterba | b95be2d | 2018-04-04 01:43:05 +0200 | [diff] [blame] | 63 | btrfs_assert_tree_read_locked(eb); |
| 64 | atomic_inc(&eb->blocking_readers); |
| 65 | WARN_ON(atomic_read(&eb->spinning_readers) == 0); |
| 66 | atomic_dec(&eb->spinning_readers); |
| 67 | read_unlock(&eb->lock); |
| 68 | } |
| 69 | |
| 70 | void btrfs_set_lock_blocking_write(struct extent_buffer *eb) |
| 71 | { |
| 72 | /* |
| 73 | * No lock is required. The lock owner may change if we have a read |
| 74 | * lock, but it won't change to or away from us. If we have the write |
| 75 | * lock, we are the owner and it'll never change. |
| 76 | */ |
| 77 | if (eb->lock_nested && current->pid == eb->lock_owner) |
| 78 | return; |
| 79 | if (atomic_read(&eb->blocking_writers) == 0) { |
David Sterba | 843ccf9 | 2018-08-24 14:56:28 +0200 | [diff] [blame] | 80 | btrfs_assert_spinning_writers_put(eb); |
David Sterba | b95be2d | 2018-04-04 01:43:05 +0200 | [diff] [blame] | 81 | btrfs_assert_tree_locked(eb); |
| 82 | atomic_inc(&eb->blocking_writers); |
| 83 | write_unlock(&eb->lock); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 84 | } |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 85 | } |
Chris Mason | d397712 | 2009-01-05 21:25:51 -0500 | [diff] [blame] | 86 | |
David Sterba | aa12c02 | 2018-04-04 01:52:31 +0200 | [diff] [blame] | 87 | void btrfs_clear_lock_blocking_read(struct extent_buffer *eb) |
| 88 | { |
| 89 | /* |
| 90 | * No lock is required. The lock owner may change if we have a read |
| 91 | * lock, but it won't change to or away from us. If we have the write |
| 92 | * lock, we are the owner and it'll never change. |
| 93 | */ |
| 94 | if (eb->lock_nested && current->pid == eb->lock_owner) |
| 95 | return; |
| 96 | BUG_ON(atomic_read(&eb->blocking_readers) == 0); |
| 97 | read_lock(&eb->lock); |
| 98 | atomic_inc(&eb->spinning_readers); |
| 99 | /* atomic_dec_and_test implies a barrier */ |
| 100 | if (atomic_dec_and_test(&eb->blocking_readers)) |
| 101 | cond_wake_up_nomb(&eb->read_lock_wq); |
| 102 | } |
| 103 | |
| 104 | void btrfs_clear_lock_blocking_write(struct extent_buffer *eb) |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 105 | { |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 106 | /* |
| 107 | * no lock is required. The lock owner may change if |
| 108 | * we have a read lock, but it won't change to or away |
| 109 | * from us. If we have the write lock, we are the owner |
| 110 | * and it'll never change. |
| 111 | */ |
| 112 | if (eb->lock_nested && current->pid == eb->lock_owner) |
| 113 | return; |
David Sterba | aa12c02 | 2018-04-04 01:52:31 +0200 | [diff] [blame] | 114 | BUG_ON(atomic_read(&eb->blocking_writers) != 1); |
| 115 | write_lock(&eb->lock); |
David Sterba | 843ccf9 | 2018-08-24 14:56:28 +0200 | [diff] [blame] | 116 | btrfs_assert_spinning_writers_get(eb); |
David Sterba | aa12c02 | 2018-04-04 01:52:31 +0200 | [diff] [blame] | 117 | /* atomic_dec_and_test implies a barrier */ |
| 118 | if (atomic_dec_and_test(&eb->blocking_writers)) |
| 119 | cond_wake_up_nomb(&eb->write_lock_wq); |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | /* |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 123 | * take a spinning read lock. This will wait for any blocking |
| 124 | * writers |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 125 | */ |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 126 | void btrfs_tree_read_lock(struct extent_buffer *eb) |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 127 | { |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 128 | again: |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 129 | BUG_ON(!atomic_read(&eb->blocking_writers) && |
| 130 | current->pid == eb->lock_owner); |
| 131 | |
Arne Jansen | 5b25f70 | 2011-09-13 10:55:48 +0200 | [diff] [blame] | 132 | read_lock(&eb->lock); |
| 133 | if (atomic_read(&eb->blocking_writers) && |
| 134 | current->pid == eb->lock_owner) { |
| 135 | /* |
| 136 | * This extent is already write-locked by our thread. We allow |
| 137 | * an additional read lock to be added because it's for the same |
| 138 | * thread. btrfs_find_all_roots() depends on this as it may be |
| 139 | * called on a partly (write-)locked tree. |
| 140 | */ |
| 141 | BUG_ON(eb->lock_nested); |
| 142 | eb->lock_nested = 1; |
| 143 | read_unlock(&eb->lock); |
| 144 | return; |
| 145 | } |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 146 | if (atomic_read(&eb->blocking_writers)) { |
| 147 | read_unlock(&eb->lock); |
Liu Bo | 39f9d02 | 2012-12-27 09:01:22 +0000 | [diff] [blame] | 148 | wait_event(eb->write_lock_wq, |
| 149 | atomic_read(&eb->blocking_writers) == 0); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 150 | goto again; |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 151 | } |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 152 | atomic_inc(&eb->read_locks); |
| 153 | atomic_inc(&eb->spinning_readers); |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | /* |
Chris Mason | f82c458 | 2014-11-19 10:25:09 -0800 | [diff] [blame] | 157 | * take a spinning read lock. |
| 158 | * returns 1 if we get the read lock and 0 if we don't |
| 159 | * this won't wait for blocking writers |
| 160 | */ |
| 161 | int btrfs_tree_read_lock_atomic(struct extent_buffer *eb) |
| 162 | { |
| 163 | if (atomic_read(&eb->blocking_writers)) |
| 164 | return 0; |
| 165 | |
| 166 | read_lock(&eb->lock); |
| 167 | if (atomic_read(&eb->blocking_writers)) { |
| 168 | read_unlock(&eb->lock); |
| 169 | return 0; |
| 170 | } |
| 171 | atomic_inc(&eb->read_locks); |
| 172 | atomic_inc(&eb->spinning_readers); |
| 173 | return 1; |
| 174 | } |
| 175 | |
| 176 | /* |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 177 | * returns 1 if we get the read lock and 0 if we don't |
| 178 | * this won't wait for blocking writers |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 179 | */ |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 180 | int btrfs_try_tree_read_lock(struct extent_buffer *eb) |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 181 | { |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 182 | if (atomic_read(&eb->blocking_writers)) |
| 183 | return 0; |
Chris Mason | 66d7e85 | 2009-03-12 20:12:45 -0400 | [diff] [blame] | 184 | |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 185 | if (!read_trylock(&eb->lock)) |
| 186 | return 0; |
| 187 | |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 188 | if (atomic_read(&eb->blocking_writers)) { |
| 189 | read_unlock(&eb->lock); |
| 190 | return 0; |
Chris Mason | f9efa9c | 2008-06-25 16:14:04 -0400 | [diff] [blame] | 191 | } |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 192 | atomic_inc(&eb->read_locks); |
| 193 | atomic_inc(&eb->spinning_readers); |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 194 | return 1; |
| 195 | } |
| 196 | |
| 197 | /* |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 198 | * returns 1 if we get the read lock and 0 if we don't |
| 199 | * this won't wait for blocking writers or readers |
| 200 | */ |
| 201 | int btrfs_try_tree_write_lock(struct extent_buffer *eb) |
| 202 | { |
| 203 | if (atomic_read(&eb->blocking_writers) || |
| 204 | atomic_read(&eb->blocking_readers)) |
| 205 | return 0; |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 206 | |
Chris Mason | f82c458 | 2014-11-19 10:25:09 -0800 | [diff] [blame] | 207 | write_lock(&eb->lock); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 208 | if (atomic_read(&eb->blocking_writers) || |
| 209 | atomic_read(&eb->blocking_readers)) { |
| 210 | write_unlock(&eb->lock); |
| 211 | return 0; |
| 212 | } |
| 213 | atomic_inc(&eb->write_locks); |
David Sterba | 843ccf9 | 2018-08-24 14:56:28 +0200 | [diff] [blame] | 214 | btrfs_assert_spinning_writers_get(eb); |
Arne Jansen | 5b25f70 | 2011-09-13 10:55:48 +0200 | [diff] [blame] | 215 | eb->lock_owner = current->pid; |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 216 | return 1; |
| 217 | } |
| 218 | |
| 219 | /* |
| 220 | * drop a spinning read lock |
| 221 | */ |
| 222 | void btrfs_tree_read_unlock(struct extent_buffer *eb) |
| 223 | { |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 224 | /* |
| 225 | * if we're nested, we have the write lock. No new locking |
| 226 | * is needed as long as we are the lock owner. |
| 227 | * The write unlock will do a barrier for us, and the lock_nested |
| 228 | * field only matters to the lock owner. |
| 229 | */ |
| 230 | if (eb->lock_nested && current->pid == eb->lock_owner) { |
| 231 | eb->lock_nested = 0; |
| 232 | return; |
Arne Jansen | 5b25f70 | 2011-09-13 10:55:48 +0200 | [diff] [blame] | 233 | } |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 234 | btrfs_assert_tree_read_locked(eb); |
| 235 | WARN_ON(atomic_read(&eb->spinning_readers) == 0); |
| 236 | atomic_dec(&eb->spinning_readers); |
| 237 | atomic_dec(&eb->read_locks); |
| 238 | read_unlock(&eb->lock); |
| 239 | } |
| 240 | |
| 241 | /* |
| 242 | * drop a blocking read lock |
| 243 | */ |
| 244 | void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb) |
| 245 | { |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 246 | /* |
| 247 | * if we're nested, we have the write lock. No new locking |
| 248 | * is needed as long as we are the lock owner. |
| 249 | * The write unlock will do a barrier for us, and the lock_nested |
| 250 | * field only matters to the lock owner. |
| 251 | */ |
| 252 | if (eb->lock_nested && current->pid == eb->lock_owner) { |
| 253 | eb->lock_nested = 0; |
| 254 | return; |
Arne Jansen | 5b25f70 | 2011-09-13 10:55:48 +0200 | [diff] [blame] | 255 | } |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 256 | btrfs_assert_tree_read_locked(eb); |
| 257 | WARN_ON(atomic_read(&eb->blocking_readers) == 0); |
David Sterba | 093258e | 2018-02-26 16:15:17 +0100 | [diff] [blame] | 258 | /* atomic_dec_and_test implies a barrier */ |
| 259 | if (atomic_dec_and_test(&eb->blocking_readers)) |
| 260 | cond_wake_up_nomb(&eb->read_lock_wq); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 261 | atomic_dec(&eb->read_locks); |
| 262 | } |
| 263 | |
| 264 | /* |
| 265 | * take a spinning write lock. This will wait for both |
| 266 | * blocking readers or writers |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 267 | */ |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 268 | void btrfs_tree_lock(struct extent_buffer *eb) |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 269 | { |
Zhaolei | 166f66d | 2015-08-06 22:39:36 +0800 | [diff] [blame] | 270 | WARN_ON(eb->lock_owner == current->pid); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 271 | again: |
| 272 | wait_event(eb->read_lock_wq, atomic_read(&eb->blocking_readers) == 0); |
| 273 | wait_event(eb->write_lock_wq, atomic_read(&eb->blocking_writers) == 0); |
| 274 | write_lock(&eb->lock); |
David Sterba | 970e74d | 2018-04-04 02:11:50 +0200 | [diff] [blame] | 275 | if (atomic_read(&eb->blocking_readers) || |
| 276 | atomic_read(&eb->blocking_writers)) { |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 277 | write_unlock(&eb->lock); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 278 | goto again; |
| 279 | } |
David Sterba | 843ccf9 | 2018-08-24 14:56:28 +0200 | [diff] [blame] | 280 | btrfs_assert_spinning_writers_get(eb); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 281 | atomic_inc(&eb->write_locks); |
Arne Jansen | 5b25f70 | 2011-09-13 10:55:48 +0200 | [diff] [blame] | 282 | eb->lock_owner = current->pid; |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 283 | } |
| 284 | |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 285 | /* |
| 286 | * drop a spinning or a blocking write lock. |
| 287 | */ |
Jeff Mahoney | 143bede | 2012-03-01 14:56:26 +0100 | [diff] [blame] | 288 | void btrfs_tree_unlock(struct extent_buffer *eb) |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 289 | { |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 290 | int blockers = atomic_read(&eb->blocking_writers); |
Chris Mason | b4ce94d | 2009-02-04 09:25:08 -0500 | [diff] [blame] | 291 | |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 292 | BUG_ON(blockers > 1); |
| 293 | |
| 294 | btrfs_assert_tree_locked(eb); |
Chris Mason | ea4ebde | 2014-06-19 14:16:52 -0700 | [diff] [blame] | 295 | eb->lock_owner = 0; |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 296 | atomic_dec(&eb->write_locks); |
| 297 | |
| 298 | if (blockers) { |
David Sterba | 843ccf9 | 2018-08-24 14:56:28 +0200 | [diff] [blame] | 299 | btrfs_assert_no_spinning_writers(eb); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 300 | atomic_dec(&eb->blocking_writers); |
David Sterba | 093258e | 2018-02-26 16:15:17 +0100 | [diff] [blame] | 301 | /* Use the lighter barrier after atomic */ |
Nikolay Borisov | 2e32ef8 | 2018-02-14 14:37:26 +0200 | [diff] [blame] | 302 | smp_mb__after_atomic(); |
David Sterba | 093258e | 2018-02-26 16:15:17 +0100 | [diff] [blame] | 303 | cond_wake_up_nomb(&eb->write_lock_wq); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 304 | } else { |
David Sterba | 843ccf9 | 2018-08-24 14:56:28 +0200 | [diff] [blame] | 305 | btrfs_assert_spinning_writers_put(eb); |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 306 | write_unlock(&eb->lock); |
| 307 | } |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 308 | } |
| 309 | |
Chris Mason | b9447ef8 | 2009-03-09 11:45:38 -0400 | [diff] [blame] | 310 | void btrfs_assert_tree_locked(struct extent_buffer *eb) |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 311 | { |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 312 | BUG_ON(!atomic_read(&eb->write_locks)); |
| 313 | } |
| 314 | |
Eric Sandeen | 48a3b63 | 2013-04-25 20:41:01 +0000 | [diff] [blame] | 315 | static void btrfs_assert_tree_read_locked(struct extent_buffer *eb) |
Chris Mason | bd68151 | 2011-07-16 15:23:14 -0400 | [diff] [blame] | 316 | { |
| 317 | BUG_ON(!atomic_read(&eb->read_locks)); |
Chris Mason | 925baed | 2008-06-25 16:01:30 -0400 | [diff] [blame] | 318 | } |