[patch] UBI: add means to clear ubi work queue for particular lnums

Richard Weinberger richard at nod.at
Sun May 13 05:51:59 EDT 2012


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: OpenPGP digital signature
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120513/fafc9070/attachment.sig>


More information about the linux-mtd mailing list