[PATCH 2/3] ubifs: add ubifs_mount_fixup_lebs()

Artem Bityutskiy dedekind1 at gmail.com
Fri May 6 10:44:51 EDT 2011


On Thu, 2011-05-05 at 16:36 -0400, Matthew L. Creech wrote:
> On Thu, May 5, 2011 at 7:49 AM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> >
> > The area which go _fefore_ the main are are special case.
> >
> > The lprops area are LEBs from number c->lpt_first to number c->lpt_last.
> > For those you need to look at the ltab:
> >
> > c->ltab[lnum - c->lpt_first].free is what you need, where lnum is the
> > LEB number you need the amount of free space for.
> >
> > For the orphans area [c->orph_first, c->orph_last] - you may to just
> > unmap them all, because when after mount this area does not contain any
> > useful data.
> >
> > Master area - LEBs UBIFS_MST_LNUM and UBIFS_MST_LNUM + 1 - you know the
> > free space start at c->mst_offs + c->mst_node_alsz. So the amount of
> > used space there is c->mst_offs + c->mst_node_alsz and free space is
> > c->leb_size - c->mst_offs - c->mst_node_alsz; And it is the same for
> > both master area LEBs.
> >
> > And finally the SB area (1 LEB) - you can skip this, but for
> > consistency, you can also fix it up. Amount of used space there is
> > always UBIFS_SB_NODE_SZ.
> >
> 
> OK, I've separated these out in the v3 patch.  I also ignored the log
> LEBs, since you didn't mention those, and I wasn't sure how to handle
> them - are they OK to leave alone?  Or could they cause similar
> problems if not cleaned up?

Actually the log LEBs shoule be processed as well. I think:

1. all LEBs which are _not_ between the log tail and head should be
unmapped.
2. log head should be fixed up.

I'll send some code to you soon.

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




More information about the linux-mtd mailing list