From patchwork Fri Feb 15 13:08:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kyungsik Lee X-Patchwork-Id: 2147311 Return-Path: X-Original-To: patchwork-linux-btrfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 03087E0143 for ; Fri, 15 Feb 2013 13:09:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761715Ab3BONIm (ORCPT ); Fri, 15 Feb 2013 08:08:42 -0500 Received: from LGEMRELSE1Q.lge.com ([156.147.1.111]:55819 "EHLO LGEMRELSE1Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161357Ab3BONIj (ORCPT ); Fri, 15 Feb 2013 08:08:39 -0500 X-AuditID: 9c93016f-b7b1fae000006419-f2-511e33556c18 Received: from localhost.localdomain ( [10.177.225.63]) by LGEMRELSE1Q.lge.com (Symantec Brightmail Gateway) with SMTP id D7.CD.25625.5533E115; Fri, 15 Feb 2013 22:08:37 +0900 (KST) From: Kyungsik Lee To: Chris Mason , linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org Cc: David Sterba , hyojun.im@lge.com, chan.jeong@lge.com, raphael.andy.lee@gmail.com, Kyungsik Lee Subject: [PATCH] btrfs: use kmalloc for lzo de/compress buffer Date: Fri, 15 Feb 2013 22:08:21 +0900 Message-Id: <1360933701-17434-1-git-send-email-kyungsik.lee@lge.com> X-Mailer: git-send-email 1.8.0.3 MIME-Version: 1.0 X-Brightmail-Tracker: AAAAAA== Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org The size of de/compress buffer and LZO1X_MEM_COMPRESS is small enough. Allocating it with kmalloc rather than vmalloc is preferred. This patch depends on my previous patch, “btrfs: fix decompress buffer size”. Signed-off-by: Kyungsik Lee Cc: David Sterba --- fs/btrfs/lzo.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/fs/btrfs/lzo.c b/fs/btrfs/lzo.c index 223893a..f223742 100644 --- a/fs/btrfs/lzo.c +++ b/fs/btrfs/lzo.c @@ -18,7 +18,6 @@ #include #include -#include #include #include #include @@ -40,9 +39,9 @@ static void lzo_free_workspace(struct list_head *ws) { struct workspace *workspace = list_entry(ws, struct workspace, list); - vfree(workspace->buf); - vfree(workspace->cbuf); - vfree(workspace->mem); + kfree(workspace->buf); + kfree(workspace->cbuf); + kfree(workspace->mem); kfree(workspace); } @@ -54,9 +53,10 @@ static struct list_head *lzo_alloc_workspace(void) if (!workspace) 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->mem = kmalloc(LZO1X_MEM_COMPRESS, GFP_NOFS); + 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;