(quickfix) allow md devices to be used in 2.5.43
PATCH 1/1 (quickfix) allow md devices to be used in 2.5.43
Al, list,
In order to accessing my md devices in 2.5.43, i needed the attached patch to fs/block_dev.c. WARNING: it's probably very broken, because I don't know what I'm doing. I essentially reverted most of the changes to the do_open function, allowing the open() method of a device without an attached gendisk to be called.
In the md scheme of things, the gendisk is created in the md_run stage, which is only possible via ioctl after a successful open of the block device.
However, something else is broken with the change to md.c, which detects whether the disk is idle by checking the number of sectors read/written to the disk.
I'm going to take a look at that now.
David
Signature · 4 lines
/==============================\ | David Mansfield | | [email protected] | \==============================/
fs/block_dev.c +8 -6
@@ -612,12 +612,12 @@if (owner)__MOD_DEC_USE_COUNT (owner); } + disk =get_gendisk (bdev->bd_dev, &part); -if (!disk) - goto out1; +if (!bdev->bd_contains) { bdev->bd_contains = bdev; -if (part) { +if (disk && part) {struct block_device *whole; whole =bdget (MKDEV (disk->major, disk->first_minor)); ret = -ENOMEM ;
@@ -630,8 +630,6 @@ } }if (bdev->bd_contains == bdev) { -if (!bdev->bd_openers) - bdev->bd_disk = disk;if (!bdev->bd_queue) {struct blk_dev_struct *p = blk_dev +major (dev); bdev->bd_queue = &p->request_queue;
@@ -645,8 +643,12 @@ }if (!bdev->bd_openers) {struct backing_dev_info *bdi; +sector_t sect =0 ; + bdev->bd_offset =0 ; -bd_set_size (bdev, (loff_t )get_capacity (disk) <<9 ); +if (disk) + sect =get_capacity (disk); +bd_set_size (bdev, (loff_t )sect <<9 ); bdi =blk_get_backing_dev_info (bdev);if (bdi ==NULL ) bdi = &default_backing_dev_info;