+ block-layer-early-detection-of-medium-not-present.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     block layer: early detection of medium not present

has been added to the -mm tree.  Its filename is

     block-layer-early-detection-of-medium-not-present.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: block layer: early detection of medium not present
From: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>


When the block layer checks for new media in a drive, it uses a two-step
procedure: First it checks for media change and then it revalidates the
disk.  When no medium is present the second step fails.

However some drivers (such as the SCSI disk driver) are capable of
detecting medium-not-present as part of the media-changed check.  Doing so
will reduce by a factor of 2 or more the amount of work done by tasks
which, like hald, constantly poll empty drives.

This patch (as694) changes the block layer core to make it recognize a
-ENOMEDIUM error return from the media_changed method.  A follow-on patch
makes the sd driver return this code when no medium is present.

In fact, each sd poll by hald ends up sending 8 (!) SCSI commands: 4 pairs
of TEST UNIT READY plus REQUEST SENSE.  These patches will reduce it to
two commands.

As far as I can see, drivers don't return anything other than 0 or 1 for
media_changed, so recognizing this error code shouldn't cause any new
problems.

Signed-off-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxx>
Cc: Jens Axboe <axboe@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 fs/block_dev.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff -puN fs/block_dev.c~block-layer-early-detection-of-medium-not-present fs/block_dev.c
--- devel/fs/block_dev.c~block-layer-early-detection-of-medium-not-present	2006-06-06 16:49:00.000000000 -0700
+++ devel-akpm/fs/block_dev.c	2006-06-06 16:49:00.000000000 -0700
@@ -837,14 +837,18 @@ int check_disk_change(struct block_devic
 {
 	struct gendisk *disk = bdev->bd_disk;
 	struct block_device_operations * bdops = disk->fops;
+	int rc;
 
 	if (!bdops->media_changed)
 		return 0;
-	if (!bdops->media_changed(bdev->bd_disk))
+	rc = bdops->media_changed(bdev->bd_disk);
+	if (!rc)
 		return 0;
 
 	if (__invalidate_device(bdev))
 		printk("VFS: busy inodes on changed media.\n");
+	if (rc == -ENOMEDIUM)
+		return 1;
 
 	if (bdops->revalidate_disk)
 		bdops->revalidate_disk(bdev->bd_disk);
_

Patches currently in -mm which might be from stern@xxxxxxxxxxxxxxxxxxx are

e100-disable-interrupts-at-boot.patch
allow-raw_notifier-callouts-to-unregister-themselves.patch
block-layer-early-detection-of-medium-not-present.patch
scsi-core-and-sd-early-detection-of-medium-not-present.patch
sd-early-detection-of-medium-not-present.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux