* Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity [not found] ` <1241828002-12742-3-git-send-email-tj@kernel.org> @ 2009-05-09 4:23 ` James Bottomley 2009-05-09 16:09 ` Tejun Heo 0 siblings, 1 reply; 10+ messages in thread From: James Bottomley @ 2009-05-09 4:23 UTC (permalink / raw) To: Tejun Heo Cc: jeff, linux-ide, jens.axboe, linux-kernel, linux-scsi, Mauelshagen, dm-devel, dan.j.williams On Sat, 2009-05-09 at 09:13 +0900, Tejun Heo wrote: > Add scsi_device->alt_capacity and let sd pass it over to genhd. This > is to allow SCSI low level drivers to configure alt_capacity via > slave_configure(). > > Signed-off-by: Tejun Heo <tj@kernel.org> > Cc: Jens Axboe <jens.axboe@oracle.com> > Cc: Dan Williams <dan.j.williams@gmail.com> > Cc: Jeff Garzik <jeff@garzik.org> > Cc: James Bottomley <James.Bottomley@HansenPartnership.com> > --- > drivers/scsi/sd.c | 1 + > include/scsi/scsi_device.h | 1 + > 2 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c > index 3fcb64b..f3448bf 100644 > --- a/drivers/scsi/sd.c > +++ b/drivers/scsi/sd.c > @@ -1839,6 +1839,7 @@ static int sd_revalidate_disk(struct gendisk *disk) > blk_queue_ordered(sdkp->disk->queue, ordered, sd_prepare_flush); > > set_capacity(disk, sdkp->capacity); > + set_alt_capacity(disk, sdp->alt_capacity); > kfree(buffer); > > out: > diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h > index 3f566af..b24fdeb 100644 > --- a/include/scsi/scsi_device.h > +++ b/include/scsi/scsi_device.h > @@ -92,6 +92,7 @@ struct scsi_device { > unsigned int manufacturer; /* Manufacturer of device, for using > * vendor-specific cmd's */ > unsigned sector_size; /* size in bytes */ > + size_t alt_capacity; /* alternative capacity, used by sd */ > > void *hostdata; /* available to low-level driver */ > char type; This is done at slightly the wrong level. Capacity is actually a property of struct scsi_disk not struct scsi_device ... shouldn't alt_capacity be at the same level? James ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity 2009-05-09 4:23 ` [PATCH 2/3] scsi: add scsi_device->alt_capacity James Bottomley @ 2009-05-09 16:09 ` Tejun Heo 2009-05-09 16:23 ` James Bottomley 0 siblings, 1 reply; 10+ messages in thread From: Tejun Heo @ 2009-05-09 16:09 UTC (permalink / raw) To: James Bottomley Cc: jeff, linux-scsi, jens.axboe, linux-kernel, linux-ide, dm-devel, Mauelshagen James Bottomley wrote: > This is done at slightly the wrong level. Capacity is actually a > property of struct scsi_disk not struct scsi_device ... shouldn't > alt_capacity be at the same level? Hmmm... I think that was my first try and then I moved it to sdev for some reason I can't rememer now. I'll look into it again and try to move it into sdev. Thanks. -- tejun ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity 2009-05-09 16:09 ` Tejun Heo @ 2009-05-09 16:23 ` James Bottomley 2009-05-10 1:26 ` Tejun Heo 2009-05-15 19:44 ` ATA ULD (was Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity) Jeff Garzik 0 siblings, 2 replies; 10+ messages in thread From: James Bottomley @ 2009-05-09 16:23 UTC (permalink / raw) To: Tejun Heo Cc: jeff, linux-ide, jens.axboe, linux-kernel, linux-scsi, Mauelshagen, dm-devel, dan.j.williams On Sun, 2009-05-10 at 01:09 +0900, Tejun Heo wrote: > James Bottomley wrote: > > This is done at slightly the wrong level. Capacity is actually a > > property of struct scsi_disk not struct scsi_device ... shouldn't > > alt_capacity be at the same level? > > Hmmm... I think that was my first try and then I moved it to sdev for > some reason I can't rememer now. I'll look into it again and try to > move it into sdev. Really one of the things I was wondering is why even scsi_disk ... capacity is in there, but it's also in gendisk, so I've thought (admittedly never translated it to action) that we could just remove the duplication in scsi_disk. This alt_capacity looks to be a pure ATA thing ... I can't find it in the SCSI specs and there doesn't seem to be a SAT equivalent of the commands. Ideally, what should be happening is that the ata ULD would issue the capacity commands and just set the block alt_capacity without having to worry about transporting the value up and down the stack. Matthew Wilcox thought we could begin an implementation of the ATA uld using the ATA_16 command to transport it through SCSI ... this might provide the good reason to begin that. James ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity 2009-05-09 16:23 ` James Bottomley @ 2009-05-10 1:26 ` Tejun Heo 2009-05-15 19:44 ` ATA ULD (was Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity) Jeff Garzik 1 sibling, 0 replies; 10+ messages in thread From: Tejun Heo @ 2009-05-10 1:26 UTC (permalink / raw) To: James Bottomley Cc: jeff, linux-ide, jens.axboe, linux-kernel, linux-scsi, Mauelshagen, dm-devel, dan.j.williams Hello, James. James Bottomley wrote: > On Sun, 2009-05-10 at 01:09 +0900, Tejun Heo wrote: >> James Bottomley wrote: >>> This is done at slightly the wrong level. Capacity is actually a >>> property of struct scsi_disk not struct scsi_device ... shouldn't >>> alt_capacity be at the same level? >> Hmmm... I think that was my first try and then I moved it to sdev for >> some reason I can't rememer now. I'll look into it again and try to >> move it into sdev. > > Really one of the things I was wondering is why even scsi_disk ... > capacity is in there, but it's also in gendisk, so I've thought > (admittedly never translated it to action) that we could just remove the > duplication in scsi_disk. > > This alt_capacity looks to be a pure ATA thing... I can't find it > in the SCSI specs and there doesn't seem to be a SAT equivalent of > the commands. Ideally, what should be happening is that the ata ULD > would issue the capacity commands and just set the block > alt_capacity without having to worry about transporting the value up > and down the stack. Matthew Wilcox thought we could begin an > implementation of the ATA uld using the ATA_16 command to transport > it through SCSI ... this might provide the good reason to begin > that. Yeap, it's a purely ATA specific workaround. Now I remembered what was the problem. The problem was that the latest hook libata can use is ->slave_configure which is called before HLD attaches, so there's no sdkp or genhd associated during libata configuration. Longer term, this definitely is something which should be stripped out of SCSI whether that happens with ATA HLD on top of SCSI or a completely separate stack. Any better ideas on how to work around this for now? Thanks. -- tejun ^ permalink raw reply [flat|nested] 10+ messages in thread
* ATA ULD (was Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity) 2009-05-09 16:23 ` James Bottomley 2009-05-10 1:26 ` Tejun Heo @ 2009-05-15 19:44 ` Jeff Garzik 1 sibling, 0 replies; 10+ messages in thread From: Jeff Garzik @ 2009-05-15 19:44 UTC (permalink / raw) To: James Bottomley Cc: Tejun Heo, linux-ide, jens.axboe, linux-kernel, linux-scsi, Mauelshagen, dm-devel, dan.j.williams James Bottomley wrote: > On Sun, 2009-05-10 at 01:09 +0900, Tejun Heo wrote: >> James Bottomley wrote: >>> This is done at slightly the wrong level. Capacity is actually a >>> property of struct scsi_disk not struct scsi_device ... shouldn't >>> alt_capacity be at the same level? >> Hmmm... I think that was my first try and then I moved it to sdev for >> some reason I can't rememer now. I'll look into it again and try to >> move it into sdev. > > Really one of the things I was wondering is why even scsi_disk ... > capacity is in there, but it's also in gendisk, so I've thought > (admittedly never translated it to action) that we could just remove the > duplication in scsi_disk. > > This alt_capacity looks to be a pure ATA thing ... I can't find it in > the SCSI specs and there doesn't seem to be a SAT equivalent of the > commands. Ideally, what should be happening is that the ata ULD would > issue the capacity commands and just set the block alt_capacity without > having to worry about transporting the value up and down the stack. > Matthew Wilcox thought we could begin an implementation of the ATA uld > using the ATA_16 command to transport it through SCSI ... this might > provide the good reason to begin that. hmmmmm. Well, ATA ULD is certainly the long term goal. My main worry would then be user impact & confusion, and increasing the difficulty of separating libata from SCSI by increasing difficulty of making SCSI emulation an optional piece. At this point the SCSI emulation is not only a hack to get sd.c to do work for us, it is also part of the ABI expected of diagnostic tools and the like. That complicates changes. It is my hope that we can separate libata-scsi.c into a separate kernel module, thus at least making it _optional_, thus providing a path for CONFIG_ATA + !CONFIG_SCSI. I do also agree that the ATA hacks can only go on for so long, before they start infecting SCSI. e.g. there was a patch to add DMI check in sd.c for an ATA hardware special case. So far the "ATA infection" has been thankfully limited to things that sd might need anyway, like suspend/resume (start/stop) A "libsd" does not seem viable, though. Might be better to cp sd.c ata-disk.c and then iterate from there, over time. Jeff ^ permalink raw reply [flat|nested] 10+ messages in thread
[parent not found: <1241828002-12742-2-git-send-email-tj@kernel.org>]
* Re: [PATCH 1/3] block: add alt_size [not found] ` <1241828002-12742-2-git-send-email-tj@kernel.org> @ 2009-05-09 13:45 ` Kay Sievers 2009-05-09 14:04 ` Tejun Heo 0 siblings, 1 reply; 10+ messages in thread From: Kay Sievers @ 2009-05-09 13:45 UTC (permalink / raw) To: Tejun Heo Cc: jeff, linux-ide, jens.axboe, linux-kernel, linux-scsi, James.Bottomley, Mauelshagen, dm-devel, dan.j.williams On Sat, May 9, 2009 at 02:13, Tejun Heo <tj@kernel.org> wrote: > This patch adds alt_size to genhd and exports it via sysfs. alt_size > is always smaller than the regular size. Being a hint, alt_size can > also be set from userland by writing to the sysfs node mostly for > debugging and testing. What does "alt_" stand for? I think that should be more descriptive in an exported interface. And can we please keep the "size_*" in front of the name, so that they group together? Also, values with magic block counts, while there is no way to get the blocksize with the same interface, are pretty weird. I think the current "size" attribute is just a bug. Not sure, how that should be solved, by adding a "blocksize" attribute that is always in the same context as the current "size*" values, or by just using bytes for new attributes here. Almost all tools I've seen using these attributes, have hardcoded * 512 in there, which may cause trouble pretty soon. And this is mostly a failure of the interface and not of the users, I think. Thanks, Kay -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] block: add alt_size 2009-05-09 13:45 ` [PATCH 1/3] block: add alt_size Kay Sievers @ 2009-05-09 14:04 ` Tejun Heo 2009-05-09 16:26 ` Kay Sievers 2009-05-11 13:45 ` [dm-devel] " Konrad Rzeszutek 0 siblings, 2 replies; 10+ messages in thread From: Tejun Heo @ 2009-05-09 14:04 UTC (permalink / raw) To: Kay Sievers Cc: jeff, linux-scsi, Mauelshagen, linux-kernel, linux-ide, dm-devel, jens.axboe Hello, Kay Sievers wrote: > What does "alt_" stand for? I think that should be more descriptive in > an exported interface. Alternative. > And can we please keep the "size_*" in front of the name, so that they > group together? Maybe, but size_alt? Any better ideas? > Also, values with magic block counts, while there is no way to get the > blocksize with the same interface, are pretty weird. I think the > current "size" attribute is just a bug. Logical block size is fixed at 512 bytes. Offset and size are always represented in multiples of 512 bytes and only get converted to hardware block size in the lld. > Not sure, how that should be solved, by adding a "blocksize" attribute > that is always in the same context as the current "size*" values, or > by just using bytes for new attributes here. > > Almost all tools I've seen using these attributes, have hardcoded * > 512 in there, which may cause trouble pretty soon. And this is mostly > a failure of the interface and not of the users, I think. No, it will never break. It will always be 512. It's there to give nine bit shift to allow additional 9 bit of addressing without going to the next full blown bitwidth. It's chosen to be the lowest common denominator which gives enough addressing boost to hold things together till the next bitwidth becomes popular. For userlevel exporting, it might have been better to use just bytes there as preformance isn't really an issue, but, well, it's already determined, so.. Thanks. -- tejun ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 1/3] block: add alt_size 2009-05-09 14:04 ` Tejun Heo @ 2009-05-09 16:26 ` Kay Sievers 2009-05-11 13:45 ` [dm-devel] " Konrad Rzeszutek 1 sibling, 0 replies; 10+ messages in thread From: Kay Sievers @ 2009-05-09 16:26 UTC (permalink / raw) To: Tejun Heo Cc: jeff, linux-ide, jens.axboe, linux-kernel, linux-scsi, James.Bottomley, Mauelshagen, dm-devel, dan.j.williams On Sat, May 9, 2009 at 16:04, Tejun Heo <tj@kernel.org> wrote: > Kay Sievers wrote: >> What does "alt_" stand for? I think that should be more descriptive in >> an exported interface. > > Alternative. > >> And can we please keep the "size_*" in front of the name, so that they >> group together? > > Maybe, but size_alt? Any better ideas? "size_limit" "size_restricted" "size_clipped" "size_constrain" anything that ideally would express that this is smaller than the actual "size", and that is is a "configured" value and not some hardware property. >> Also, values with magic block counts, while there is no way to get the >> blocksize with the same interface, are pretty weird. I think the >> current "size" attribute is just a bug. > > Logical block size is fixed at 512 bytes. Offset and size are always > represented in multiples of 512 bytes and only get converted to > hardware block size in the lld. Oh, good. Didn't know that this will always be 512, even for devices with a native size larger than this. >> Not sure, how that should be solved, by adding a "blocksize" attribute >> that is always in the same context as the current "size*" values, or >> by just using bytes for new attributes here. >> >> Almost all tools I've seen using these attributes, have hardcoded * >> 512 in there, which may cause trouble pretty soon. And this is mostly >> a failure of the interface and not of the users, I think. > > No, it will never break. It will always be 512. Cool. No problem then. :) > For userlevel exporting, it might have been better to use just bytes > there as preformance isn't really an issue, but, well, it's already > determined, so.. Right, but if it can not change, it's fine, I guess. Thanks, Kay ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dm-devel] Re: [PATCH 1/3] block: add alt_size 2009-05-09 14:04 ` Tejun Heo 2009-05-09 16:26 ` Kay Sievers @ 2009-05-11 13:45 ` Konrad Rzeszutek 2009-05-12 0:53 ` Tejun Heo 1 sibling, 1 reply; 10+ messages in thread From: Konrad Rzeszutek @ 2009-05-11 13:45 UTC (permalink / raw) To: device-mapper development, tj Cc: Kay Sievers, jeff, linux-scsi, Mauelshagen, linux-kernel, linux-ide, jens.axboe, martin.petersen .. snip .. > > Also, values with magic block counts, while there is no way to get the > > blocksize with the same interface, are pretty weird. I think the > > current "size" attribute is just a bug. > > Logical block size is fixed at 512 bytes. Offset and size are always > represented in multiples of 512 bytes and only get converted to > hardware block size in the lld. That interpretation is at odds with the work that Martin Peterson is doing with the 4K support. In the e-mail titled: "Re: [PATCH 4 of 8] sd: Physical block size and alignment support", Message-ID:<yq1ab67b51p.fsf@sermon.lab.mkp.net> he says: " Konrad> about what a 'logical block', and 'physical block' is Konrad> vs. 'hardware sector' ? Well, another item on my todo list is to kill the notion of hardware sector completely. The protocols have been referring to logical blocks for ages. It hasn't been a big problem until now because logical block size has been equal to the hardware sector size. That's no longer a valid assumption. " Are the ATA/SCSI/etc specs at odds with each other about this? ^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Re: [PATCH 1/3] block: add alt_size 2009-05-11 13:45 ` [dm-devel] " Konrad Rzeszutek @ 2009-05-12 0:53 ` Tejun Heo 0 siblings, 0 replies; 10+ messages in thread From: Tejun Heo @ 2009-05-12 0:53 UTC (permalink / raw) To: Konrad Rzeszutek Cc: jens.axboe, jeff, linux-scsi, linux-kernel, martin.petersen, linux-ide, device-mapper development, Mauelshagen Konrad Rzeszutek wrote: > .. snip .. >>> Also, values with magic block counts, while there is no way to get the >>> blocksize with the same interface, are pretty weird. I think the >>> current "size" attribute is just a bug. >> Logical block size is fixed at 512 bytes. Offset and size are always >> represented in multiples of 512 bytes and only get converted to >> hardware block size in the lld. > > That interpretation is at odds with the work that Martin Peterson is > doing with the 4K support. In the e-mail titled: "Re: [PATCH 4 of 8] sd: > Physical block size and alignment support", > Message-ID:<yq1ab67b51p.fsf@sermon.lab.mkp.net> he says: > > " > Konrad> about what a 'logical block', and 'physical block' is > Konrad> vs. 'hardware sector' ? > > Well, another item on my todo list is to kill the notion of hardware > sector completely. The protocols have been referring to logical blocks > for ages. > > It hasn't been a big problem until now because logical block size has > been equal to the hardware sector size. That's no longer a valid > assumption. > " > > Are the ATA/SCSI/etc specs at odds with each other about this? Hardware specs aren't of concern here. The logical block concept is there simply to give 9 bit addressing advantage, nothing more, nothing less. If hardware's sector size doesn't match it, the lld should be mapping the sector addresses and sizes and cdrom and a few other drives have been doing that for ages. There's nothing new about devices with sectors larger than 512 bytes. Thanks. -- tejun ^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2009-05-15 19:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1241828002-12742-1-git-send-email-tj@kernel.org>
[not found] ` <1241828002-12742-3-git-send-email-tj@kernel.org>
2009-05-09 4:23 ` [PATCH 2/3] scsi: add scsi_device->alt_capacity James Bottomley
2009-05-09 16:09 ` Tejun Heo
2009-05-09 16:23 ` James Bottomley
2009-05-10 1:26 ` Tejun Heo
2009-05-15 19:44 ` ATA ULD (was Re: [PATCH 2/3] scsi: add scsi_device->alt_capacity) Jeff Garzik
[not found] ` <1241828002-12742-2-git-send-email-tj@kernel.org>
2009-05-09 13:45 ` [PATCH 1/3] block: add alt_size Kay Sievers
2009-05-09 14:04 ` Tejun Heo
2009-05-09 16:26 ` Kay Sievers
2009-05-11 13:45 ` [dm-devel] " Konrad Rzeszutek
2009-05-12 0:53 ` Tejun Heo
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox