Skip to content

Commit bb14a59

Browse files
Miao XieJosef Bacik
authored andcommitted
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 <[email protected]> Signed-off-by: Josef Bacik <[email protected]>
1 parent 7483e1a commit bb14a59

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

fs/btrfs/btrfs_inode.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,17 @@ struct btrfs_inode {
109109
u64 last_trans;
110110

111111
/*
112-
* log transid when this inode was last modified
112+
* transid that last logged this inode
113113
*/
114-
u64 last_sub_trans;
114+
u64 logged_trans;
115115

116116
/*
117-
* transid that last logged this inode
117+
* log transid when this inode was last modified
118118
*/
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;
120123

121124
/* total number of bytes pending delalloc, used by stat to calc the
122125
* real block usage of the file
@@ -155,9 +158,6 @@ struct btrfs_inode {
155158
/* flags field from the on disk inode */
156159
u32 flags;
157160

158-
/* a local copy of root's last_log_commit */
159-
unsigned long last_log_commit;
160-
161161
/*
162162
* Counters to keep track of the number of extent item's we may use due
163163
* to delalloc and such. outstanding_extents is the number of extent

fs/btrfs/ctree.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,8 +1721,8 @@ struct btrfs_root {
17211721
atomic_t log_writers;
17221722
atomic_t log_commit[2];
17231723
atomic_t log_batch;
1724-
unsigned long log_transid;
1725-
unsigned long last_log_commit;
1724+
int log_transid;
1725+
int last_log_commit;
17261726
pid_t log_start_pid;
17271727
bool log_multiple_pids;
17281728

fs/btrfs/tree-log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2362,7 +2362,7 @@ static int update_log_root(struct btrfs_trans_handle *trans,
23622362
}
23632363

23642364
static int wait_log_commit(struct btrfs_trans_handle *trans,
2365-
struct btrfs_root *root, unsigned long transid)
2365+
struct btrfs_root *root, int transid)
23662366
{
23672367
DEFINE_WAIT(wait);
23682368
int index = transid % 2;
@@ -2434,7 +2434,7 @@ int btrfs_sync_log(struct btrfs_trans_handle *trans,
24342434
int ret;
24352435
struct btrfs_root *log = root->log_root;
24362436
struct btrfs_root *log_root_tree = root->fs_info->log_root_tree;
2437-
unsigned long log_transid = 0;
2437+
int log_transid = 0;
24382438
struct blk_plug plug;
24392439

24402440
mutex_lock(&root->log_mutex);

0 commit comments

Comments
 (0)