From: Tejun Heo <tj@kernel.org>
To: axboe@kernel.dk, linux-kernel@vger.kernel.org,
linux-scsi@vger.kernel.org, kay.sievers@vrfy.org, jack@suse.cz,
James.Bottomley@HansenPartnership.com
Subject: [PATCHSET RFC] block/SCSI: implement in-kernel disk event handling
Date: Mon, 1 Nov 2010 19:44:34 +0100 [thread overview]
Message-ID: <1288637081-5183-1-git-send-email-tj@kernel.org> (raw)
This patchset implements in-kernel disk event handling framework and
add 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.
>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 seven 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-replace-sr_test_unit_ready-with-scsi_test_unit_.patch
0006-sr-implement-sr_check_events.patch
0007-sd-implement-sd_check_events.patch
0001-0002 are prepreations. 0003 implements the block layer framework
for disk event handling. 0004-0007 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!).
Kay, as you're the media presence polling expert :-) how does this
look to you?
This patchset is on top of v2.6.37-rc1 + clean-up-bdev-claim-release
patchset 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 | 97 ++++----
drivers/scsi/sd.h | 1
drivers/scsi/sr.c | 168 ++++++++------
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, 774 insertions(+), 271 deletions(-)
Thanks.
--
tejun
next reply other threads:[~2010-11-01 18:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-01 18:44 Tejun Heo [this message]
2010-11-01 18:44 ` [PATCH 1/7] block: kill genhd_media_change_notify() Tejun Heo
2010-11-01 18:44 ` [PATCH 2/7] block: move register_disk() and del_gendisk() to block/genhd.c Tejun Heo
2010-11-01 18:44 ` [PATCH 3/7] implement in-kernel gendisk events handling Tejun Heo
2010-11-01 18:44 ` [PATCH 4/7] cdrom: add ->check_events() support Tejun Heo
2010-11-01 18:44 ` [PATCH 5/7] scsi: replace sr_test_unit_ready() with scsi_test_unit_ready() Tejun Heo
2010-11-01 18:44 ` [PATCH 6/7] sr: implement sr_check_events() Tejun Heo
2010-11-01 18:44 ` [PATCH 7/7] sd: implement sd_check_events() Tejun Heo
2010-11-04 17:07 ` [PATCHSET RFC] block/SCSI: implement in-kernel disk event handling Douglas Gilbert
2010-11-04 18:37 ` Mike Anderson
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=1288637081-5183-1-git-send-email-tj@kernel.org \
--to=tj@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=axboe@kernel.dk \
--cc=jack@suse.cz \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
/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
Powered by JetHome