diff mbox

[2/4] btrfs-convert: Add extent iteration functions.

Message ID 20100322045526.GA21666@flcl.lan (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Bartell March 22, 2010, 4:55 a.m. UTC
None
diff mbox

Patch

diff --git a/convert.c b/convert.c
index dfd2976..7bb4ed0 100644
--- a/convert.c
+++ b/convert.c
@@ -471,21 +471,24 @@  int finish_file_extents(struct extent_iterate_data *priv)
 				return ret;
 		}
 		*priv->inode_nbytes += priv->size;
-		return btrfs_insert_inline_extent(priv->trans, priv->root,
-						  priv->objectid,
-						  priv->file_off, priv->data,
-						  priv->size);
-	}
-
-	ret = commit_file_extents(priv);
-	if (ret)
-		return ret;
-
-	if (priv->total_size > priv->last_file_off) {
-		ret = commit_disk_extent(priv, priv->last_file_off, 0,
-					priv->total_size - priv->last_file_off);
+		ret = btrfs_insert_inline_extent(priv->trans, priv->root,
+						 priv->objectid,
+						 priv->file_off, priv->data,
+						 priv->size);
 		if (ret)
 			return ret;
+	} else {
+		ret = commit_file_extents(priv);
+		if (ret)
+			return ret;
+
+		if (priv->total_size > priv->last_file_off) {
+			ret = commit_disk_extent(priv, priv->last_file_off, 0,
+						 priv->total_size -
+						 priv->last_file_off);
+			if (ret)
+				return ret;
+		}
 	}
 	free(priv->data);
 	return 0;