public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Douglas Gilbert <dgilbert@interlog.com>
To: linux-scsi@vger.kernel.org
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	James Bottomley <James.Bottomley@suse.de>
Subject: Re: [PATCH] scsi_debug: Thin provisioning support
Date: Thu, 29 Oct 2009 01:48:31 -0400	[thread overview]
Message-ID: <4AE92CAF.4090708@interlog.com> (raw)
In-Reply-To: <yq1d44o8piw.fsf@sermon.lab.mkp.net>

[-- Attachment #1: Type: text/plain, Size: 2384 bytes --]

Martin K. Petersen wrote:
> This version fixes 64-bit modulo on 32-bit as well as inadvertent map
> updates when TP was disabled.
> 
> 
> 
> Implement support for thin provisioning in scsi_debug.  No actual memory
> de-allocation is taking place.  The intent is to emulate a thinly
> provisioned storage device, not to be one.
> 
> There are four new module options:
> 
>  - unmap_granularity specifies the granularity at which to track mapped
>    blocks (specified in number of logical blocks).  2048 (1 MB) is a
>    realistic value for disk arrays although some may have a finer
>    granularity.
> 
>  - unmap_alignment specifies the first LBA which is naturally aligned on
>    an unmap_granularity boundary.
> 
>  - unmap_max_desc specifies the maximum number of ranges that can be
>    unmapped using one UNMAP command.  If this is 0, only WRITE SAME is
>    supported and UNMAP will cause a check condition.
> 
>  - unmap_max_blocks specifies the maximum number of blocks that can be
>    unmapped using a single UNMAP command.  Default is 0xffffffff.
> 
> These parameters are reported in the new and extended block limits VPD.
> 
> If unmap_granularity is specified the device is tagged as thin
> provisioning capable in READ CAPACITY(16).  A bitmap is allocated to
> track whether blocks are mapped or not.  A WRITE request will cause a
> block to be mapped.  So will WRITE SAME unless the UNMAP bit is set.
> 
> Blocks can be unmapped using either WRITE SAME or UNMAP.  No accounting
> is done to track partial blocks.  This means that only whole blocks will
> be marked free.  This is how the array people tell me their firmwares
> work.
> 
> GET LBA STATUS is also supported.  This command reports whether a block
> is mapped or not, and how long the adjoining mapped/unmapped extent is.
> 
> The block allocation bitmap can also be viewed from user space via:
> 
> 	/sys/bus/pseudo/drivers/scsi_debug/map
> 
> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Acked-by: Douglas Gilbert <dgilbert@interlog.com>

While testing scsi_debug with these patches I found a
problem with the Block Limits VPD page function. The
length returned by the inquiry_evpd_b0() function was
too short. A patch to fix that and a cosmetic change
(that the form factor of scsi_debug is less than 1.8
inches) is attached.

Signed-of-by: Douglas Gilbert <dgilbert@interlog.com>


[-- Attachment #2: sdebug2631dg1.patch --]
[-- Type: text/x-patch, Size: 864 bytes --]

--- linux/drivers/scsi/scsi_debug.c2631mp2	2009-10-14 11:41:17.000000000 -0400
+++ linux/drivers/scsi/scsi_debug.c	2009-10-15 14:52:08.000000000 -0400
@@ -685,10 +685,12 @@
 }
 
 
+/* Block limits VPD page (SBC-3) */
 static unsigned char vpdb0_data[] = {
-	/* from 4th byte */ 0,0,0,4,
-	0,0,0x4,0,
-	0,0,0,64,
+	/* from 4th byte */ 0,0,0,4, 0,0,0x4,0, 0,0,0,64,
+	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
 };
 
 static int inquiry_evpd_b0(unsigned char * arr)
@@ -731,11 +733,14 @@
 	return sizeof(vpdb0_data);
 }
 
+/* Block device characteristics VPD page (SBC-3) */
 static int inquiry_evpd_b1(unsigned char *arr)
 {
 	memset(arr, 0, 0x3c);
 	arr[0] = 0;
-	arr[1] = 1;
+	arr[1] = 1;	/* non rotating medium (e.g. solid state) */
+	arr[2] = 0;
+	arr[3] = 5;	/* less than 1.8" */
 
 	return 0x3c;
 }

  reply	other threads:[~2009-10-29  5:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-15 18:45 [PATCH] scsi_debug: Thin provisioning support Martin K. Petersen
2009-10-29  5:48 ` Douglas Gilbert [this message]
2009-10-29  7:09 ` Christoph Hellwig
2009-10-30  2:33   ` Martin K. Petersen
2009-10-29  7:23 ` Christoph Hellwig
2009-10-30  2:40   ` Martin K. Petersen

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=4AE92CAF.4090708@interlog.com \
    --to=dgilbert@interlog.com \
    --cc=James.Bottomley@suse.de \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /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