aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/send.c
diff options
context:
space:
mode:
authorAlexander Block <ablock84@googlemail.com>2012-07-26 17:39:10 -0400
committerChris Mason <chris.mason@fusionio.com>2012-10-01 15:18:44 -0400
commit85a7b33b9653ade7b26b9f29765cb1f0719c1e84 (patch)
treef712e92afe59a31b7b5b30d04849d36e932f9b6f /fs/btrfs/send.c
parenta0d271cbfed1dd50278c6b06bead3d00ba0a88f9 (diff)
Btrfs: add rdev to get_inode_info in send/receive
We need rdev in the next commit. Signed-off-by: Alexander Block <ablock84@googlemail.com>
Diffstat (limited to 'fs/btrfs/send.c')
-rw-r--r--fs/btrfs/send.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c
index fb5ffe95f869..5721401548e8 100644
--- a/fs/btrfs/send.c
+++ b/fs/btrfs/send.c
@@ -687,7 +687,8 @@ out:
687 */ 687 */
688static int get_inode_info(struct btrfs_root *root, 688static int get_inode_info(struct btrfs_root *root,
689 u64 ino, u64 *size, u64 *gen, 689 u64 ino, u64 *size, u64 *gen,
690 u64 *mode, u64 *uid, u64 *gid) 690 u64 *mode, u64 *uid, u64 *gid,
691 u64 *rdev)
691{ 692{
692 int ret; 693 int ret;
693 struct btrfs_inode_item *ii; 694 struct btrfs_inode_item *ii;
@@ -721,6 +722,8 @@ static int get_inode_info(struct btrfs_root *root,
721 *uid = btrfs_inode_uid(path->nodes[0], ii); 722 *uid = btrfs_inode_uid(path->nodes[0], ii);
722 if (gid) 723 if (gid)
723 *gid = btrfs_inode_gid(path->nodes[0], ii); 724 *gid = btrfs_inode_gid(path->nodes[0], ii);
725 if (rdev)
726 *rdev = btrfs_inode_rdev(path->nodes[0], ii);
724 727
725out: 728out:
726 btrfs_free_path(path); 729 btrfs_free_path(path);
@@ -1081,7 +1084,8 @@ static int __iterate_backrefs(u64 ino, u64 offset, u64 root, void *ctx_)
1081 * There are inodes that have extents that lie behind it's i_size. Don't 1084 * There are inodes that have extents that lie behind it's i_size. Don't
1082 * accept clones from these extents. 1085 * accept clones from these extents.
1083 */ 1086 */
1084 ret = get_inode_info(found->root, ino, &i_size, NULL, NULL, NULL, NULL); 1087 ret = get_inode_info(found->root, ino, &i_size, NULL, NULL, NULL, NULL,
1088 NULL);
1085 if (ret < 0) 1089 if (ret < 0)
1086 return ret; 1090 return ret;
1087 1091
@@ -1404,7 +1408,7 @@ static int get_cur_inode_state(struct send_ctx *sctx, u64 ino, u64 gen)
1404 u64 right_gen; 1408 u64 right_gen;
1405 1409
1406 ret = get_inode_info(sctx->send_root, ino, NULL, &left_gen, NULL, NULL, 1410 ret = get_inode_info(sctx->send_root, ino, NULL, &left_gen, NULL, NULL,
1407 NULL); 1411 NULL, NULL);
1408 if (ret < 0 && ret != -ENOENT) 1412 if (ret < 0 && ret != -ENOENT)
1409 goto out; 1413 goto out;
1410 left_ret = ret; 1414 left_ret = ret;
@@ -1413,7 +1417,7 @@ static int get_cur_inode_state(struct send_ctx *sctx, u64 ino, u64 gen)
1413 right_ret = -ENOENT; 1417 right_ret = -ENOENT;
1414 } else { 1418 } else {
1415 ret = get_inode_info(sctx->parent_root, ino, NULL, &right_gen, 1419 ret = get_inode_info(sctx->parent_root, ino, NULL, &right_gen,
1416 NULL, NULL, NULL); 1420 NULL, NULL, NULL, NULL);
1417 if (ret < 0 && ret != -ENOENT) 1421 if (ret < 0 && ret != -ENOENT)
1418 goto out; 1422 goto out;
1419 right_ret = ret; 1423 right_ret = ret;
@@ -1557,7 +1561,7 @@ static int get_first_ref(struct send_ctx *sctx,
1557 btrfs_release_path(path); 1561 btrfs_release_path(path);
1558 1562
1559 ret = get_inode_info(root, found_key.offset, NULL, dir_gen, NULL, NULL, 1563 ret = get_inode_info(root, found_key.offset, NULL, dir_gen, NULL, NULL,
1560 NULL); 1564 NULL, NULL);
1561 if (ret < 0) 1565 if (ret < 0)
1562 goto out; 1566 goto out;
1563 1567
@@ -1628,7 +1632,7 @@ static int will_overwrite_ref(struct send_ctx *sctx, u64 dir, u64 dir_gen,
1628 1632
1629 if (other_inode > sctx->send_progress) { 1633 if (other_inode > sctx->send_progress) {
1630 ret = get_inode_info(sctx->parent_root, other_inode, NULL, 1634 ret = get_inode_info(sctx->parent_root, other_inode, NULL,
1631 who_gen, NULL, NULL, NULL); 1635 who_gen, NULL, NULL, NULL, NULL);
1632 if (ret < 0) 1636 if (ret < 0)
1633 goto out; 1637 goto out;
1634 1638
@@ -1671,7 +1675,7 @@ static int did_overwrite_ref(struct send_ctx *sctx,
1671 } 1675 }
1672 1676
1673 ret = get_inode_info(sctx->send_root, ow_inode, NULL, &gen, NULL, NULL, 1677 ret = get_inode_info(sctx->send_root, ow_inode, NULL, &gen, NULL, NULL,
1674 NULL); 1678 NULL, NULL);
1675 if (ret < 0) 1679 if (ret < 0)
1676 goto out; 1680 goto out;
1677 1681
@@ -2540,7 +2544,7 @@ int __finish_unordered_dir(int num, struct btrfs_key *di_key,
2540 fs_path_reset(fctx->cur_path); 2544 fs_path_reset(fctx->cur_path);
2541 2545
2542 ret = get_inode_info(sctx->send_root, di_key->objectid, 2546 ret = get_inode_info(sctx->send_root, di_key->objectid,
2543 NULL, &di_gen, &di_mode, NULL, NULL); 2547 NULL, &di_gen, &di_mode, NULL, NULL, NULL);
2544 if (ret < 0) 2548 if (ret < 0)
2545 goto out; 2549 goto out;
2546 2550
@@ -2971,7 +2975,7 @@ static int __record_new_ref(int num, u64 dir, int index,
2971 return -ENOMEM; 2975 return -ENOMEM;
2972 2976
2973 ret = get_inode_info(sctx->send_root, dir, NULL, &gen, NULL, NULL, 2977 ret = get_inode_info(sctx->send_root, dir, NULL, &gen, NULL, NULL,
2974 NULL); 2978 NULL, NULL);
2975 if (ret < 0) 2979 if (ret < 0)
2976 goto out; 2980 goto out;
2977 2981
@@ -3029,7 +3033,7 @@ static int __record_deleted_ref(int num, u64 dir, int index,
3029 return -ENOMEM; 3033 return -ENOMEM;
3030 3034
3031 ret = get_inode_info(sctx->parent_root, dir, NULL, &gen, NULL, NULL, 3035 ret = get_inode_info(sctx->parent_root, dir, NULL, &gen, NULL, NULL,
3032 NULL); 3036 NULL, NULL);
3033 if (ret < 0) 3037 if (ret < 0)
3034 goto out; 3038 goto out;
3035 3039
@@ -3642,7 +3646,7 @@ verbose_printk("btrfs: send_clone offset=%llu, len=%d, clone_root=%llu, "
3642 3646
3643 if (clone_root2 == sctx->send_root) { 3647 if (clone_root2 == sctx->send_root) {
3644 ret = get_inode_info(sctx->send_root, clone_root->ino, NULL, 3648 ret = get_inode_info(sctx->send_root, clone_root->ino, NULL,
3645 &gen, NULL, NULL, NULL); 3649 &gen, NULL, NULL, NULL, NULL);
3646 if (ret < 0) 3650 if (ret < 0)
3647 goto out; 3651 goto out;
3648 ret = get_cur_path(sctx, clone_root->ino, gen, p); 3652 ret = get_cur_path(sctx, clone_root->ino, gen, p);
@@ -4004,7 +4008,7 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end)
4004 goto out; 4008 goto out;
4005 4009
4006 ret = get_inode_info(sctx->send_root, sctx->cur_ino, NULL, NULL, 4010 ret = get_inode_info(sctx->send_root, sctx->cur_ino, NULL, NULL,
4007 &left_mode, &left_uid, &left_gid); 4011 &left_mode, &left_uid, &left_gid, NULL);
4008 if (ret < 0) 4012 if (ret < 0)
4009 goto out; 4013 goto out;
4010 4014
@@ -4015,7 +4019,7 @@ static int finish_inode_if_needed(struct send_ctx *sctx, int at_end)
4015 } else { 4019 } else {
4016 ret = get_inode_info(sctx->parent_root, sctx->cur_ino, 4020 ret = get_inode_info(sctx->parent_root, sctx->cur_ino,
4017 NULL, NULL, &right_mode, &right_uid, 4021 NULL, NULL, &right_mode, &right_uid,
4018 &right_gid); 4022 &right_gid, NULL);
4019 if (ret < 0) 4023 if (ret < 0)
4020 goto out; 4024 goto out;
4021 4025