From patchwork Tue Feb 2 02:30:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bean Huo X-Patchwork-Id: 576913 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2001:1868:205::9]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 116D6140C1F for ; Tue, 2 Feb 2016 13:35:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=hvLE3Irc; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQQnE-0003O0-Ml; Tue, 02 Feb 2016 02:34:12 +0000 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQQm9-0002Ye-VI for linux-mtd@lists.infradead.org; Tue, 02 Feb 2016 02:33:08 +0000 Received: by mail-pf0-x243.google.com with SMTP id 65so8259846pfd.1 for ; Mon, 01 Feb 2016 18:32:46 -0800 (PST) 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=JT55EXRfJQmCNZCV4hEmi4W7LL1YDygsJlOaOYrAT88=; b=hvLE3IrcuFqNCxqsKMrDzV6+urrdcYs9CrET2TcegYExtu5/mBORthGipJwi4HdxnD Vn4prEBh/FHotcuLiGs1rTlTKsPYZhxm0u0fiMw8i/DiNHKVK5XWogeef72MD/V2Ok1Y uvpRQMDLs4R6W6Id++igXaSANCqtyHuUOBIHcebG7STqoqxhpztGKXIE8TslC3e/ap99 oCACKmvRGrCqK9Z9/Eo9IUfgxSCQpkeXar+iM3I0ZkWfvxZF5vZrPlYcwiRI+yQiAxvZ 2SVzYMynGrmOkWSiY2ldaZbxv26woVNoK6W8Uqij5qKC9s8fMhIArK1vZH2oKO9h4a7l zijg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=JT55EXRfJQmCNZCV4hEmi4W7LL1YDygsJlOaOYrAT88=; b=a2OMbIE4/sepICh8tXxqZhW0kmEl1i00EPRy2OshgTKoKYhxwCqYVR2F0ozjF49vGI KaQg15qVa5uq5m6v5MUYbWZamtcE4k77T6/wvU3YxxmdfsT3EmSXgIxqP6mjSnOUmjBx GJc+nTvLZA1S/XT1YEqW28NDSJ3su8sZR7KkXXWMK3uXXBHc/PHovlpY29IupSpdLlmj RihhnIKIiA1Yupo/G62S9nzaEmnRu9lI8ld8s6uKz1yS87DSAiL/NXdO/uvAagLagOtv TplUpojg7fOygd/Nu/mgCHKMHQe1x/jXwhObZtxBNexTTVKXUsWvWrBCQ3lRMOqNhzdL YjwQ== X-Gm-Message-State: AG10YOQZYGc6UYujbG771vJobG7rvKkSyohr4hAE6esSGVM/qMSlZBeQoBpU74UiIQvkfA== X-Received: by 10.98.64.132 with SMTP id f4mr38257991pfd.159.1454380366499; Mon, 01 Feb 2016 18:32:46 -0800 (PST) Received: from ip-172-31-10-211.us-west-1.compute.internal (ec2-54-183-210-74.us-west-1.compute.amazonaws.com. [54.183.210.74]) by smtp.gmail.com with ESMTPSA id n4sm22130868pfi.3.2016.02.01.18.32.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 01 Feb 2016 18:32:46 -0800 (PST) From: Bean Huo To: richard@nod.at, dedekind1@gmail.com, adrian.hunter@intel.com, computersforpeace@gmail.com, boris.brezillon@free-electrons.com Subject: [PATCH v2 13/17] drivers:mtd:ubi:add bakvol init while attach ubi Date: Tue, 2 Feb 2016 02:30:48 +0000 Message-Id: <1454380252-16170-14-git-send-email-jackyard88@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454380252-16170-1-git-send-email-jackyard88@gmail.com> References: <1454380252-16170-1-git-send-email-jackyard88@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160201_183306_387641_79070F90 X-CRM114-Status: GOOD ( 11.68 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:400e:c00:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (jackyard88[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (jackyard88[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peterpandong@micron.com, zszubbocsev@micron.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, beanhuo@micron.com MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Bean Huo This file is to initial bakvol moduel and scan PEB to find bakvol PEB while attach ubi device. Signed-off-by: BeanHuo --- drivers/mtd/ubi/attach.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index 68eea5b..5c38854 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -919,6 +919,15 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, err = ubi_io_read_vid_hdr(ubi, pnum, vidh, 0); if (err < 0) return err; + +#ifdef CONFIG_MTD_UBI_MLC_NAND_BAKVOL + /* + * Before analyze VID header, call ubi_bakvol_peb_scan to + * find out backup block and build the backup log volume first. + */ + ubi_bakvol_peb_scan(ubi, vidh, pnum); +#endif + switch (err) { case 0: break; @@ -995,7 +1004,8 @@ static int scan_peb(struct ubi_device *ubi, struct ubi_attach_info *ai, *vid = vol_id; if (sqnum) *sqnum = be64_to_cpu(vidh->sqnum); - if (vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOLUME_ID) { + if ((vol_id > UBI_MAX_VOLUMES && vol_id != UBI_LAYOUT_VOLUME_ID) + && vol_id != UBI_BACKUP_VOLUME_ID) { int lnum = be32_to_cpu(vidh->lnum); /* Unsupported internal volume */ @@ -1408,6 +1418,12 @@ int ubi_attach(struct ubi_device *ubi, int force_scan) if (!ai) return -ENOMEM; +#ifdef CONFIG_MTD_UBI_MLC_NAND_BAKVOL + err = ubi_bakvol_module_init(ubi); + if (err) + goto out_ai; +#endif + #ifdef CONFIG_MTD_UBI_FASTMAP /* On small flash devices we disable fastmap in any case. */ if ((int)mtd_div_by_eb(ubi->mtd->size, ubi->mtd) <= UBI_FM_MAX_START) { @@ -1449,6 +1465,12 @@ int ubi_attach(struct ubi_device *ubi, int force_scan) if (err) goto out_ai; +#ifdef CONFIG_MTD_UBI_MLC_NAND_BAKVOL + err = ubi_bakvol_module_init_tail(ubi, ai); + if (err) + goto out_ai; +#endif + err = ubi_wl_init(ubi, ai); if (err) goto out_vtbl;