Message ID | 20241003142727.203981-2-linux@treblig.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: Remove unused btrfs_try_tree_write_lock | expand |
On Thu, Oct 03, 2024 at 03:27:27PM +0100, linux@treblig.org wrote: > From: "Dr. David Alan Gilbert" <linux@treblig.org> > > btrfs_try_tree_write_lock() is unused since commit > 50b21d7a066f ("btrfs: submit a writeback bio per extent_buffer") > > Remove it (and it's associated trace). Looks good: Reviewed-by: Christoph Hellwig <hch@lst.de>
在 2024/10/3 23:57, linux@treblig.org 写道: > From: "Dr. David Alan Gilbert" <linux@treblig.org> > > btrfs_try_tree_write_lock() is unused since commit > 50b21d7a066f ("btrfs: submit a writeback bio per extent_buffer") > > Remove it (and it's associated trace). > > Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org> Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > --- > fs/btrfs/locking.c | 15 --------------- > fs/btrfs/locking.h | 1 - > include/trace/events/btrfs.h | 1 - > 3 files changed, 17 deletions(-) > > diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c > index 6a0b7abb5bd9..9a7a7b723305 100644 > --- a/fs/btrfs/locking.c > +++ b/fs/btrfs/locking.c > @@ -161,21 +161,6 @@ int btrfs_try_tree_read_lock(struct extent_buffer *eb) > return 0; > } > > -/* > - * Try-lock for write. > - * > - * Return 1 if the rwlock has been taken, 0 otherwise > - */ > -int btrfs_try_tree_write_lock(struct extent_buffer *eb) > -{ > - if (down_write_trylock(&eb->lock)) { > - btrfs_set_eb_lock_owner(eb, current->pid); > - trace_btrfs_try_tree_write_lock(eb); > - return 1; > - } > - return 0; > -} > - > /* > * Release read lock. > */ > diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h > index 3c15c75e0582..46c8be2afab1 100644 > --- a/fs/btrfs/locking.h > +++ b/fs/btrfs/locking.h > @@ -180,7 +180,6 @@ static inline void btrfs_tree_read_lock(struct extent_buffer *eb) > > void btrfs_tree_read_unlock(struct extent_buffer *eb); > int btrfs_try_tree_read_lock(struct extent_buffer *eb); > -int btrfs_try_tree_write_lock(struct extent_buffer *eb); > struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); > struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root); > struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root); > diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h > index bf60ad50011e..9b8d41a00234 100644 > --- a/include/trace/events/btrfs.h > +++ b/include/trace/events/btrfs.h > @@ -2341,7 +2341,6 @@ 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_try_tree_read_lock); > -DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); > DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); > > DECLARE_EVENT_CLASS(btrfs__space_info_update,
diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c index 6a0b7abb5bd9..9a7a7b723305 100644 --- a/fs/btrfs/locking.c +++ b/fs/btrfs/locking.c @@ -161,21 +161,6 @@ int btrfs_try_tree_read_lock(struct extent_buffer *eb) return 0; } -/* - * Try-lock for write. - * - * Return 1 if the rwlock has been taken, 0 otherwise - */ -int btrfs_try_tree_write_lock(struct extent_buffer *eb) -{ - if (down_write_trylock(&eb->lock)) { - btrfs_set_eb_lock_owner(eb, current->pid); - trace_btrfs_try_tree_write_lock(eb); - return 1; - } - return 0; -} - /* * Release read lock. */ diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h index 3c15c75e0582..46c8be2afab1 100644 --- a/fs/btrfs/locking.h +++ b/fs/btrfs/locking.h @@ -180,7 +180,6 @@ static inline void btrfs_tree_read_lock(struct extent_buffer *eb) void btrfs_tree_read_unlock(struct extent_buffer *eb); int btrfs_try_tree_read_lock(struct extent_buffer *eb); -int btrfs_try_tree_write_lock(struct extent_buffer *eb); struct extent_buffer *btrfs_lock_root_node(struct btrfs_root *root); struct extent_buffer *btrfs_read_lock_root_node(struct btrfs_root *root); struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root); diff --git a/include/trace/events/btrfs.h b/include/trace/events/btrfs.h index bf60ad50011e..9b8d41a00234 100644 --- a/include/trace/events/btrfs.h +++ b/include/trace/events/btrfs.h @@ -2341,7 +2341,6 @@ 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_try_tree_read_lock); -DEFINE_BTRFS_LOCK_EVENT(btrfs_try_tree_write_lock); DEFINE_BTRFS_LOCK_EVENT(btrfs_tree_read_lock_atomic); DECLARE_EVENT_CLASS(btrfs__space_info_update,