Skip to contentSkip to conversation

Need help in writing Layered driver in Linux

DISCUSSION Palakodeti, Srinivasa Rao (STSD) 2 participants 2 messages Nov 5, 2006 1 message not in the archive

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi All,

I want to write a layered driver for a device in Linux. I am overwriting make_request_fn in blk_dev strucure. Whenever they is an I/O my make_request_fn is called so that I can change the buffer_head and send to other disk by calling submit_bh in my make_request_fn as following.

		bh->b_dev = MKDEV(252,0); // I am changing to other disk
device
		atomic_set(&bh->b_count, 1);
		submit_bh(WRITE, bh);

This is not working. It is giving me kernel panic Could you help me how should I go about it?

My purpose is all I/O to Disk1 should to passed to Disk2.

Regards,
Srinivas

#2 lore raw
Quoted 3 lines · Srinivasa Rao (STSD)

Hi All,

I want to write a layered driver for a device in Linux.

Hi,

the best way to do that is to make a plugin for DeviceMapper, that's the generic remapping layer in the linux kernel....
see drivers/md/

Greetings,
Arjan van de Ven

Signature · 2 lines
if you want to mail me at work (you don't), use arjan (at) linux.intel.com
Test the interaction between Linux and your BIOS via http://www.linuxfirmwarekit.org