btrfs-progs: Replace usage of list_for_each with list_for_each_entry
[platform/upstream/btrfs-progs.git] / convert / main.c
index 882daf7..89f9261 100644 (file)
@@ -768,7 +768,7 @@ static int create_image(struct btrfs_root *root,
        if (ret < 0)
                goto out;
        ret = btrfs_add_link(trans, root, ino, BTRFS_FIRST_FREE_OBJECTID, name,
-                            strlen(name), BTRFS_FT_REG_FILE, NULL, 1);
+                            strlen(name), BTRFS_FT_REG_FILE, NULL, 1, 0);
        if (ret < 0)
                goto out;
 
@@ -1443,6 +1443,8 @@ next:
                }
        }
        btrfs_release_path(&path);
+       if (ret)
+               return ret;
        /*
         * For HOLES mode (without NO_HOLES), we must ensure file extents
         * cover the whole range of the image
@@ -1529,7 +1531,13 @@ static int do_rollback(const char *devname)
                goto free_mem;
        }
        fsize = lseek(fd, 0, SEEK_END);
-       root = open_ctree_fd(fd, devname, 0, OPEN_CTREE_WRITES);
+
+       /*
+        * For rollback, we don't really need to write anything so open it
+        * read-only.  The write part will happen after we close the
+        * filesystem.
+        */
+       root = open_ctree_fd(fd, devname, 0, 0);
        if (!root) {
                error("unable to open ctree");
                ret = -EIO;