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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Whoops, there's a major memory leak. Please apply this patch to the
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;
--
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

[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux