[PATCH] ubi/upd: always flush after prepared for an update

Sebastian Andrzej Siewior bigeasy at linutronix.de
Wed Mar 1 01:51:45 PST 2017


On 2017-02-28 22:02:14 [+0100], Richard Weinberger wrote:
> Sebastian,
Hi Richard,

> > diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
> > index 0134ba32a057..39712560b4c1 100644
> > --- a/drivers/mtd/ubi/upd.c
> > +++ b/drivers/mtd/ubi/upd.c
> > @@ -148,11 +148,11 @@ int ubi_start_update(struct ubi_device *ubi, struct ubi_volume *vol,
> >  			return err;
> >  	}
> >  
> > -	if (bytes == 0) {
> > -		err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
> > -		if (err)
> > -			return err;
> > +	err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
> > +	if (err)
> > +		return err;
> 
> Unconditionally calling ubi_wl_flush() will slow down ubiupdatevol.
> Wouldn't it make sense to flush only if bytes is 0 or differs from the old value?

Do you think it will slow down the whole process as such? Usually you
don't have a lot of empty PEBs around so at some point you will force
one worker to get an empty PEB. And even if you could write everything
without the need to complete the erase process then
ubi_more_update_data() will also invoke ubi_wl_flush() before
clear_update_marker() which completes the process.

> Thanks,
> //richard

Sebastian



More information about the linux-mtd mailing list