Commit 51fab693 authored by Liu Bo's avatar Liu Bo Committed by Josef Bacik

Btrfs: use token to avoid times mapping extent buffer

The API in tree log code has done sort of changes, and it proves that
we can benifit from using token, so do the same thing here.

function_graph tracer's timer shows that it costs nearly half time
of before(39.788us -> 22.391us).
Signed-off-by: default avatarLiu Bo <bo.li.liu@oracle.com>
Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
parent dcfac415
...@@ -2715,34 +2715,41 @@ static void fill_inode_item(struct btrfs_trans_handle *trans, ...@@ -2715,34 +2715,41 @@ static void fill_inode_item(struct btrfs_trans_handle *trans,
struct btrfs_inode_item *item, struct btrfs_inode_item *item,
struct inode *inode) struct inode *inode)
{ {
btrfs_set_inode_uid(leaf, item, i_uid_read(inode)); struct btrfs_map_token token;
btrfs_set_inode_gid(leaf, item, i_gid_read(inode));
btrfs_set_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size); btrfs_init_map_token(&token);
btrfs_set_inode_mode(leaf, item, inode->i_mode);
btrfs_set_inode_nlink(leaf, item, inode->i_nlink); btrfs_set_token_inode_uid(leaf, item, i_uid_read(inode), &token);
btrfs_set_token_inode_gid(leaf, item, i_gid_read(inode), &token);
btrfs_set_timespec_sec(leaf, btrfs_inode_atime(item), btrfs_set_token_inode_size(leaf, item, BTRFS_I(inode)->disk_i_size,
inode->i_atime.tv_sec); &token);
btrfs_set_timespec_nsec(leaf, btrfs_inode_atime(item), btrfs_set_token_inode_mode(leaf, item, inode->i_mode, &token);
inode->i_atime.tv_nsec); btrfs_set_token_inode_nlink(leaf, item, inode->i_nlink, &token);
btrfs_set_timespec_sec(leaf, btrfs_inode_mtime(item), btrfs_set_token_timespec_sec(leaf, btrfs_inode_atime(item),
inode->i_mtime.tv_sec); inode->i_atime.tv_sec, &token);
btrfs_set_timespec_nsec(leaf, btrfs_inode_mtime(item), btrfs_set_token_timespec_nsec(leaf, btrfs_inode_atime(item),
inode->i_mtime.tv_nsec); inode->i_atime.tv_nsec, &token);
btrfs_set_timespec_sec(leaf, btrfs_inode_ctime(item), btrfs_set_token_timespec_sec(leaf, btrfs_inode_mtime(item),
inode->i_ctime.tv_sec); inode->i_mtime.tv_sec, &token);
btrfs_set_timespec_nsec(leaf, btrfs_inode_ctime(item), btrfs_set_token_timespec_nsec(leaf, btrfs_inode_mtime(item),
inode->i_ctime.tv_nsec); inode->i_mtime.tv_nsec, &token);
btrfs_set_inode_nbytes(leaf, item, inode_get_bytes(inode)); btrfs_set_token_timespec_sec(leaf, btrfs_inode_ctime(item),
btrfs_set_inode_generation(leaf, item, BTRFS_I(inode)->generation); inode->i_ctime.tv_sec, &token);
btrfs_set_inode_sequence(leaf, item, inode->i_version); btrfs_set_token_timespec_nsec(leaf, btrfs_inode_ctime(item),
btrfs_set_inode_transid(leaf, item, trans->transid); inode->i_ctime.tv_nsec, &token);
btrfs_set_inode_rdev(leaf, item, inode->i_rdev);
btrfs_set_inode_flags(leaf, item, BTRFS_I(inode)->flags); btrfs_set_token_inode_nbytes(leaf, item, inode_get_bytes(inode),
btrfs_set_inode_block_group(leaf, item, 0); &token);
btrfs_set_token_inode_generation(leaf, item, BTRFS_I(inode)->generation,
&token);
btrfs_set_token_inode_sequence(leaf, item, inode->i_version, &token);
btrfs_set_token_inode_transid(leaf, item, trans->transid, &token);
btrfs_set_token_inode_rdev(leaf, item, inode->i_rdev, &token);
btrfs_set_token_inode_flags(leaf, item, BTRFS_I(inode)->flags, &token);
btrfs_set_token_inode_block_group(leaf, item, 0, &token);
} }
/* /*
......
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