From patchwork Wed Jun 13 21:23:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 929095 X-Patchwork-Delegate: richard@nod.at Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=nod.at Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="NuuFZMNV"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 415fvt10njz9s01 for ; Thu, 14 Jun 2018 07:26:50 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=0K1Jsi5MW9OwCtjWHRZhed5GVG9CNb65KBttJSq4tIM=; b=NuuFZMNV+QuIRBXQQhExcxGUVm Q5Nirt7x1gH9kddjxFJM72WnoblHmbEUvJQ/Eba9KkZ3TOfZHxF4dLV4c95LJjzIVNCv61DjsQ4Jf iG5QSK9OPHX/xAyx62dVfc8gQWIIHU6g51Ko0qpBI9ElSy6K2Smpa70+0WTRV9XkoKLO1o4l0XyeT bQTVFTAZn288I7mh7EZqnozbI9nQ0/vY4jEhQg6zVNe7ptq2nIurumkr/m17WoW5H+ldHR0uZQwrq qqHvMKa3sT18+cuCSXcV16qqTEErSq0U2iP2SN5Y5z2U6NCf15+zRkJC4IDIR2BI3fxUxuVz44ZWn fwEbifXQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTDHq-0007XZ-Jm; Wed, 13 Jun 2018 21:26:38 +0000 Received: from lilium.sigma-star.at ([109.75.188.150]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fTDFi-0004u7-Nk for linux-mtd@lists.infradead.org; Wed, 13 Jun 2018 21:24:37 +0000 Received: from localhost (localhost [127.0.0.1]) by lilium.sigma-star.at (Postfix) with ESMTP id 339BE181A2BDA; Wed, 13 Jun 2018 23:24:04 +0200 (CEST) From: Richard Weinberger To: linux-mtd@lists.infradead.org Subject: [PATCH 07/14] ubi: fastmap: Fixup pool sizes for preseeded fastmaps Date: Wed, 13 Jun 2018 23:23:37 +0200 Message-Id: <20180613212344.11608-8-richard@nod.at> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180613212344.11608-1-richard@nod.at> References: <20180613212344.11608-1-richard@nod.at> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180613_142426_975702_9DE93708 X-CRM114-Status: GOOD ( 13.10 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 T_SPF_PERMERROR SPF: test of record failed (permerror) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Richard Weinberger , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org A preseeded fastmap has, by definition, no dirty PEBs and therefore all pools are empty. The creation tool can also not calculate the maximal pool sizes. This means we have to set them during attach. Signed-off-by: Richard Weinberger --- drivers/mtd/ubi/fastmap.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 69b855b3cf2a..976d371d7cef 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -645,8 +645,15 @@ static int ubi_attach_fastmap(struct ubi_device *ubi, pool_size = be16_to_cpu(fmpl->size); wl_pool_size = be16_to_cpu(fmpl_wl->size); - fm->max_pool_size = be16_to_cpu(fmpl->max_size); - fm->max_wl_pool_size = be16_to_cpu(fmpl_wl->max_size); + + if (fm->flags & UBI_FM_SB_PRESEEDED_FLG) { + fm->max_pool_size = ubi->fm_pool.max_size; + fm->max_wl_pool_size = ubi->fm_wl_pool.max_size; + + } else { + fm->max_pool_size = be16_to_cpu(fmpl->max_size); + fm->max_wl_pool_size = be16_to_cpu(fmpl_wl->max_size); + } if (pool_size > UBI_FM_MAX_POOL_SIZE || pool_size < 0) { ubi_err(ubi, "bad pool size: %i", pool_size);