diff options
author | Liu Bo <bo.li.liu@oracle.com> | 2014-02-27 04:29:01 -0500 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:17:01 -0400 |
commit | 644d1940ab0f20d1ba13295827a86a8a0c8583f3 (patch) | |
tree | 94023f72680d776d79b5ff6d596a42ec2883605f /fs/btrfs/send.c | |
parent | 7b2b70851f862b68714f357d2926adbb6c574fdd (diff) |
Btrfs: skip search tree for REG files
It is really unnecessary to search tree again for @gen, @mode and @rdev
in the case of REG inodes' creation, as we've got btrfs_inode_item in sctx,
and @gen, @mode and @rdev can easily be fetched.
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r-- | fs/btrfs/send.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index ba23fef3c5e5..c2522e4e2c59 100644 --- a/fs/btrfs/send.c +++ b/fs/btrfs/send.c | |||
@@ -112,6 +112,7 @@ struct send_ctx { | |||
112 | int cur_inode_deleted; | 112 | int cur_inode_deleted; |
113 | u64 cur_inode_size; | 113 | u64 cur_inode_size; |
114 | u64 cur_inode_mode; | 114 | u64 cur_inode_mode; |
115 | u64 cur_inode_rdev; | ||
115 | u64 cur_inode_last_extent; | 116 | u64 cur_inode_last_extent; |
116 | 117 | ||
117 | u64 send_progress; | 118 | u64 send_progress; |
@@ -2439,10 +2440,16 @@ verbose_printk("btrfs: send_create_inode %llu\n", ino); | |||
2439 | if (!p) | 2440 | if (!p) |
2440 | return -ENOMEM; | 2441 | return -ENOMEM; |
2441 | 2442 | ||
2442 | ret = get_inode_info(sctx->send_root, ino, NULL, &gen, &mode, NULL, | 2443 | if (ino != sctx->cur_ino) { |
2443 | NULL, &rdev); | 2444 | ret = get_inode_info(sctx->send_root, ino, NULL, &gen, &mode, |
2444 | if (ret < 0) | 2445 | NULL, NULL, &rdev); |
2445 | goto out; | 2446 | if (ret < 0) |
2447 | goto out; | ||
2448 | } else { | ||
2449 | gen = sctx->cur_inode_gen; | ||
2450 | mode = sctx->cur_inode_mode; | ||
2451 | rdev = sctx->cur_inode_rdev; | ||
2452 | } | ||
2446 | 2453 | ||
2447 | if (S_ISREG(mode)) { | 2454 | if (S_ISREG(mode)) { |
2448 | cmd = BTRFS_SEND_C_MKFILE; | 2455 | cmd = BTRFS_SEND_C_MKFILE; |
@@ -5027,6 +5034,8 @@ static int changed_inode(struct send_ctx *sctx, | |||
5027 | sctx->left_path->nodes[0], left_ii); | 5034 | sctx->left_path->nodes[0], left_ii); |
5028 | sctx->cur_inode_mode = btrfs_inode_mode( | 5035 | sctx->cur_inode_mode = btrfs_inode_mode( |
5029 | sctx->left_path->nodes[0], left_ii); | 5036 | sctx->left_path->nodes[0], left_ii); |
5037 | sctx->cur_inode_rdev = btrfs_inode_rdev( | ||
5038 | sctx->left_path->nodes[0], left_ii); | ||
5030 | if (sctx->cur_ino != BTRFS_FIRST_FREE_OBJECTID) | 5039 | if (sctx->cur_ino != BTRFS_FIRST_FREE_OBJECTID) |
5031 | ret = send_create_inode_if_needed(sctx); | 5040 | ret = send_create_inode_if_needed(sctx); |
5032 | } else if (result == BTRFS_COMPARE_TREE_DELETED) { | 5041 | } else if (result == BTRFS_COMPARE_TREE_DELETED) { |
@@ -5071,6 +5080,8 @@ static int changed_inode(struct send_ctx *sctx, | |||
5071 | sctx->left_path->nodes[0], left_ii); | 5080 | sctx->left_path->nodes[0], left_ii); |
5072 | sctx->cur_inode_mode = btrfs_inode_mode( | 5081 | sctx->cur_inode_mode = btrfs_inode_mode( |
5073 | sctx->left_path->nodes[0], left_ii); | 5082 | sctx->left_path->nodes[0], left_ii); |
5083 | sctx->cur_inode_rdev = btrfs_inode_rdev( | ||
5084 | sctx->left_path->nodes[0], left_ii); | ||
5074 | ret = send_create_inode_if_needed(sctx); | 5085 | ret = send_create_inode_if_needed(sctx); |
5075 | if (ret < 0) | 5086 | if (ret < 0) |
5076 | goto out; | 5087 | goto out; |