[PATCH 2/4] mtd: UBI: Add support for updating static volumes

Teresa Remmet t.remmet at phytec.de
Thu Jun 23 05:11:43 PDT 2016


Hello Sascha,

Am Donnerstag, den 23.06.2016, 08:36 +0200 schrieb Sascha Hauer:
> Hi Teresa,
> 
> On Wed, Jun 22, 2016 at 11:02:39AM +0200, Teresa Remmet wrote:
> > Added support to update UBI static volumes in barebox.
> > This is mainly realized with adding the ioctl UBI_IOCVOLUP.
> > 
> > Signed-off-by: Teresa Remmet <t.remmet at phytec.de>
> > ---
> >  drivers/mtd/ubi/barebox.c | 56 +++++++++++++++++++++++++++++++++++++++++++++--
> >  drivers/mtd/ubi/upd.c     | 12 ----------
> >  2 files changed, 54 insertions(+), 14 deletions(-)
> > 
> 
> >  
> >  int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
> > @@ -179,6 +227,10 @@ int ubi_volume_cdev_add(struct ubi_device *ubi, struct ubi_volume *vol)
> >  	cdev->name = basprintf("%s.%s", ubi->cdev.name, vol->name);
> >  	cdev->priv = priv;
> >  	cdev->size = vol->used_bytes;
> > +
> > +	if (vol->vol_type == UBI_STATIC_VOLUME)
> > +		cdev->flags = DEVFS_IS_CHARACTER_DEV;
> > +
> >  	cdev->dev = &vol->dev;
> >  	ubi_msg(ubi, "registering %s as /dev/%s", vol->name, cdev->name);
> >  	ret = devfs_create(cdev);
> > diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
> > index 33d4dbf..e3deb3e 100644
> > --- a/drivers/mtd/ubi/upd.c
> > +++ b/drivers/mtd/ubi/upd.c
> > @@ -368,18 +368,6 @@ int ubi_more_update_data(struct ubi_device *ubi, struct ubi_volume *vol,
> >  	}
> >  
> >  	ubi_assert(vol->upd_received <= vol->upd_bytes);
> > -	if (vol->upd_received == vol->upd_bytes) {
> > -		err = ubi_wl_flush(ubi, UBI_ALL, UBI_ALL);
> > -		if (err)
> > -			return err;
> > -		/* The update is finished, clear the update marker */
> > -		err = clear_update_marker(ubi, vol, vol->upd_bytes);
> > -		if (err)
> > -			return err;
> > -		vol->updating = 0;
> > -		err = to_write;
> > -		vfree(vol->upd_buf);
> > -	}
> 
> Why is this removed? Does it still work to just write to the UBI volume
> without this?

writing directly to a dynamic volume never seem to hits this condition.
So this is not causing any problems. clearing updater marker and so on
is done later in ubi_volume_cdev_close(struct cdev *cdev). 
Keeping this causes a assertion for static volumes as the update marker
is cleared twice.

Teresa


> 
> Sascha
> 





More information about the barebox mailing list