lkml.org 
[lkml]   [2006]   [Jun]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/3] SCSI core and sd: early detection of medium not present
On Thu, 8 Jun 2006, James Bottomley wrote:

> On Tue, 2006-06-06 at 11:31 -0400, Alan Stern wrote:
> > This patch (as695) changes the scsi_test_unit_ready() routine in the
> > SCSI
> > core to set a new flag when no medium is present. The sd driver is
> > changed to use this new flag for reporting -ENOMEDIUM in from the
> > sd_media_changed method.
>
> This would appear to be duplicating the struct scsi_disk media_present
> flag.

Correct, although the semantics of the two flags aren't exactly the same.

> Moving the media_present flag from scsi_disk to scsi_device may
> make a bit of sense long term ... however, there's also dupication with
> the sr driver and the cdrom layer now (that stores media change at the
> cdrom level), so is there an argument why it's better in scsi_device
> than scsi_disk?

I did it that way in the patch because it was the only simple choice. The
scsi_test_unit_ready() routine is part of the SCSI core and can be called
for devices that aren't disks. Hence any flag it sets cannot be part of
the scsi_disk structure.

In principle the information could be conveyed in the return value from
scsi_test_unit_ready() rather than in a static flag. But the routine has
several callers and I didn't want to change all of them to recognize a
-ENOMEDIUM return code. Now in the long run, perhaps that would be a good
thing to do. Or perhaps moving the flag to scsi_device would be better, I
don't know...

Ultimately this boils down to how you want to represent "No medium
present" in the SCSI core. What do you think is the bets way?

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-09 16:16    [W:0.055 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site