Re: how to use jff2 on UBI layer?

Jörn Engel
2006-07-20T09:46:12Z

On Thu, 20 July 2006 11:42:01 +0900, Kyungmin Park wrote:
>
> Is there any easy way?
>
> It's too dificult to mount jffs2 on ubi

As of now, it is impossible, sorry. UBI exports an interface
completely different from MTD, so JFFS2 cannot work on UBI. What I
used was a glue layer, called gluebi, that converts the UBI interface
into an MTD interface. But in its current form, that is still
unacceptable, so I'm working on changing the code.



Right now, gluebi exports a function for jffs2 to find a device by
name. This function tries UBI first and - if it finds one, exports
the UBI as an MTD for jffs2 to use. Now you have an mtd and can also
see in via /proc/mtd, open the mtdblock or mtdchar devices for it,
etc.

When you unmount, the usage count drops to zero and the MTD device
gets removed. No longer do you see a trace in /proc/mtd or can you
open mtdblock or mtdchar devices.

Unless you opened one of the devices while jffs2 was mounted. Then
the usage count stays up and you can continue to use the device.

And if this happens, please don't think about mounting the same device
again, as gluebi would create a _second_ MTD for the same UBI.
Welcome to the world of pain.

As the above clearly is nothing to be proud of, I'm currently working
on opening an MTD device for every UBI volume. This requires to deal
with reference counting in two places, MTD and UBI, and many
interesting race conditions. It also found me wondering why we need
to do the refcounting in two places at all, but that's another story.



Jörn

--
There's nothing better for promoting creativity in a medium than
making an audience feel "Hmm ­ I could do better than that!"
-- Douglas Adams in a slashdot interview