On Tue, Nov 27, 2018 at 08:53:55PM +0100, David Sterba wrote: > We can use simple enum for values that are not part of on-disk format: > tree lock types. > > Signed-off-by: David Sterba <dste...@suse.com> > --- > fs/btrfs/locking.h | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/fs/btrfs/locking.h b/fs/btrfs/locking.h > index 29135def468e..684d0ef4faa4 100644 > --- a/fs/btrfs/locking.h > +++ b/fs/btrfs/locking.h > @@ -6,10 +6,12 @@ > #ifndef BTRFS_LOCKING_H > #define BTRFS_LOCKING_H > > -#define BTRFS_WRITE_LOCK 1 > -#define BTRFS_READ_LOCK 2 > -#define BTRFS_WRITE_LOCK_BLOCKING 3 > -#define BTRFS_READ_LOCK_BLOCKING 4 > +enum { > + BTRFS_WRITE_LOCK,
See btrfs_set_path_blocking() and btrfs_release_path(); 0 means no lock, so this needs to be BTRFS_WRITE_LOCK = 1. I imagine that lockdep would catch this. > + BTRFS_READ_LOCK, > + BTRFS_WRITE_LOCK_BLOCKING, > + BTRFS_READ_LOCK_BLOCKING, > +}; > > void btrfs_tree_lock(struct extent_buffer *eb); > void btrfs_tree_unlock(struct extent_buffer *eb); > -- > 2.19.1 >