aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiao Xie <miaox@cn.fujitsu.com>2014-02-20 05:08:56 -0500
committerJosef Bacik <jbacik@fb.com>2014-03-10 15:16:42 -0400
commitbb14a59b619d3a9993c3fa04bb10347db35ca550 (patch)
tree5c2af85d47ef6eab469a4e33eb4f5a2820bdf077
parent7483e1a4464999c72b231af0efe39cb31fd73f14 (diff)
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: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fb.com>
-rw-r--r--fs/btrfs/btrfs_inode.h14
-rw-r--r--fs/btrfs/ctree.h4
-rw-r--r--fs/btrfs/tree-log.c4
3 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/btrfs_inode.h b/fs/btrfs/btrfs_inode.h
index 8fed2125689e..c9a24444ec9a 100644
--- a/fs/btrfs/btrfs_inode.h
+++ b/fs/btrfs/btrfs_inode.h
@@ -109,14 +109,17 @@ struct btrfs_inode {
109 u64 last_trans; 109 u64 last_trans;
110 110
111 /* 111 /*
112 * log transid when this inode was last modified 112 * transid that last logged this inode
113 */ 113 */
114 u64 last_sub_trans; 114 u64 logged_trans;
115 115
116 /* 116 /*
117 * transid that last logged this inode 117 * log transid when this inode was last modified
118 */ 118 */
119 u64 logged_trans; 119 int last_sub_trans;
120
121 /* a local copy of root's last_log_commit */
122 int last_log_commit;
120 123
121 /* total number of bytes pending delalloc, used by stat to calc the 124 /* total number of bytes pending delalloc, used by stat to calc the
122 * real block usage of the file 125 * real block usage of the file
@@ -155,9 +158,6 @@ struct btrfs_inode {
155 /* flags field from the on disk inode */ 158 /* flags field from the on disk inode */
156 u32 flags; 159 u32 flags;
157 160
158 /* a local copy of root's last_log_commit */
159 unsigned long last_log_commit;
160
161 /* 161 /*
162 * Counters to keep track of the number of extent item's we may use due 162 * Counters to keep track of the number of extent item's we may use due
163 * to delalloc and such. outstanding_extents is the number of extent 163 * to delalloc and such. outstanding_extents is the number of extent
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h
index dac6653d4cce..70c03f5f0953 100644
--- a/fs/btrfs/ctree.h
+++ b/fs/btrfs/ctree.h
@@ -1721,8 +1721,8 @@ struct btrfs_root {
1721 atomic_t log_writers; 1721 atomic_t log_writers;
1722 atomic_t log_commit[2]; 1722 atomic_t log_commit[2];
1723 atomic_t log_batch; 1723 atomic_t log_batch;
1724 unsigned long log_transid; 1724 int log_transid;
1725 unsigned long last_log_commit; 1725 int last_log_commit;
1726 pid_t log_start_pid; 1726 pid_t log_start_pid;
1727 bool log_multiple_pids; 1727 bool log_multiple_pids;
1728 1728
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 285c168391f3..128a904ceac0 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -2362,7 +2362,7 @@ static int update_log_root(struct btrfs_trans_handle *trans,
2362} 2362}
2363 2363
2364static int wait_log_commit(struct btrfs_trans_handle *trans, 2364static int wait_log_commit(struct btrfs_trans_handle *trans,
2365 struct btrfs_root *root, unsigned long transid) 2365 struct btrfs_root *root, int transid)
2366{ 2366{
2367 DEFINE_WAIT(wait); 2367 DEFINE_WAIT(wait);
2368 int index = transid % 2; 2368 int index = transid % 2;
@@ -2434,7 +2434,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
2434 int ret; 2434 int ret;
2435 struct btrfs_root *log = root->log_root; 2435 struct btrfs_root *log = root->log_root;
2436 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree; 2436 struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
2437 unsigned long log_transid = 0; 2437 int log_transid = 0;
2438 struct blk_plug plug; 2438 struct blk_plug plug;
2439 2439
2440 mutex_lock(&root->log_mutex); 2440 mutex_lock(&root->log_mutex);