From patchwork Thu Aug 6 18:16:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Weinberger X-Patchwork-Id: 504780 X-Patchwork-Delegate: richard@nod.at 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 D5A841402B0 for ; Fri, 7 Aug 2015 04:18:27 +1000 (AEST) 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 1ZNPiW-0005BJ-U4; Thu, 06 Aug 2015 18:16:36 +0000 Received: from a.ns.miles-group.at ([95.130.255.143] helo=radon.swed.at) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZNPiS-00052U-K4 for linux-mtd@lists.infradead.org; Thu, 06 Aug 2015 18:16:34 +0000 Received: (qmail 18751 invoked by uid 89); 6 Aug 2015 18:16:07 -0000 Received: by simscan 1.3.1 ppid: 18744, pid: 18749, t: 0.0550s scanners: attach: 1.3.1 Received: from unknown (HELO ?192.168.0.10?) (richard@nod.at@213.47.235.169) by radon.swed.at with ESMTPA; 6 Aug 2015 18:16:07 -0000 Subject: Re: ubi_wl_get_peb: Unable to get a free PEB from user WL pool To: =?UTF-8?Q?J=c3=b6rg_Krause?= , linux-mtd@lists.infradead.org References: <1438809724.6328.18.camel@embedded.rocks> <55C28070.2000804@nod.at> <1438810690.6328.26.camel@embedded.rocks> <55C2840B.5000709@nod.at> <1438811611.6328.32.camel@embedded.rocks> <55C287A9.8000006@nod.at> <1438813074.6328.35.camel@embedded.rocks> <55C30D24.1010504@nod.at> <1438848603.32524.6.camel@embedded.rocks> From: Richard Weinberger Message-ID: <55C3A465.5070504@nod.at> Date: Thu, 6 Aug 2015 20:16:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <1438848603.32524.6.camel@embedded.rocks> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150806_111633_225120_93C632E0 X-CRM114-Status: GOOD ( 11.23 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [95.130.255.143 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 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: , Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Am 06.08.2015 um 10:10 schrieb Jörg Krause: > I will turn fastmap off for now, but feel free to send more patches to > try. Can you please give the attached patch a try? Thanks, //richard diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c index b2a6653..bbd30dc 100644 --- a/drivers/mtd/ubi/fastmap-wl.c +++ b/drivers/mtd/ubi/fastmap-wl.c @@ -172,6 +172,30 @@ void ubi_refill_pools(struct ubi_device *ubi) } /** + * produce_free_peb - produce a free physical eraseblock. + * @ubi: UBI device description object + * + * This function tries to make a free PEB by means of synchronous execution of + * pending works. This may be needed if, for example the background thread is + * disabled. Returns zero in case of success and a negative error code in case + * of failure. + */ +static int produce_free_peb(struct ubi_device *ubi) +{ + int err; + + while (!ubi->free.rb_node && ubi->works_count) { + dbg_wl("do one work synchronously"); + err = do_work(ubi); + + if (err) + return err; + } + + return 0; +} + +/** * ubi_wl_get_peb - get a physical eraseblock. * @ubi: UBI device description object * @@ -213,6 +237,7 @@ again: } retried = 1; up_read(&ubi->fm_eba_sem); + produce_free_peb(ubi); goto again; }