From patchwork Thu Aug 20 06:35:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joonsoo Kim X-Patchwork-Id: 7040981 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 86AB79F344 for ; Thu, 20 Aug 2015 06:36:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7B612053C for ; Thu, 20 Aug 2015 06:36:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFAB12053B for ; Thu, 20 Aug 2015 06:36:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752467AbbHTGfx (ORCPT ); Thu, 20 Aug 2015 02:35:53 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:35642 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752414AbbHTGfu (ORCPT ); Thu, 20 Aug 2015 02:35:50 -0400 Received: by pacdd16 with SMTP id dd16so12635702pac.2; Wed, 19 Aug 2015 23:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=IIF5OSK9qwyH0fVk3RY5FY+fDauhRodnY1Rw2OyVnI4=; b=mWoC25PJ1Uc2bWXWA3za71YTITRT5hdKJ1Wx7P5BunafCt5lxl4qHUzSXdIOCgwxcq xHLK5h8XRvJe2dW293R4OITHW0vkSKkgCL/6jKYeaZF3kKsMrnRqjxxmZcrXn6yXyJID EPzc/D9JSPr5FTM9ishNMRYLnm/lIYQyN7eCoBjER5stbBxjXJNl9X9zYUbZ5N2mVn4B qb1s0WSRHw+z127xYDha081751rSgwxabu6INjO8Iq7/Bax7KCSLiBs234oO4/0taiil sibyHW1R9FlWjwYvI2aBfuz0RBtO+bmPoRaVrPFOxVG4hQC89xDx9xe1Xvkft8rpt8o/ XQpw== X-Received: by 10.66.254.65 with SMTP id ag1mr3291441pad.134.1440052550339; Wed, 19 Aug 2015 23:35:50 -0700 (PDT) Received: from localhost.localdomain ([119.69.155.222]) by smtp.gmail.com with ESMTPSA id v6sm3023378pdp.18.2015.08.19.23.35.45 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Aug 2015 23:35:49 -0700 (PDT) From: Joonsoo Kim X-Google-Original-From: Joonsoo Kim To: Andrew Morton Cc: Minchan Kim , Nitin Gupta , Sergey Senozhatsky , linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org, Herbert Xu , "David S. Miller" , Stephan Mueller , Joonsoo Kim Subject: [PATCH v2 6/8] zram: change zcomp_compress interface Date: Thu, 20 Aug 2015 15:35:02 +0900 Message-Id: <1440052504-15442-7-git-send-email-iamjoonsoo.kim@lge.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1440052504-15442-1-git-send-email-iamjoonsoo.kim@lge.com> References: <1440052504-15442-1-git-send-email-iamjoonsoo.kim@lge.com> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP zram regards zstrm's buffer as compression destination buffer, but, it is not intuitive and there is no document about it. Providing destination buffer to zcomp_compress() directly seems more intuitive interface to me so this patch changes zcomp_compress interface. Signed-off-by: Joonsoo Kim --- drivers/block/zram/zcomp.c | 5 ++--- drivers/block/zram/zcomp.h | 2 +- drivers/block/zram/zram_drv.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c index 965d1af..2ad504b 100644 --- a/drivers/block/zram/zcomp.c +++ b/drivers/block/zram/zcomp.c @@ -307,10 +307,9 @@ void zcomp_strm_release(struct zcomp *comp, struct zcomp_strm *zstrm) } int zcomp_compress(struct zcomp *comp, struct zcomp_strm *zstrm, - const unsigned char *src, size_t *dst_len) + const unsigned char *src, unsigned char *dst, size_t *dst_len) { - return comp->backend->compress(src, zstrm->buffer, dst_len, - zstrm->private); + return comp->backend->compress(src, dst, dst_len, zstrm->private); } int zcomp_decompress(struct zcomp *comp, const unsigned char *src, diff --git a/drivers/block/zram/zcomp.h b/drivers/block/zram/zcomp.h index 46e2b9f..b2388e0 100644 --- a/drivers/block/zram/zcomp.h +++ b/drivers/block/zram/zcomp.h @@ -60,7 +60,7 @@ struct zcomp_strm *zcomp_strm_find(struct zcomp *comp); void zcomp_strm_release(struct zcomp *comp, struct zcomp_strm *zstrm); int zcomp_compress(struct zcomp *comp, struct zcomp_strm *zstrm, - const unsigned char *src, size_t *dst_len); + const unsigned char *src, unsigned char *dst, size_t *dst_len); int zcomp_decompress(struct zcomp *comp, const unsigned char *src, size_t src_len, unsigned char *dst); diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index b088ca9..4801e4d 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -701,7 +701,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, goto out; } - ret = zcomp_compress(zram->comp, zstrm, uncmem, &clen); + ret = zcomp_compress(zram->comp, zstrm, uncmem, zstrm->buffer, &clen); if (!is_partial_io(bvec)) { kunmap_atomic(user_mem); user_mem = NULL;