Skip to content

Commit b2ca1eb

Browse files
fdmananakdave
authored andcommitted
btrfs: add comments regarding locking to struct btrfs_delayed_ref_root
Add some comments to struct btrfs_delayed_ref_root's fields to mention what its spinlock protects. Reviewed-by: Boris Burkov <[email protected]> Reviewed-by: Qu Wenruo <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 97d079e commit b2ca1eb

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

fs/btrfs/delayed-ref.h

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,19 +213,33 @@ struct btrfs_delayed_ref_root {
213213
*/
214214
struct xarray dirty_extents;
215215

216-
/* this spin lock protects the rbtree and the entries inside */
216+
/*
217+
* Protects the rbtree href_root, its entries and the following fields:
218+
* num_heads, num_heads_ready, pending_csums and run_delayed_start.
219+
*/
217220
spinlock_t lock;
218221

219-
/* total number of head nodes in tree */
222+
/* Total number of head refs, protected by the spinlock 'lock'. */
220223
unsigned long num_heads;
221224

222-
/* total number of head nodes ready for processing */
225+
/*
226+
* Total number of head refs ready for processing, protected by the
227+
* spinlock 'lock'.
228+
*/
223229
unsigned long num_heads_ready;
224230

231+
/*
232+
* Track space reserved for deleting csums of data extents.
233+
* Protected by the spinlock 'lock'.
234+
*/
225235
u64 pending_csums;
226236

227237
unsigned long flags;
228238

239+
/*
240+
* Track from which bytenr to start searching ref heads.
241+
* Protected by the spinlock 'lock'.
242+
*/
229243
u64 run_delayed_start;
230244

231245
/*

0 commit comments

Comments
 (0)