The inode is already found, use the data and make restore friendlier.
Signed-off-by: Dan Merillat <dan.merillat@xxxxxxxxx>
---
cmds-restore.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/cmds-restore.c b/cmds-restore.c
index d2fc951..95ac487 100644
--- a/cmds-restore.c
+++ b/cmds-restore.c
@@ -567,12 +567,22 @@ static int copy_file(struct btrfs_root *root, int
fd, struct btrfs_key *key,
fprintf(stderr, "Ran out of memory\n");
return -ENOMEM;
}
+ struct timespec times[2];
+ int times_ok=0;
ret = btrfs_lookup_inode(NULL, root, path, key, 0);
if (ret == 0) {
inode_item = btrfs_item_ptr(path->nodes[0], path->slots[0],
struct btrfs_inode_item);
found_size = btrfs_inode_size(path->nodes[0], inode_item);
+ struct btrfs_timespec bts;
+ read_eb_member(path->nodes[0], inode_item, struct btrfs_inode_item,
atime, &bts);
+ times[0].tv_sec=bts.sec;
+ times[0].tv_nsec=bts.nsec;
+ read_eb_member(path->nodes[0], inode_item, struct btrfs_inode_item,
atime, &bts);
+ times[1].tv_sec=bts.sec;
+ times[1].tv_nsec=bts.nsec;
+ times_ok=1;
}
btrfs_release_path(path);
@@ -680,6 +690,8 @@ set_size:
if (ret)
return ret;
}
+ if (times_ok)
+ futimens(fd, times);
return 0;
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html