mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Mansfield <david@cobite.com>
To: Alexander Viro <viro@math.psu.edu>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] (quickfix) allow md devices to be used in 2.5.43
Date: Wed, 16 Oct 2002 14:59:30 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.44.0210161451090.30777-200000@admin> (raw)

[-- 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;

                 reply	other threads:[~2002-10-16 18:54 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0210161451090.30777-200000@admin \
    --to=david@cobite.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@math.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®