mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 14:30:58 +07:00
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>
This commit is contained in:
parent
7b2b70851f
commit
644d1940ab
@ -112,6 +112,7 @@ struct send_ctx {
|
||||
int cur_inode_deleted;
|
||||
u64 cur_inode_size;
|
||||
u64 cur_inode_mode;
|
||||
u64 cur_inode_rdev;
|
||||
u64 cur_inode_last_extent;
|
||||
|
||||
u64 send_progress;
|
||||
@ -2439,10 +2440,16 @@ verbose_printk("btrfs: send_create_inode %llu\n", ino);
|
||||
if (!p)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = get_inode_info(sctx->send_root, ino, NULL, &gen, &mode, NULL,
|
||||
NULL, &rdev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
if (ino != sctx->cur_ino) {
|
||||
ret = get_inode_info(sctx->send_root, ino, NULL, &gen, &mode,
|
||||
NULL, NULL, &rdev);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
} else {
|
||||
gen = sctx->cur_inode_gen;
|
||||
mode = sctx->cur_inode_mode;
|
||||
rdev = sctx->cur_inode_rdev;
|
||||
}
|
||||
|
||||
if (S_ISREG(mode)) {
|
||||
cmd = BTRFS_SEND_C_MKFILE;
|
||||
@ -5027,6 +5034,8 @@ static int changed_inode(struct send_ctx *sctx,
|
||||
sctx->left_path->nodes[0], left_ii);
|
||||
sctx->cur_inode_mode = btrfs_inode_mode(
|
||||
sctx->left_path->nodes[0], left_ii);
|
||||
sctx->cur_inode_rdev = btrfs_inode_rdev(
|
||||
sctx->left_path->nodes[0], left_ii);
|
||||
if (sctx->cur_ino != BTRFS_FIRST_FREE_OBJECTID)
|
||||
ret = send_create_inode_if_needed(sctx);
|
||||
} else if (result == BTRFS_COMPARE_TREE_DELETED) {
|
||||
@ -5071,6 +5080,8 @@ static int changed_inode(struct send_ctx *sctx,
|
||||
sctx->left_path->nodes[0], left_ii);
|
||||
sctx->cur_inode_mode = btrfs_inode_mode(
|
||||
sctx->left_path->nodes[0], left_ii);
|
||||
sctx->cur_inode_rdev = btrfs_inode_rdev(
|
||||
sctx->left_path->nodes[0], left_ii);
|
||||
ret = send_create_inode_if_needed(sctx);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user