Commit cc37ea61 authored by David Sterba's avatar David Sterba

btrfs: convert __TRANS_* defines to enum bits

The base transaction bits can be defined as bits in a contiguous
sequence, although right now there's a hole from bit 1 to 8.

The bits are used for btrfs_trans_handle::type, and there's another set
of TRANS_STATE_* defines that are for btrfs_transaction::state. They are
mutually exclusive though the hole in the sequence looks like was made
for the states.
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
parent e0a8b9a7
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "btrfs_inode.h" #include "btrfs_inode.h"
#include "delayed-ref.h" #include "delayed-ref.h"
#include "ctree.h" #include "ctree.h"
#include "misc.h"
enum btrfs_trans_state { enum btrfs_trans_state {
TRANS_STATE_RUNNING, TRANS_STATE_RUNNING,
...@@ -98,14 +99,15 @@ struct btrfs_transaction { ...@@ -98,14 +99,15 @@ struct btrfs_transaction {
struct list_head releasing_ebs; struct list_head releasing_ebs;
}; };
#define __TRANS_FREEZABLE (1U << 0) enum {
ENUM_BIT(__TRANS_FREEZABLE),
#define __TRANS_START (1U << 9) ENUM_BIT(__TRANS_START),
#define __TRANS_ATTACH (1U << 10) ENUM_BIT(__TRANS_ATTACH),
#define __TRANS_JOIN (1U << 11) ENUM_BIT(__TRANS_JOIN),
#define __TRANS_JOIN_NOLOCK (1U << 12) ENUM_BIT(__TRANS_JOIN_NOLOCK),
#define __TRANS_DUMMY (1U << 13) ENUM_BIT(__TRANS_DUMMY),
#define __TRANS_JOIN_NOSTART (1U << 14) ENUM_BIT(__TRANS_JOIN_NOSTART),
};
#define TRANS_START (__TRANS_START | __TRANS_FREEZABLE) #define TRANS_START (__TRANS_START | __TRANS_FREEZABLE)
#define TRANS_ATTACH (__TRANS_ATTACH) #define TRANS_ATTACH (__TRANS_ATTACH)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment