[PATCH 1/1] ubi: Introduce block devices for UBI volumes

Ezequiel Garcia ezequiel.garcia at free-electrons.com
Sun Feb 9 21:36:35 EST 2014


On Sun, Feb 09, 2014 at 11:56:24PM +0100, Richard Weinberger wrote:
> On Wed, Jan 29, 2014 at 9:38 PM, Ezequiel Garcia
> <ezequiel.garcia at free-electrons.com> wrote:
[..]
> > +
> > +static int ubiblock_read_to_buf(struct ubiblock *dev, char *buffer,
> > +                               int leb, int offset, int len)
> > +{
> > +       int ret;
> > +       char *cache_buffer;
> > +       /*
> > +        * First try in cache, if it's not there load this leb.
> > +        * Note that reading never flushes to disk!
> > +        */
> > +       if (leb_in_cache(&dev->cache, leb)) {
> > +               cache_buffer = dev->cache.buffer;
> > +       } else {
> 
> I think you have to flush the cache here too.
> With RW support enabled you can end up with a dirty cache here.
> 

Yes, right. This is a left-over from the two-cache design. Now that we
have just one cache, it's possible to flush it before filling it.

Good catch!
-- 
Ezequiel García, Free Electrons
Embedded Linux, Kernel and Android Engineering
http://free-electrons.com



More information about the linux-mtd mailing list