[dm-devel] Re: jbd2 inside a device mapper module

Theodore Tso tytso at MIT.EDU
Wed Dec 24 23:49:15 UTC 2008


On Wed, Dec 24, 2008 at 07:10:38PM -0200, Alberto Bertogli wrote:
> 
> I'm writing a small device mapper module, and I'm interested in placing
> a jbd/jdb2 journal on the backing device.
> 
> I started by trying to do a __bread() manually (just for early tests)
> inside my map function. But it got stucked, as far as I could see,
> waiting for a buffer head in wait_on_buffer() IIRC (I could track it
> down again if it's needed). And I couldn't find why it was locked, since
> it was an unused loopback device, and my code didn't even deal with
> buffer heads.

I have no idea why you would need to do manual __breads().  No doubt
I'm missing some context here.   

> Then, since I was planning on using jbd/jdb2 anyway, I decided to use it
> (and went for jbd2).
> 
> Now, I'm having issues with journal creation.
> 
> I tried using "mkfs.ext3 -O journal_dev", but jbd2_journal_load()
> complains that it can't find the journal superblock.

So I'll tell you how to do this via simple hard drives, and you can
figure out how to make it work with dm.  Note that if the journal
device isn't on a stand-alone spindle, it's probably not going to help
you.  The whole point of using an external journal device is to avoid
the seeking on the journal device, or to take advantage of the speed
of a battery-backed NVRAM device.  I'm not sure how much sense it
makes to use dm-based external journal device.... what exactly do you
hope to achieve.

To create an external journal device on the device /dev/sda:

   mke2fs -O journal_dev /dev/sda

To create a new filesystem on /dev/sdb1 that will use the external
journal found on /dev/sda:

   mke2fs -j -J device=/dev/sda /dev/sdb1

						- Ted

P.S.   All of this is in the mke2fs man page....




More information about the dm-devel mailing list