From patchwork Mon Apr 1 03:24:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 15787 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 8730923DEA for ; Mon, 1 Apr 2013 03:28:29 +0000 (UTC) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by fiordland.canonical.com (Postfix) with ESMTP id 48204A19BE0 for ; Mon, 1 Apr 2013 03:28:29 +0000 (UTC) Received: by mail-vc0-f176.google.com with SMTP id ib11so1989988vcb.35 for ; Sun, 31 Mar 2013 20:28:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:sender:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :content-transfer-encoding:in-reply-to:user-agent:x-gm-message-state; bh=F5AOtHHTg2/+LdEozpy4vluIxNn21MQbQ8RpSr2Ueuw=; b=C2W6nKN0LwcVlLw5vNJlTXfCZpook4X2z0c+K9l069scWynt04tTQcsDKbkf/H9y2R vK/a/cy1cEQFCzl+JHoXU0xygk7e6tax4Yvv6qEnsiupBNCP7pb4vrmbdOlWwuq/WrdI kuCzHCesZMrORLSX6e3pCs0RpCQRu/Gy75B8Qnp9kLuZnWWzrRVv9CTh5IFJxSWhr0Fg 1vw6XpmLJG7wAU0yKejgu6pS7R67xzCLlJ1YIZVJi9IC7daJ3t+Q3zbkc7mcpUetsSFZ RQ8qPuqgjaDNa59LD5NrbaqrKqBuX6Gh0Z6dRyaWJrxXCnZVA9E+sozPSkP2pCVB69jO Ehjw== X-Received: by 10.220.106.14 with SMTP id v14mr8083083vco.2.1364786908783; Sun, 31 Mar 2013 20:28:28 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.59.4.204 with SMTP id cg12csp66053ved; Sun, 31 Mar 2013 20:28:28 -0700 (PDT) X-Received: by 10.68.242.65 with SMTP id wo1mr15972110pbc.62.1364786907801; Sun, 31 Mar 2013 20:28:27 -0700 (PDT) Received: from mail-pb0-f46.google.com (mail-pb0-f46.google.com [209.85.160.46]) by mx.google.com with ESMTPS id sv4si11698239pbc.126.2013.03.31.20.28.27 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 31 Mar 2013 20:28:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.160.46 is neither permitted nor denied by best guess record for domain of anton@scarybugs.org) client-ip=209.85.160.46; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.46 is neither permitted nor denied by best guess record for domain of anton@scarybugs.org) smtp.mail=anton@scarybugs.org Received: by mail-pb0-f46.google.com with SMTP id uo1so985821pbc.19 for ; Sun, 31 Mar 2013 20:28:27 -0700 (PDT) X-Received: by 10.66.248.99 with SMTP id yl3mr16969951pac.134.1364786907289; Sun, 31 Mar 2013 20:28:27 -0700 (PDT) Received: from localhost (c-98-234-113-125.hsd1.ca.comcast.net. [98.234.113.125]) by mx.google.com with ESMTPS id in5sm12028483pbc.20.2013.03.31.20.28.25 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 31 Mar 2013 20:28:26 -0700 (PDT) Sender: Anton Vorontsov Date: Sun, 31 Mar 2013 20:24:29 -0700 From: Anton Vorontsov To: linux-kernel@vger.kernel.org Cc: Tony Luck , Kees Cook , Colin Cross , Arve =?utf-8?B?SGrDuG5uZXbDpWc=?= , John Stultz , linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Subject: [PATCH 1/3] pstore/ram: Include ecc_size when calculating ecc_block Message-ID: <20130401032429.GA17424@lizard> References: <20130401032256.GA13801@lizard> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130401032256.GA13801@lizard> User-Agent: Mutt/1.5.21 (2010-09-15) X-Gm-Message-State: ALoCoQnUBVXfzaXct5iLKOi3KFNE+qOhigsbSskel26iFimbO9T7MpNNK9gG8Xgg8ppPS2mrSHRC From: Arve Hjønnevåg Wastes less memory and allows using more memory for ecc than data. Signed-off-by: Arve Hjønnevåg [jstultz: Tweaked commit subject] Signed-off-by: John Stultz Signed-off-by: Anton Vorontsov --- fs/pstore/ram_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/pstore/ram_core.c b/fs/pstore/ram_core.c index 0306303..e5afa22 100644 --- a/fs/pstore/ram_core.c +++ b/fs/pstore/ram_core.c @@ -187,7 +187,8 @@ static int persistent_ram_init_ecc(struct persistent_ram_zone *prz, prz->ecc_block_size = 128; prz->ecc_size = ecc_size; - ecc_blocks = DIV_ROUND_UP(prz->buffer_size, prz->ecc_block_size); + ecc_blocks = DIV_ROUND_UP(prz->buffer_size - prz->ecc_size, + prz->ecc_block_size + prz->ecc_size); ecc_total = (ecc_blocks + 1) * prz->ecc_size; if (ecc_total >= prz->buffer_size) { pr_err("%s: invalid ecc_size %u (total %zu, buffer size %zu)\n",