Re: [patch] UBI: add means to clear ubi work queue for particularlnums

From: Richard Weinberger
Date: Sun May 13 2012 - 05:52:46 EST


Am 13.05.2012 10:47, schrieb Joel Reardon:
> +int ubi_wl_flush_lnum(struct ubi_device *ubi, int lnum)
> +{
> + int err = 0;
> + struct ubi_work *wrk, *tmp;
> +
> + /* For each pending work, if it corresponds to the parameter @lnum,
> + * then execute the work.
> + */
> + dbg_wl("flush lnum %d", lnum);
> + list_for_each_entry_safe(wrk, tmp, &ubi->works, list) {
> + if (wrk->lnum == lnum) {
> + spin_lock(&ubi->wl_lock);
> + list_del(&wrk->list);
> + ubi->works_count -= 1;
> + ubi_assert(ubi->works_count >= 0);
> + spin_unlock(&ubi->wl_lock);
> +
> + err = wrk->func(ubi, wrk, 0);
> + if (err)
> + ubi_err("work failed with error code %d", err);
> + }
> + }
> +
> + return err;
> +}

I think you also have to grab ubi->work_sem in read mode here.

Thanks,
//richard

Attachment: signature.asc
Description: OpenPGP digital signature