[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1361174164-7182-1-git-send-email-kyungsik.lee@lge.com>
Date: Mon, 18 Feb 2013 16:56:04 +0900
From: Kyungsik Lee <kyungsik.lee@....com>
To: Chris Mason <chris.mason@...ionio.com>,
linux-btrfs@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: hyojun.im@....com, chan.jeong@....com, raphael.andy.lee@...il.com,
Kyungsik Lee <kyungsik.lee@....com>,
David Sterba <dsterba@...e.cz>
Subject: [PATCH v2] btrfs: use kmalloc for lzo de/compress buffer
The size of de/compress buffer is small enough to use kmalloc.
Allocating it with kmalloc rather than vmalloc is preferred.
This patch depends on my previous patch, “btrfs: fix decompress buffer size”.
v2: Using vmalloc for "workspace->mem" due to the size limit.
Signed-off-by: Kyungsik Lee <kyungsik.lee@....com>
Cc: David Sterba <dsterba@...e.cz>
---
fs/btrfs/lzo.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c
index 223893a..aaaab2e 100644
--- a/fs/btrfs/lzo.c
+++ b/fs/btrfs/lzo.c
@@ -40,8 +40,8 @@ static void lzo_free_workspace(struct list_head *ws)
{
struct workspace *workspace = list_entry(ws, struct workspace, list);
- vfree(workspace->buf);
- vfree(workspace->cbuf);
+ kfree(workspace->buf);
+ kfree(workspace->cbuf);
vfree(workspace->mem);
kfree(workspace);
}
@@ -55,8 +55,9 @@ static struct list_head *lzo_alloc_workspace(void)
return ERR_PTR(-ENOMEM);
workspace->mem = vmalloc(LZO1X_MEM_COMPRESS);
- workspace->buf = vmalloc(PAGE_CACHE_SIZE);
- workspace->cbuf = vmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE));
+ workspace->buf = kmalloc(PAGE_CACHE_SIZE, GFP_NOFS);
+ workspace->cbuf = kmalloc(lzo1x_worst_compress(PAGE_CACHE_SIZE),
+ GFP_NOFS);
if (!workspace->mem || !workspace->buf || !workspace->cbuf)
goto fail;
--
1.8.0.3
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists