* [PATCH] (quickfix) allow md devices to be used in 2.5.43
@ 2002-10-16 18:59 David Mansfield
0 siblings, 0 replies; only message in thread
From: David Mansfield @ 2002-10-16 18:59 UTC (permalink / raw)
To: Alexander Viro, linux-kernel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 825 bytes --]
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
--
/==============================\
| David Mansfield |
| david@cobite.com |
\==============================/
[-- Attachment #2: Type: TEXT/PLAIN, Size: 1135 bytes --]
--- linux-2.5.43/fs/block_dev.c Mon Sep 16 07:25:59 2002
+++ linux-currentish-vanilla/fs/block_dev.c Mon Sep 16 10:54:59 2002
@@ -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;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-10-16 18:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-10-16 18:59 [PATCH] (quickfix) allow md devices to be used in 2.5.43 David Mansfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®