summaryrefslogtreecommitdiff
path: root/utils.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 /utils.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 'utils.c')
-rw-r--r--utils.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/utils.c b/utils.c
index 31d19e81..a1a38a7e 100644
--- a/utils.c
+++ b/utils.c
@@ -32,9 +32,7 @@
#include "transaction.h"
#include "crc32c.h"
#include "utils.h"
-
static u64 reference_root_table[4] = {
- [0] = 0,
[1] = BTRFS_ROOT_TREE_OBJECTID,
[2] = BTRFS_EXTENT_TREE_OBJECTID,
[3] = BTRFS_FS_TREE_OBJECTID,
@@ -142,12 +140,10 @@ int make_btrfs(int fd, u64 blocks[4], u64 num_bytes, u32 nodesize,
extent_item = btrfs_item_ptr(buf, nritems, struct btrfs_extent_item);
btrfs_set_extent_refs(buf, extent_item, 1);
nritems++;
+ for (i = 1; i < 4; i++) {
+ BUG_ON(blocks[i] < first_free);
+ BUG_ON(blocks[i] < blocks[i - 1]);
- for (i = 0; i < 4; i++) {
- if (blocks[i] < first_free) {
- BUG_ON(i > 0);
- continue;
- }
/* create extent item */
itemoff = itemoff - sizeof(struct btrfs_extent_item);
btrfs_set_disk_key_objectid(&disk_key, blocks[i]);