diff options
author | Martin K. Petersen <martin.petersen@oracle.com> | 2010-03-23 01:12:27 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-30 13:45:28 -0400 |
commit | e308b3d19d1cf6af39024121269bb384b95d3da3 (patch) | |
tree | 81a2d6de1ff9d59478061e8197f1676adc192531 | |
parent | 9dc9fd9484c5168d23fe855e6c56543d96b6695b (diff) |
[SCSI] scsi_debug: Block Limits VPD page fixes
Add a few clarifying comments in the B0 page function and allow the
optimal transfer length field to be specified on the command line using
opt_blks=N.
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
-rw-r--r-- | drivers/scsi/scsi_debug.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index a783cd33a3e4..e7b39f133482 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -108,6 +108,7 @@ static const char * scsi_debug_version_date = "20100324"; | |||
108 | #define DEF_ATO 1 | 108 | #define DEF_ATO 1 |
109 | #define DEF_PHYSBLK_EXP 0 | 109 | #define DEF_PHYSBLK_EXP 0 |
110 | #define DEF_LOWEST_ALIGNED 0 | 110 | #define DEF_LOWEST_ALIGNED 0 |
111 | #define DEF_OPT_BLKS 64 | ||
111 | #define DEF_UNMAP_MAX_BLOCKS 0 | 112 | #define DEF_UNMAP_MAX_BLOCKS 0 |
112 | #define DEF_UNMAP_MAX_DESC 0 | 113 | #define DEF_UNMAP_MAX_DESC 0 |
113 | #define DEF_UNMAP_GRANULARITY 0 | 114 | #define DEF_UNMAP_GRANULARITY 0 |
@@ -175,6 +176,7 @@ static int scsi_debug_guard = DEF_GUARD; | |||
175 | static int scsi_debug_ato = DEF_ATO; | 176 | static int scsi_debug_ato = DEF_ATO; |
176 | static int scsi_debug_physblk_exp = DEF_PHYSBLK_EXP; | 177 | static int scsi_debug_physblk_exp = DEF_PHYSBLK_EXP; |
177 | static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED; | 178 | static int scsi_debug_lowest_aligned = DEF_LOWEST_ALIGNED; |
179 | static int scsi_debug_opt_blks = DEF_OPT_BLKS; | ||
178 | static int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC; | 180 | static int scsi_debug_unmap_max_desc = DEF_UNMAP_MAX_DESC; |
179 | static int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS; | 181 | static int scsi_debug_unmap_max_blocks = DEF_UNMAP_MAX_BLOCKS; |
180 | static int scsi_debug_unmap_granularity = DEF_UNMAP_GRANULARITY; | 182 | static int scsi_debug_unmap_granularity = DEF_UNMAP_GRANULARITY; |
@@ -704,9 +706,13 @@ static int inquiry_evpd_b0(unsigned char * arr) | |||
704 | unsigned int gran; | 706 | unsigned int gran; |
705 | 707 | ||
706 | memcpy(arr, vpdb0_data, sizeof(vpdb0_data)); | 708 | memcpy(arr, vpdb0_data, sizeof(vpdb0_data)); |
709 | |||
710 | /* Optimal transfer length granularity */ | ||
707 | gran = 1 << scsi_debug_physblk_exp; | 711 | gran = 1 << scsi_debug_physblk_exp; |
708 | arr[2] = (gran >> 8) & 0xff; | 712 | arr[2] = (gran >> 8) & 0xff; |
709 | arr[3] = gran & 0xff; | 713 | arr[3] = gran & 0xff; |
714 | |||
715 | /* Maximum Transfer Length */ | ||
710 | if (sdebug_store_sectors > 0x400) { | 716 | if (sdebug_store_sectors > 0x400) { |
711 | arr[4] = (sdebug_store_sectors >> 24) & 0xff; | 717 | arr[4] = (sdebug_store_sectors >> 24) & 0xff; |
712 | arr[5] = (sdebug_store_sectors >> 16) & 0xff; | 718 | arr[5] = (sdebug_store_sectors >> 16) & 0xff; |
@@ -714,6 +720,9 @@ static int inquiry_evpd_b0(unsigned char * arr) | |||
714 | arr[7] = sdebug_store_sectors & 0xff; | 720 | arr[7] = sdebug_store_sectors & 0xff; |
715 | } | 721 | } |
716 | 722 | ||
723 | /* Optimal Transfer Length */ | ||
724 | put_unaligned_be32(scsi_debug_opt_blks, &arr[8]); | ||
725 | |||
717 | if (scsi_debug_unmap_max_desc) { | 726 | if (scsi_debug_unmap_max_desc) { |
718 | unsigned int blocks; | 727 | unsigned int blocks; |
719 | 728 | ||
@@ -722,15 +731,20 @@ static int inquiry_evpd_b0(unsigned char * arr) | |||
722 | else | 731 | else |
723 | blocks = 0xffffffff; | 732 | blocks = 0xffffffff; |
724 | 733 | ||
734 | /* Maximum Unmap LBA Count */ | ||
725 | put_unaligned_be32(blocks, &arr[16]); | 735 | put_unaligned_be32(blocks, &arr[16]); |
736 | |||
737 | /* Maximum Unmap Block Descriptor Count */ | ||
726 | put_unaligned_be32(scsi_debug_unmap_max_desc, &arr[20]); | 738 | put_unaligned_be32(scsi_debug_unmap_max_desc, &arr[20]); |
727 | } | 739 | } |
728 | 740 | ||
741 | /* Unmap Granularity Alignment */ | ||
729 | if (scsi_debug_unmap_alignment) { | 742 | if (scsi_debug_unmap_alignment) { |
730 | put_unaligned_be32(scsi_debug_unmap_alignment, &arr[28]); | 743 | put_unaligned_be32(scsi_debug_unmap_alignment, &arr[28]); |
731 | arr[28] |= 0x80; /* UGAVALID */ | 744 | arr[28] |= 0x80; /* UGAVALID */ |
732 | } | 745 | } |
733 | 746 | ||
747 | /* Optimal Unmap Granularity */ | ||
734 | if (scsi_debug_unmap_granularity) { | 748 | if (scsi_debug_unmap_granularity) { |
735 | put_unaligned_be32(scsi_debug_unmap_granularity, &arr[24]); | 749 | put_unaligned_be32(scsi_debug_unmap_granularity, &arr[24]); |
736 | return 0x3c; /* Mandatory page length for thin provisioning */ | 750 | return 0x3c; /* Mandatory page length for thin provisioning */ |
@@ -2685,6 +2699,7 @@ module_param_named(dif, scsi_debug_dif, int, S_IRUGO); | |||
2685 | module_param_named(guard, scsi_debug_guard, int, S_IRUGO); | 2699 | module_param_named(guard, scsi_debug_guard, int, S_IRUGO); |
2686 | module_param_named(ato, scsi_debug_ato, int, S_IRUGO); | 2700 | module_param_named(ato, scsi_debug_ato, int, S_IRUGO); |
2687 | module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO); | 2701 | module_param_named(physblk_exp, scsi_debug_physblk_exp, int, S_IRUGO); |
2702 | module_param_named(opt_blks, scsi_debug_opt_blks, int, S_IRUGO); | ||
2688 | module_param_named(lowest_aligned, scsi_debug_lowest_aligned, int, S_IRUGO); | 2703 | module_param_named(lowest_aligned, scsi_debug_lowest_aligned, int, S_IRUGO); |
2689 | module_param_named(unmap_max_blocks, scsi_debug_unmap_max_blocks, int, S_IRUGO); | 2704 | module_param_named(unmap_max_blocks, scsi_debug_unmap_max_blocks, int, S_IRUGO); |
2690 | module_param_named(unmap_max_desc, scsi_debug_unmap_max_desc, int, S_IRUGO); | 2705 | module_param_named(unmap_max_desc, scsi_debug_unmap_max_desc, int, S_IRUGO); |
@@ -2715,6 +2730,7 @@ MODULE_PARM_DESC(virtual_gb, "virtual gigabyte size (def=0 -> use dev_size_mb)") | |||
2715 | MODULE_PARM_DESC(vpd_use_hostno, "0 -> dev ids ignore hostno (def=1 -> unique dev ids)"); | 2730 | MODULE_PARM_DESC(vpd_use_hostno, "0 -> dev ids ignore hostno (def=1 -> unique dev ids)"); |
2716 | MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)"); | 2731 | MODULE_PARM_DESC(sector_size, "logical block size in bytes (def=512)"); |
2717 | MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)"); | 2732 | MODULE_PARM_DESC(physblk_exp, "physical block exponent (def=0)"); |
2733 | MODULE_PARM_DESC(opt_blks, "optimal transfer length in block (def=64)"); | ||
2718 | MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)"); | 2734 | MODULE_PARM_DESC(lowest_aligned, "lowest aligned lba (def=0)"); |
2719 | MODULE_PARM_DESC(dix, "data integrity extensions mask (def=0)"); | 2735 | MODULE_PARM_DESC(dix, "data integrity extensions mask (def=0)"); |
2720 | MODULE_PARM_DESC(dif, "data integrity field type: 0-3 (def=0)"); | 2736 | MODULE_PARM_DESC(dif, "data integrity field type: 0-3 (def=0)"); |