Bug 15644

Summary: block2mtd can not use virtio based block device (virtio_blk)
Product: Drivers Reporter: Stijn Tintel (stijn+bugs)
Component: Flash/Memory Technology DevicesAssignee: David Woodhouse (dwmw2)
Status: RESOLVED CODE_FIX    
Severity: high CC: akpm, alan
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.32.10, 2.6.33 Subsystem:
Regression: No Bisected commit-id:
Attachments: Move initialization of virtio stuff before the initialization of mtd, so that block2mtd can be used on virtio-based block devices.
Move initialization of virtio stuff before the initialization of mtd, so that block2mtd can be used on virtio-based block devices.

Description Stijn Tintel 2010-03-29 01:20:36 UTC
Created attachment 25745 [details]
Move initialization of virtio stuff before the initialization of mtd, so that block2mtd can be used on virtio-based block devices.

Whenever I try to use a virtio based block device as an MTD device with the block2mtd driver, I get the following error:

block2mtd: error: cannot open device /dev/vda2

Since both virtio_blk and block2mtd are builtin into the kernel, I cannot solve this with changing the load order of the modules.

The cause of this problem is that some virtio_* stuff, on which virtio_blk depends, is only initialized after block2mtd. When checking drivers/Makefile, it seems that virtio itself is almost at the bottom, way below stuff like block and others.

I was able to solve my problem by having virtio initialized around the time the Xen stuff is initialized, before block and others. And it shouldn't hurt to have virtio related stuff available earlier during boot either.
Comment 1 Stijn Tintel 2010-03-29 01:50:07 UTC
Created attachment 25746 [details]
Move initialization of virtio stuff before the initialization of mtd, so that block2mtd can be used on virtio-based block devices.

This patch does the same as the previous one, but was made with git and is signed-off.
Comment 2 Andrew Morton 2010-04-13 20:36:02 UTC
Please don't send patches via bugzilla - it causes lots of problems with
our usual patch management and review processes.

Please send this patch via email as per Documentation/SubmittingPatches. 
Suitable recipients may be found via scripts/get_maintainer.pl.  Please
also cc myself on the email.

Thanks.
Comment 3 Stijn Tintel 2010-04-17 12:17:47 UTC
Done.