diff options
author | Tom Rini | 2018-05-29 11:01:43 -0400 |
---|---|---|
committer | Tom Rini | 2018-05-29 11:01:43 -0400 |
commit | add7aa9f97f73ed20e2883f7fc6156b72276cdbc (patch) | |
tree | 98268641ab12f8ff245d89d5f7b1c37bc34bdb4f /drivers | |
parent | f035526624dcb4b6bd36314162013eb820fdd86b (diff) | |
parent | 65c3d25a6a21b5cf4d978f05f84aaeb6b250e636 (diff) |
Merge branch 'master' of git://git.denx.de/u-boot-ubi
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/ubi/fastmap-wl.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/fastmap-wl.c b/drivers/mtd/ubi/fastmap-wl.c index 675e487ae8c..4cb1377c425 100644 --- a/drivers/mtd/ubi/fastmap-wl.c +++ b/drivers/mtd/ubi/fastmap-wl.c @@ -170,6 +170,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 * @@ -211,6 +235,11 @@ again: } retried = 1; up_read(&ubi->fm_eba_sem); + ret = produce_free_peb(ubi); + if (ret < 0) { + down_read(&ubi->fm_eba_sem); + goto out; + } goto again; } |