[PATCH 1/2] UBIFS: add the fixup function

Artem Bityutskiy dedekind1 at gmail.com
Thu May 12 06:33:39 EDT 2011


On Fri, 2011-05-06 at 18:58 -0400, Matthew L. Creech wrote:
> This patch adds the 'ubifs_fixup_free_space()' function which scans all
> LEBs in the filesystem for those that are in-use but have one or more
> empty pages, then re-maps the LEBs in order to erase the empty portions.
> Afterward it removes the "space_fixup" flag from the UBIFS superblock.
> 
> Signed-off-by: Matthew L. Creech <mlcreech at gmail.com>

...

> +static int fixup_leb_free_space(struct ubifs_info *c, int lnum, int len)

I've renamed it to fixup_leb() which seems to be a nicer name.

> +{
> +       int err;
> +       void *sbuf = c->sbuf;
> +
> +       ubifs_assert(len >= 0);
> +       ubifs_assert(len % c->min_io_size == 0);
> +       ubifs_assert(len < c->leb_size);
> +
> +       if (len == 0) {
> +               dbg_mnt("unmap empty LEB %d", lnum);
> +               return ubi_leb_unmap(c->ubi, lnum);
> +       }
> +
> +       dbg_mnt("fixup LEB %d, data len %d", lnum, len);
> +       err = ubi_read(c->ubi, lnum, sbuf, 0, len);
> +       if (err && err != -EBADMSG)
> +               return err;

I've removed the 'err != -EBADMSG' check because I think we do want to
fail in case of unrecoverable ECC errors.

And I've pushed it to ubifs-2.6.git, thanks.

-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)




More information about the linux-mtd mailing list