Commit bb14a59b authored by Miao Xie's avatar Miao Xie Committed by Josef Bacik

Btrfs: use signed integer instead of unsigned long integer for log transid

The log trans id is initialized to be 0 every time we create a log tree,
and the log tree need be re-created after a new transaction is started,
it means the log trans id is unlikely to be a huge number, so we can use
signed integer instead of unsigned long integer to save a bit space.
Signed-off-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
parent 7483e1a4
...@@ -109,14 +109,17 @@ struct btrfs_inode { ...@@ -109,14 +109,17 @@ struct btrfs_inode {
u64 last_trans; u64 last_trans;
/* /*
* log transid when this inode was last modified * transid that last logged this inode
*/ */
u64 last_sub_trans; u64 logged_trans;
/* /*
* transid that last logged this inode * log transid when this inode was last modified
*/ */
u64 logged_trans; int last_sub_trans;
/* a local copy of root's last_log_commit */
int last_log_commit;
/* total number of bytes pending delalloc, used by stat to calc the /* total number of bytes pending delalloc, used by stat to calc the
* real block usage of the file * real block usage of the file
...@@ -155,9 +158,6 @@ struct btrfs_inode { ...@@ -155,9 +158,6 @@ struct btrfs_inode {
/* flags field from the on disk inode */ /* flags field from the on disk inode */
u32 flags; u32 flags;
/* a local copy of root's last_log_commit */
unsigned long last_log_commit;
/* /*
* Counters to keep track of the number of extent item's we may use due * Counters to keep track of the number of extent item's we may use due
* to delalloc and such. outstanding_extents is the number of extent * to delalloc and such. outstanding_extents is the number of extent
......
...@@ -1721,8 +1721,8 @@ struct btrfs_root { ...@@ -1721,8 +1721,8 @@ struct btrfs_root {
atomic_t log_writers; atomic_t log_writers;
atomic_t log_commit[2]; atomic_t log_commit[2];
atomic_t log_batch; atomic_t log_batch;
unsigned long log_transid; int log_transid;
unsigned long last_log_commit; int last_log_commit;
pid_t log_start_pid; pid_t log_start_pid;
bool log_multiple_pids; bool log_multiple_pids;
......
...@@ -2362,7 +2362,7 @@ static int update_log_root(struct btrfs_trans_handle *trans, ...@@ -2362,7 +2362,7 @@ static int update_log_root(struct btrfs_trans_handle *trans,
} }
static int wait_log_commit(struct btrfs_trans_handle *trans, static int wait_log_commit(struct btrfs_trans_handle *trans,
struct btrfs_root *root, unsigned long transid) struct btrfs_root *root, int transid)
{ {
DEFINE_WAIT(wait); DEFINE_WAIT(wait);
int index = transid % 2; int index = transid % 2;
...@@ -2434,7 +2434,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans, ...@@ -2434,7 +2434,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
int ret; int ret;
struct btrfs_root *log = root->log_root; struct btrfs_root *log = root->log_root;
struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
unsigned long log_transid = 0; int log_transid = 0;
struct blk_plug plug; struct blk_plug plug;
mutex_lock(&root->log_mutex); mutex_lock(&root->log_mutex);
......
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