Skip to content

Commit

Permalink
[SCSI] scsi_debug: prohibit scsi_debug_unmap_granularity == scsi_debu…
Browse files Browse the repository at this point in the history
…g_unmap_alignment

scsi_debug prohibits setting scsi_debug_unmap_alignment to be greater
than scsi_debug_unmap_granularity.  But setting them to be the same value
is not prohibited.  In this case, the only difference with
scsi_debug_unmap_alignment == 0 is the logical blocks from 0 to
scsi_debug_unmap_alignment - 1 cannot be unmapped.  But the difference is
not properly handled in the current code.

So this prohibits such unusual setting.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Akinobu Mita authored and James Bottomley committed May 2, 2013
1 parent 9ed8d3d commit ac17078
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/scsi/scsi_debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -3413,9 +3413,10 @@ static int __init scsi_debug_init(void)
clamp(scsi_debug_unmap_granularity, 1U, 0xffffffffU);

if (scsi_debug_unmap_alignment &&
scsi_debug_unmap_granularity < scsi_debug_unmap_alignment) {
scsi_debug_unmap_granularity <=
scsi_debug_unmap_alignment) {
printk(KERN_ERR
"%s: ERR: unmap_granularity < unmap_alignment\n",
"%s: ERR: unmap_granularity <= unmap_alignment\n",
__func__);
return -EINVAL;
}
Expand Down

0 comments on commit ac17078

Please sign in to comment.