summaryrefslogtreecommitdiff
path: root/disk-io.c
diff options
context:
space:
mode:
authorYan <yanzheng@21cn.com>2008-01-08 15:56:32 -0500
committerDavid Woodhouse <dwmw2@hera.kernel.org>2008-01-08 15:56:32 -0500
commitd1b729ac2be8b5be50d6fa262f5cfaf41bbf128a (patch)
treee07dcb35c84a4f8640f2e48cb20323f7641ca33e /disk-io.c
parentb86a82717235dbd1e716bebd1154fe7be1a1736b (diff)
Add rollback support for the converter
This patch adds rollback support for the converter, the converter can roll back a conversion if the image file haven't been modified. In addition, I rearrange some codes in convert.c and add a few comments.
Diffstat (limited to 'disk-io.c')
-rw-r--r--disk-io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/disk-io.c b/disk-io.c
index 96cafe6b..b662d07e 100644
--- a/disk-io.c
+++ b/disk-io.c
@@ -417,8 +417,13 @@ struct btrfs_root *open_ctree_fd(int fp, u64 sb_bytenr)
read_extent_buffer(fs_info->sb_buffer, fs_info->fsid,
(unsigned long)btrfs_super_fsid(fs_info->sb_buffer),
BTRFS_FSID_SIZE);
- disk_super = &fs_info->super_copy;
+ disk_super = &fs_info->super_copy;
+ if (strncmp((char *)(&disk_super->magic), BTRFS_MAGIC,
+ sizeof(disk_super->magic))) {
+ printk("No valid btrfs found\n");
+ BUG_ON(1);
+ }
nodesize = btrfs_super_nodesize(disk_super);
leafsize = btrfs_super_leafsize(disk_super);
sectorsize = btrfs_super_sectorsize(disk_super);