[PATCH] UBI: allow atomic updates to sychronously erase old PEB

Artem Bityutskiy dedekind1 at gmail.com
Wed Apr 11 08:26:45 EDT 2012


Hi,

sorry for long delay.

First of all - please, make UBI and UBIFS changes in separate patches -
we consider these to be separate subsystems.

On Fri, 2012-03-30 at 17:11 +0200, Joel Reardon wrote:
> @@ -629,12 +628,13 @@ static int erase_worker(struct ubi_device *ubi, struct ubi_work *wl_wrk,
>   * @ubi: UBI device description object
>   * @e: the WL entry of the physical eraseblock to erase
>   * @torture: if the physical eraseblock has to be tortured
> + * @sync: schedule the work immediately and return after completion
>   *
>   * This function returns zero in case of success and a %-ENOMEM in case of
>   * failure.
>   */
>  static int schedule_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
> -			  int torture)
> +			  int torture, int sync)
>  {
>  	struct ubi_work *wl_wrk;
> 
> @@ -649,7 +649,11 @@ static int schedule_erase(struct ubi_device *ubi, struct ubi_wl_entry *e,
>  	wl_wrk->e = e;
>  	wl_wrk->torture = torture;
> 
> -	schedule_ubi_work(ubi, wl_wrk);
> +	if (sync)
> +		erase_worker(ubi, wl_wrk, 0);
> +	else
> +		schedule_ubi_work(ubi, wl_wrk);
> +
>  	return 0;
>  }

Please, do not modify this function. You only need to do "if (sync)"
in 'ubi_wl_put_peb()' and nowhere else, so do it directly there.

You will have no "what if sync fails" issues then. Also, just from
common sense point of view, "schedule_erase" should schedule, not erase.

Otherwise looks good - I can take this to the ubifs tree straight
away even without your security stuff.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120411/4211672c/attachment.sig>


More information about the linux-mtd mailing list