From 1b1f9a9d00447d9eab32ae5633f60a106196b75f Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Mon, 17 May 2010 10:00:51 +0200 Subject: UBI: Ensure that "background thread" operations are really executed The current U-Boot UBI implementation is copied from Linux. In this porting the UBI background thread was not handled correctly. Upon write operations ubi_wl_flush() makes sure, that all queued operations, like page-erase, are completed. But this is missing for read operations. This patch now makes sure that such operations (like scrubbing upon bit-flip errors) are not queued, but executed directly. Signed-off-by: Stefan Roese --- drivers/mtd/ubi/wl.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 2f9a5e3..88b867a 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -696,8 +696,13 @@ static void schedule_ubi_work(struct ubi_device *ubi, struct ubi_work *wrk) list_add_tail(&wrk->list, &ubi->works); ubi_assert(ubi->works_count >= 0); ubi->works_count += 1; - if (ubi->thread_enabled) - wake_up_process(ubi->bgt_thread); + + /* + * U-Boot special: We have no bgt_thread in U-Boot! + * So just call do_work() here directly. + */ + do_work(ubi); + spin_unlock(&ubi->wl_lock); } -- cgit v1.1 From bdc5f06789c5a0c3a9a2c0eb33ec4d177dbdaa22 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Mon, 17 May 2010 10:01:05 +0200 Subject: UBI: Fix problem in UBI/Linux "compatibility layer" "down_write_trylock" needs to return 1 instead of 0 for success. Otherwise copying a block with a read error (e.g. bit-flip on read) won't work correctly. Signed-off-by: Stefan Roese --- include/ubi_uboot.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/ubi_uboot.h b/include/ubi_uboot.h index 60f6a5f..d2c90a6 100644 --- a/include/ubi_uboot.h +++ b/include/ubi_uboot.h @@ -123,7 +123,7 @@ typedef int wait_queue_head_t; #define init_rwsem(...) do { } while (0) #define down_read(...) do { } while (0) #define down_write(...) do { } while (0) -#define down_write_trylock(...) 0 +#define down_write_trylock(...) 1 #define up_read(...) do { } while (0) #define up_write(...) do { } while (0) -- cgit v1.1