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

Richard Weinberger richard at nod.at
Thu Mar 2 23:59:45 PST 2017


Sebastian,

Am 01.03.2017 um 10:51 schrieb Sebastian Andrzej Siewior:
> 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.

Agreed, that makes sense. So the only change is that we block now
on a different location.

Thanks,
//richard



More information about the linux-mtd mailing list