All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET] block/SCSI: implement in-kernel disk event handling, take#2
@ 2010-12-08 19:57 Tejun Heo
  2010-12-08 19:57 ` [PATCH 1/8] block: kill genhd_media_change_notify() Tejun Heo
                   ` (8 more replies)
  0 siblings, 9 replies; 33+ messages in thread
From: Tejun Heo @ 2010-12-08 19:57 UTC (permalink / raw)
  To: jeff, linux-ide, axboe, linux-kernel, linux-scsi, kay.sievers,
	jack, James.Bottomley

This is the second take of in-kernel-disk-event patchset which
implements in-kernel disk event handling framework and adds support
for it to sr and sd.  This is largely to move media presence polling
into kernel as userspace implementation turned out to be quite
problematic over the years.

Changes from the last take[L] are,

- Rebased on top of the current block#for-2.6.38/core branch.

- TUR error handling in sr was incorrect both before and after the
  patchset.  0005-scsi-fix-TUR-error-handling-in-sr_media_change.patch
  is added to fix the bug.

- For both sr and sd, ->media_present should be initialized to 1
  instead of 0.  This fixes problems with initial partition scan
  spotted by Kay.

- Various misc updates - comments, patch descriptions, etc.

>From the patch description of the third patch,

 Currently, media presence polling for removeable block devices is done
 from userland.  There are several issues with this.

 * Polling is done by periodically opening the device.  For SCSI
   devices, the command sequence generated by such action involves a
   few different commands including TEST_UNIT_READY.  This behavior,
   while perfectly legal, is different from Windows which only issues
   single command, GET_EVENT_STATUS_NOTIFICATION.  Unfortunately, some
   ATAPI devices lock up after being periodically queried such command
   sequences.

 * There is no reliable and unintrusive way for a userland program to
   tell whether the target device is safe for media presence polling.
   For example, polling for media presence during an on-going burning
   session can make it fail.  The polling program can avoid this by
   opening the device with O_EXCL but then it risks making a valid
   exclusive user of the device fail w/ -EBUSY.

 * Userland polling is unnecessarily heavy and in-kernel implementation
   is lighter and better coordinated (workqueue, timer slack).

This patchset contains the following eight patches.

 0001-block-kill-genhd_media_change_notify.patch
 0002-block-move-register_disk-and-del_gendisk-to-block-ge.patch
 0003-implement-in-kernel-gendisk-events-handling.patch
 0004-cdrom-add-check_events-support.patch
 0005-scsi-fix-TUR-error-handling-in-sr_media_change.patch
 0006-scsi-replace-sr_test_unit_ready-with-scsi_test_unit_.patch
 0007-sr-implement-sr_check_events.patch
 0008-sd-implement-sd_check_events.patch

0001-0002 are prepreations.  0003 implements the block layer framework
for disk event handling.  0004-0008 add support for it to cdrom and
then sr and sd.

Block drivers just need to implement a new bdev method
->check_events() which supercedes ->media_change() and set
bdev->events[_async] masks according to what the device can do.
Everything else is handled by block layer including event generation,
polling and its configuration.

Tested with dvd drives and an iomega click drive (a removable direct
access ATAPI device Alan gave to me, still operational!).

This patchset is on top of block#for-2.6.38/core and available in the
following git tree,

 git://git.kernel.org/pub/scm/linux/kernel/git/tj/misc.git disk-events

and contains the following changes.

 block/genhd.c           |  544 +++++++++++++++++++++++++++++++++++++++++++++---
 drivers/cdrom/cdrom.c   |   55 ++++
 drivers/scsi/scsi_lib.c |   13 -
 drivers/scsi/sd.c       |   95 ++++----
 drivers/scsi/sd.h       |    1 
 drivers/scsi/sr.c       |  172 ++++++++-------
 drivers/scsi/sr.h       |    3 
 drivers/scsi/sr_ioctl.c |    2 
 fs/block_dev.c          |   41 +++
 fs/partitions/check.c   |   89 -------
 include/linux/blkdev.h  |    4 
 include/linux/cdrom.h   |    6 
 include/linux/fs.h      |    1 
 include/linux/genhd.h   |   20 +
 include/scsi/scsi.h     |    1 
 15 files changed, 778 insertions(+), 269 deletions(-)

Thanks.

--
tejun

[L] http://thread.gmane.org/gmane.linux.scsi/63258

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2011-02-10 17:30 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-08 19:57 [PATCHSET] block/SCSI: implement in-kernel disk event handling, take#2 Tejun Heo
2010-12-08 19:57 ` [PATCH 1/8] block: kill genhd_media_change_notify() Tejun Heo
2010-12-08 19:57 ` [PATCH 2/8] block: move register_disk() and del_gendisk() to block/genhd.c Tejun Heo
2010-12-08 19:57 ` [PATCH 3/8] implement in-kernel gendisk events handling Tejun Heo
2010-12-08 19:57 ` [PATCH 4/8] cdrom: add ->check_events() support Tejun Heo
2010-12-08 19:57 ` [PATCH 5/8] scsi: fix TUR error handling in sr_media_change() Tejun Heo
2010-12-08 20:14   ` Rolf Eike Beer
2010-12-09 10:18   ` [PATCH UPDATED " Tejun Heo
2010-12-09 18:20   ` [PATCH " Sergei Shtylyov
2010-12-09 18:53     ` Tejun Heo
2010-12-08 19:57 ` [PATCH 6/8] scsi: replace sr_test_unit_ready() with scsi_test_unit_ready() Tejun Heo
2010-12-08 19:57 ` [PATCH 7/8] sr: implement sr_check_events() Tejun Heo
2011-01-30  1:26   ` Simon Arlott
2011-01-30  1:31     ` [PATCH] cdrom: support devices that have check_events but not media_changed Simon Arlott
2011-01-31 10:12       ` Tejun Heo
2011-01-31 18:26         ` [PATCH (v2)] " Simon Arlott
2011-01-31 11:22       ` [PATCH] " Sergei Shtylyov
2011-02-10 17:30     ` [PATCH 7/8] sr: implement sr_check_events() ael
2010-12-08 19:57 ` [PATCH 8/8] sd: implement sd_check_events() Tejun Heo
2010-12-16 16:31 ` [PATCHSET] block/SCSI: implement in-kernel disk event handling, take#2 Tejun Heo
2010-12-16 16:36   ` Jens Axboe
2010-12-16 16:38     ` James Bottomley
2010-12-16 16:44       ` Kay Sievers
2010-12-16 16:44         ` Kay Sievers
2010-12-16 16:41     ` Kay Sievers
2010-12-16 16:43       ` Jens Axboe
2010-12-16 16:45         ` Tejun Heo
2010-12-16 17:00           ` Jens Axboe
2010-12-16 18:11             ` Tejun Heo
2010-12-16 16:55         ` Jens Axboe
2010-12-16 16:55           ` Jens Axboe
2010-12-16 17:00   ` Christoph Hellwig
2010-12-16 18:04     ` Tejun Heo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.