mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
btrfs: update stale comment at extent_io_tree_release()
There's this comment at extent_io_tree_release() that mentions io btrees,
but this function is no longer used only for io btrees. Originally it was
added as a static function named clear_btree_io_tree() at transaction.c,
in commit 663dfbb077
("Btrfs: deal with convert_extent_bit errors to
avoid fs corruption"), as it was used only for cleaning one of the io
trees that track dirty extent buffers, the dirty_log_pages io tree of a
a root and the dirty_pages io tree of a transaction. Later it was renamed
and exported and now it's used to cleanup other io trees such as the
allocation state io tree of a device or the csums range io tree of a log
root.
So remove that comment and replace it with one at the top of the function
that is more complete, mentioning what the function does and that it's
expected to be called only when a task is sure no one else will need to
use the tree anymore, as well as there should be no locked ranges in the
tree and therefore no waiters on its extent state records. Also add an
assertion to check that there are no locked extent state records in the
tree.
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
c91ea4bfa6
commit
bea22a58c9
@ -105,6 +105,13 @@ void extent_io_tree_init(struct btrfs_fs_info *fs_info,
|
||||
lockdep_set_class(&tree->lock, &file_extent_tree_class);
|
||||
}
|
||||
|
||||
/*
|
||||
* Empty an io tree, removing and freeing every extent state record from the
|
||||
* tree. This should be called once we are sure no other task can access the
|
||||
* tree anymore, so no tree updates happen after we empty the tree and there
|
||||
* aren't any waiters on any extent state record (EXTENT_LOCKED bit is never
|
||||
* set on any extent state when calling this function).
|
||||
*/
|
||||
void extent_io_tree_release(struct extent_io_tree *tree)
|
||||
{
|
||||
spin_lock(&tree->lock);
|
||||
@ -122,10 +129,7 @@ void extent_io_tree_release(struct extent_io_tree *tree)
|
||||
state = rb_entry(node, struct extent_state, rb_node);
|
||||
rb_erase(&state->rb_node, &tree->state);
|
||||
RB_CLEAR_NODE(&state->rb_node);
|
||||
/*
|
||||
* btree io trees aren't supposed to have tasks waiting for
|
||||
* changes in the flags of extent states ever.
|
||||
*/
|
||||
ASSERT(!(state->state & EXTENT_LOCKED));
|
||||
ASSERT(!waitqueue_active(&state->wq));
|
||||
free_extent_state(state);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user