On Thu, Jul 21, 2016 at 01:34:48PM -0600, Eric Blake wrote: > Dell Equallogic iSCSI SANs have a very unusual advertised geometry: > > $ iscsi-inq -e 1 -c $((0xb0)) iscsi://XXX/0 > wsnz:0 > maximum compare and write length:1 > optimal transfer length granularity:0 > maximum transfer length:0 > optimal transfer length:0 > maximum prefetch xdread xdwrite transfer length:0 > maximum unmap lba count:30720 > maximum unmap block descriptor count:2 > optimal unmap granularity:30720 > ugavalid:1 > unmap granularity alignment:0 > maximum write same length:30720 > > which says that both the maximum and the optimal discard size > is 15M. It is not immediately apparent if the device allows > discard requests not aligned to the optimal size, nor if it > allows discards at a finer granularity than the optimal size. > > I tried to find details in the SCSI Commands Reference Manual > Rev. A on what valid values of maximum and optimal sizes are > permitted, but while that document mentions a "Block Limits > VPD Page", I couldn't actually find documentation of that page > or what values it would have, or if a SCSI device has an > advertisement of its minimal unmap granularity. So it is not > obvious to me whether the Dell Equallogic device is compliance > with the SCSI specification. > > Fortunately, it is easy enough to support non-power-of-2 sizing, > even if it means we are less efficient than truly possible when > targetting that device (for example, it means that we refuse to > unmap anything that is not a multiple of 15M and aligned to a > 15M boundary, even if the device truly does support a smaller > granularity where unmapping actually works). > > Reported-by: Peter Lieven <p...@kamp.de> > Signed-off-by: Eric Blake <ebl...@redhat.com> > > --- > Help in locating the actual specs on what SCSI requires for > page 0xb0 would be nice. But this should at least avoid the > assertion failures that Peter is hitting. I was able to > test this patch using NBD on a hacked up qemu where I made > block/nbd.c report the same block limits, and could confirm > the assert under qemu-io 'w -z 0 40m' and 'discard 0 40m' > pre-patch, as well as the post-patch behavior of splitting > things to 15M alignment ('discard 1M 15M' becomes a no-op > because it is not aligned). But obviously it needs to be > tested on the actual iscsi SAN that triggered the original > report. > --- > include/block/block_int.h | 37 ++++++++++++++++++++----------------- > block/io.c | 15 +++++++++------ > 2 files changed, 29 insertions(+), 23 deletions(-)
Acked-by: Stefan Hajnoczi <stefa...@redhat.com>
signature.asc
Description: PGP signature