From patchwork Fri May 18 15:25:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Levente X-Patchwork-Id: 916436 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XPLWEbME"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="mo2JQy9Q"; 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 40nX804n5rz9s29 for ; Sat, 19 May 2018 01:26:24 +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:Subject:Message-Id: Date:To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lasXamHEiQtPL1kad2XFVkl1g6aeUGzHB/E0ND5Sv50=; b=XPLWEbMEGIy7zW uEe1OternAV/89nZDJ2rJAI3T6S5oy90ZgI+tbmK3zU+7nq8osF0koczkslZvxBPbMOl7oKnelEg2 vHCYN99om7uH/xXgHj9VkaXZkGE/Xle9WVGSKkZgBIv1DYsi/ex1d8TQNXXDNbrQtU5oEZmveDqyu xNZce0a/TaDrPWfWY1p9JKmNk1qcDaZQ34mGyUC8CJqK75BOr0RMKPZn+nsCcRlMm0CUsu+2xYggF wdYIoNpYiVv3ZqP9bt6Dp76vnJmvpADNCDKN/PUZQshQ0/+so6NRhVzYm1qJewml/OTBNtzwCBQv3 WNi8LFwLmg2RhJwmP8AQ==; 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 1fJhGt-0001OI-HA; Fri, 18 May 2018 15:26:19 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fJhGq-0001N2-Rc for openwrt-devel@lists.openwrt.org; Fri, 18 May 2018 15:26:18 +0000 Received: by mail-wm0-x236.google.com with SMTP id f6-v6so14757597wmc.4 for ; Fri, 18 May 2018 08:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bTiZ5qjqreO9Web9dXi4XH41Y/9RTwj4vBvUfKRsvto=; b=mo2JQy9Q2CUzu+ZywZXgCuEeQco/p0Lk6DCOx4R5SddE8Jxh84l22/LfGAD9MwIz9s Z+ECyVoznZz/0Kqsow0Svf+Wz8zwSxdFZ2+AlZW7Y5MtVs6wKxLVl3ps/sndsMHx2D6u AcYqz2OXaoYS2FmgVvF5qZPBRQCXLe7F7rskTGl0YH1ay99caUyfJfW+YfIXWO55CeWu Lpw6ilY+4vN7dgwGtuexrX+iB9lMWcl9LG1P+XI3NZKwFL06HXcE1Qt0q1Nn3dOx2YGp 07tKJlchOiO93EHVB1LayjHiYoWSLr75TD2z0wTOWz33/0IxaKHmL+87E1kPrvDsXZBE Qmnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bTiZ5qjqreO9Web9dXi4XH41Y/9RTwj4vBvUfKRsvto=; b=LxFauL25unnXJnZOV8NlkZDmS9b/tWUieUuw4g+y43wpqImRmgdKmGGHVhRdif88Sv Mep+kvXTVVvJSzmSoly4phz0qdw/CDFGEvCh0n1azy8r/yMIex3ImwrzWBpTtc7VxUmv PTc6uhD/3iWeYO/p6RC03mP2yML7aiwY/5C/poSwKr2uxqf83JfVTIj25p8eZiOeRuzC dOByewFN8AEb6ukk+UlrNd46DN5HT3rwdDZ8fFoYGQNdsEG0GT1sKeYlIu16PF31aE2t milW2blvUDF4V9BZ+JMKCI0J1wRAuPhonwSD3q5Y1wOce0O75JF1JknS+33Pa50jifa2 D9lg== X-Gm-Message-State: ALKqPwfJGsEbYJFsMWWic//epZgn3y6dICa+1BUjvtVlNFev6Acn78/B AbufRwTsReMxq9SyT5ETvehbwQ== X-Google-Smtp-Source: AB8JxZqbRqC4FQqu7CZuo1BJMZgRXZhYLaUiZkkAkbWAGDunOSmVNHo32Fr0bwmWmmKnil7YNXfv6Q== X-Received: by 2002:a1c:87d4:: with SMTP id j203-v6mr4745050wmd.119.1526657164862; Fri, 18 May 2018 08:26:04 -0700 (PDT) Received: from jive.levalinux.org (5E1BEF4D.mobile.pool.telekom.hu. [94.27.239.77]) by smtp.googlemail.com with ESMTPSA id k126-v6sm9939131wmg.6.2018.05.18.08.26.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 May 2018 08:26:04 -0700 (PDT) From: Lev To: openwrt-devel@lists.openwrt.org Date: Fri, 18 May 2018 17:25:30 +0200 Message-Id: <20180518152530.2642-1-leventelist@gmail.com> X-Mailer: git-send-email 2.11.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180518_082617_115852_EBD812E0 X-CRM114-Status: GOOD ( 10.52 ) X-Spam-Score: -0.8 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.8 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:236 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 (leventelist[at]gmail.com) 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain Subject: [OpenWrt-Devel] [PATCH] mtd: skip bad blocks when writing X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lev MIME-Version: 1.0 Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org --- package/system/mtd/src/jffs2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/package/system/mtd/src/jffs2.c b/package/system/mtd/src/jffs2.c index b432f64ac0..5bf3eec328 100644 --- a/package/system/mtd/src/jffs2.c +++ b/package/system/mtd/src/jffs2.c @@ -308,6 +308,16 @@ int mtd_write_jffs2(const char *mtd, const char *filename, const char *dir) for(;;) { struct jffs2_unknown_node *node = (struct jffs2_unknown_node *) buf; + while (mtd_block_is_bad(outfd, mtdofs) && (mtdofs < mtdsize)) { + if (!quiet) + fprintf(stderr, "\nSkipping bad block at 0x%08x ", mtdofs); + + mtdofs += erasesize; + + /* Move the file pointer along over the bad block. */ + lseek(outfd, erasesize, SEEK_CUR); + } + if (read(outfd, buf, erasesize) != erasesize) { fdeof = 1; break;