public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Richard Weinberger <richard@nod.at>
To: "Jörg Krause" <joerg.krause@embedded.rocks>,
	linux-mtd@lists.infradead.org
Subject: Re: ubi_wl_get_peb: Unable to get a free PEB from user WL pool
Date: Thu, 6 Aug 2015 20:16:05 +0200	[thread overview]
Message-ID: <55C3A465.5070504@nod.at> (raw)
In-Reply-To: <1438848603.32524.6.camel@embedded.rocks>

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

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

[-- Attachment #2: fastmap_produce_peb.diff --]
[-- Type: text/x-patch, Size: 1071 bytes --]

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;
 	}
 

  parent reply	other threads:[~2015-08-06 18:16 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-05 21:22 ubi_wl_get_peb: Unable to get a free PEB from user WL pool Jörg Krause
2015-08-05 21:30 ` Richard Weinberger
2015-08-05 21:38   ` Jörg Krause
2015-08-05 21:45     ` Richard Weinberger
2015-08-05 21:53       ` Jörg Krause
2015-08-05 22:01         ` Richard Weinberger
2015-08-05 22:17           ` Jörg Krause
2015-08-06  7:30             ` Richard Weinberger
2015-08-06  8:10               ` Jörg Krause
2015-08-06  8:12                 ` Richard Weinberger
2015-08-06 18:16                 ` Richard Weinberger [this message]
2015-08-06 18:43                   ` Jörg Krause

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55C3A465.5070504@nod.at \
    --to=richard@nod.at \
    --cc=joerg.krause@embedded.rocks \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox