[PATCH 7/8] fs/btrfs: introduce missing kfree

2009-09-11 Thread Julia Lawall
From: Julia Lawall ju...@diku.dk

Error handling code following a kzalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// smpl
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x...@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
... when != x
 when != if (...) { +...x...+ }
(
x-f1 = E
|
 (x-f1 == NULL || ...)
|
 f(...,x-f1,...)
)
...
(
 return \(0\|+...x...+\|ptr\);
|
 ret...@p2 ...;
)

@script:python@
p1  r.p1;
p2  r.p2;
@@

print * file: %s kmalloc %s return %s % (p1[0].file,p1[0].line,p2[0].line)
// /smpl

Signed-off-by: Julia Lawall ju...@diku.dk
---
 fs/btrfs/volumes.c  |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5cf405b..4ced7c3 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -446,8 +446,10 @@ static struct btrfs_fs_devices *clone_fs_devices(struct 
btrfs_fs_devices *orig)
goto error;
 
device-name = kstrdup(orig_dev-name, GFP_NOFS);
-   if (!device-name)
+   if (!device-name) {
+   kfree(device);
goto error;
+   }
 
device-devid = orig_dev-devid;
device-work.func = pending_bios_fn;
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Updated performance results

2009-09-11 Thread Chris Mason
On Mon, Aug 31, 2009 at 12:49:13PM -0500, Steven Pratt wrote:
 Better late than never. Finally got this finished up.  Mixed bag on
 this one.  BTRFS lags significantly on single threaded.  Seems
 unable to keep IO outstanding to the device.  Less that 60% busy on
 the DM device, compared to 97%+ for all other filesystems.
 nodatacow helps out, increasing utilization to about 70%, but still
 trails by a large margin.

Hi Steve,

Jens Axboe did some profiling on his big test rig and I think we found
the biggest CPU problems.  The end result is now setting in the master
branch of the btrfs-unstable repo.

On his boxes, btrfs went from around 400MB/s streaming writes to 1GB/s
limit, and we're now tied with XFS while using less CPU time.

Hopefully you will see similar results ;)

-chris
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: btrfs failing fsx-linux

2009-09-11 Thread Chris Mason
On Tue, Aug 18, 2009 at 07:26:41PM +0200, Nick Piggin wrote:
 Hi Chris,
 
 Don't know if this is a known issue, but I have btrfs (after my previous
 inode_tree fixup patch) failing fsx-linux in Linus's current git tree.

Thanks for your help on this Nick, I've got my current fixes for fsx in
the master branch of the btrfs-unstable repo:

git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs-unstable.git

If you're curious, the 3 most relevant commits are here:

http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable.git;a=commit;h=93c82d575055f1bd0277acae6f966bebafd80dd5

http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable.git;a=commit;h=50a9b214bc6c052caa05a210ebfc1bdf0d7085b2

http://git.kernel.org/?p=linux/kernel/git/mason/btrfs-unstable.git;a=commit;h=a1ed835e1ab5795f91b198d08c43e2f56848dcf3

But these fixes are built on top of my performance work (which was sure
to break fsx on its own).

-chris
--
To unsubscribe from this list: send the line unsubscribe linux-btrfs in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html