Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5044ed4f authored by Nikolay Borisov's avatar Nikolay Borisov Committed by David Sterba
Browse files

btrfs: Remove unused locking functions



Those were split out of btrfs_clear_lock_blocking_rw by
aa12c027 ("btrfs: split btrfs_clear_lock_blocking_rw to read and write helpers")
however at that time this function was unused due to commit
52398340 ("Btrfs: kill btrfs_clear_path_blocking"). Put the final
nail in the coffin of those 2 functions.

Signed-off-by: default avatarNikolay Borisov <nborisov@suse.com>
Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent 8ddc3197
Loading
Loading
Loading
Loading
+0 −36
Original line number Diff line number Diff line
@@ -119,42 +119,6 @@ void btrfs_set_lock_blocking_write(struct extent_buffer *eb)
	}
}

void btrfs_clear_lock_blocking_read(struct extent_buffer *eb)
{
	trace_btrfs_clear_lock_blocking_read(eb);
	/*
	 * No lock is required.  The lock owner may change if we have a read
	 * lock, but it won't change to or away from us.  If we have the write
	 * lock, we are the owner and it'll never change.
	 */
	if (eb->lock_nested && current->pid == eb->lock_owner)
		return;
	BUG_ON(atomic_read(&eb->blocking_readers) == 0);
	read_lock(&eb->lock);
	btrfs_assert_spinning_readers_get(eb);
	/* atomic_dec_and_test implies a barrier */
	if (atomic_dec_and_test(&eb->blocking_readers))
		cond_wake_up_nomb(&eb->read_lock_wq);
}

void btrfs_clear_lock_blocking_write(struct extent_buffer *eb)
{
	trace_btrfs_clear_lock_blocking_write(eb);
	/*
	 * no lock is required.  The lock owner may change if
	 * we have a read lock, but it won't change to or away
	 * from us.  If we have the write lock, we are the owner
	 * and it'll never change.
	 */
	if (eb->lock_nested && current->pid == eb->lock_owner)
		return;
	write_lock(&eb->lock);
	BUG_ON(eb->blocking_writers != 1);
	btrfs_assert_spinning_writers_get(eb);
	if (--eb->blocking_writers == 0)
		cond_wake_up(&eb->write_lock_wq);
}

/*
 * take a spinning read lock.  This will wait for any blocking
 * writers
+0 −2
Original line number Diff line number Diff line
@@ -19,8 +19,6 @@ void btrfs_tree_read_unlock(struct extent_buffer *eb);
void btrfs_tree_read_unlock_blocking(struct extent_buffer *eb);
void btrfs_set_lock_blocking_read(struct extent_buffer *eb);
void btrfs_set_lock_blocking_write(struct extent_buffer *eb);
void btrfs_clear_lock_blocking_read(struct extent_buffer *eb);
void btrfs_clear_lock_blocking_write(struct extent_buffer *eb);
void btrfs_assert_tree_locked(struct extent_buffer *eb);
int btrfs_try_tree_read_lock(struct extent_buffer *eb);
int btrfs_try_tree_write_lock(struct extent_buffer *eb);
+0 −2
Original line number Diff line number Diff line
@@ -2086,8 +2086,6 @@ DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock);
DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_unlock_blocking);
DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_read);
DEFINE_BTRFS_LOCK_EVENT(btrfs_set_lock_blocking_write);
DEFINE_BTRFS_LOCK_EVENT(btrfs_clear_lock_blocking_read);
DEFINE_BTRFS_LOCK_EVENT(btrfs_clear_lock_blocking_write);
DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_read_lock);
DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock);
DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic);