All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Bottomley <James.Bottomley-d9PhHud1JfjCXq6kfMZ53/egYHeGw8Jk@public.gmane.org>
To: Alan Stern <stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>
Cc: Greg KH <greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>,
	USB list <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	SCSI development list
	<linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 7/8] SCSI: add a field to scsi_device to count open file references
Date: Mon, 03 Mar 2008 17:13:15 -0600	[thread overview]
Message-ID: <1204585995.3043.85.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0803031758310.8280-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>

On Mon, 2008-03-03 at 18:04 -0500, Alan Stern wrote:
> On Mon, 3 Mar 2008, James Bottomley wrote:
> 
> > On Mon, 2008-03-03 at 15:16 -0500, Alan Stern wrote:
> > > This patch (as1050) adds a new field to struct scsi_device, to keep a
> > > count of the number of block-device open file references.  This count
> > > will be used by usb-storage to determine whether USB-PERSIST should be
> > > forced on during a suspend.
> > 
> > I don't think this does what's advertised if you mean it to keep a count
> > as the atomics seem to imply. (->open is only called on first open and
> > ->release on last close.  openers was a historical 2.4 field that used
> > to count opens but now just flags whether sd is open or not.
> 
> Um.  The real purpose of that field is to let usb-storage know whether 
> or not the device is open at all.  I used a count because that seemed 
> like the only way to do it; it doesn't matter if the count value 
> doesn't exactly match the actual number of open file references.

OK, so your change log is "whether the device is open" not "a count of
openers".

> I didn't want to use the openers field in struct scsi_disk because this 
> should apply to CDs and any other block devices as well as to disks.
> 
> > Secondly, if you really want an openers count (which I remember SCSI
> > rendering a bad idea ages ago), that's held in struct block_device as
> > openers, isn't it?  So there's no need to duplicate this in SCSI.
> 
> But there's no way to get to the block_device structure if all you're 
> given is the scsi_device, right?  You would have to know something 
> special about it, such as whether it is a disk, a CD, or something 
> else.  This is intended to be generic.

OK, but then the obvious question is why this isn't at the block device
layer?  It doesn't seem right that we'd have a shadow (and not a very
effective one) of bdev->openers just so you can access it from a
scsi_device.  We had a similar problem with the AHCI AN patches which
were solved by altering the layered accesses.

James


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-03-03 23:13 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-03 20:16 [PATCH 7/8] SCSI: add a field to scsi_device to count open file references Alan Stern
     [not found] ` <Pine.LNX.4.44L0.0803031508490.7094-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-03-03 22:01   ` James Bottomley
2008-03-03 23:04     ` Alan Stern
     [not found]       ` <Pine.LNX.4.44L0.0803031758310.8280-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-03-03 23:13         ` James Bottomley [this message]
     [not found]           ` <1204585995.3043.85.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-03-04 16:16             ` Alan Stern
     [not found]               ` <Pine.LNX.4.44L0.0803041101200.4039-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-03-04 16:50                 ` Mike Anderson
2008-03-04 16:52               ` James Bottomley
     [not found]                 ` <1204649571.3091.36.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-03-04 17:43                   ` Alan Stern
2008-03-05 20:55                     ` James Bottomley
2008-03-05 21:24                       ` Alan Stern
     [not found]                         ` <Pine.LNX.4.44L0.0803051608140.4161-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-03-05 21:30                           ` James Bottomley
2008-03-05 21:52                             ` Alan Stern
2008-03-04  0:37       ` Stefan Richter
2008-03-04 17:00         ` Alan Stern
     [not found]           ` <Pine.LNX.4.44L0.0803041151510.4039-100000-IYeN2dnnYyZXsRXLowluHWD2FQJk+8+b@public.gmane.org>
2008-03-04 17:26             ` Stefan Richter
2008-03-04 17:56             ` Stefan Richter
2008-03-04 20:04               ` Alan Stern
2008-03-05 18:04               ` Alan Stern
2008-03-05 19:28                 ` Stefan Richter
2008-03-05 20:34                   ` Alan Stern
2008-03-05 21:14                     ` Stefan Richter
     [not found]                       ` <47CF0D2E.7000607-MtYdepGKPcBMYopoZt5u/LNAH6kLmebB@public.gmane.org>
2008-03-05 21:27                         ` Alan Stern
2008-03-05 21:47                           ` Stefan Richter
2008-03-05 20:13   ` patch scsi-add-a-field-to-scsi_device-to-count-open-file-references.patch added to gregkh-2.6 tree gregkh-l3A5Bk7waGM
     [not found]     ` <1204748015695-4DuetyUvsWfYtjvyW6yDsg@public.gmane.org>
2008-03-05 20:36       ` James Bottomley
     [not found]         ` <1204749410.3047.57.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2008-03-05 20:41           ` Greg KH

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=1204585995.3043.85.camel@localhost.localdomain \
    --to=james.bottomley-d9phhud1jfjcxq6kfmz53/egyhegw8jk@public.gmane.org \
    --cc=greg-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.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 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.