Message ID | 20200827213327.25537-3-jpittman@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | scsi_debug: improve num_parts usage | expand |
On 2020-08-27 5:33 p.m., John Pittman wrote: > If virtual_gb is passed while using num_parts, when creating the > partitions, virtual_gb is not respected. Set num_sectors using > get_sdebug_capacity() to pull virtual_gb if set. > > Signed-off-by: John Pittman <jpittman@redhat.com> > --- > drivers/scsi/scsi_debug.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c > index 3d9db1e8b781..e6b57cead316 100644 > --- a/drivers/scsi/scsi_debug.c > +++ b/drivers/scsi/scsi_debug.c > @@ -5270,7 +5270,7 @@ static void sdebug_build_parts(unsigned char *ramp, unsigned long store_size) > sdebug_num_parts = SDEBUG_MAX_PARTS; > pr_warn("reducing partitions to %d\n", SDEBUG_MAX_PARTS); > } > - num_sectors = (int)sdebug_store_sectors; > + num_sectors = (int)get_sdebug_capacity(); > max_part_secs = sectors_per_part = (num_sectors - sdebug_sectors_per) > / sdebug_num_parts; > heads_by_sects = sdebug_heads * sdebug_sectors_per; > Acked-by: Douglas Gilbert <dgilbert@interlog.com>
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 3d9db1e8b781..e6b57cead316 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5270,7 +5270,7 @@ static void sdebug_build_parts(unsigned char *ramp, unsigned long store_size) sdebug_num_parts = SDEBUG_MAX_PARTS; pr_warn("reducing partitions to %d\n", SDEBUG_MAX_PARTS); } - num_sectors = (int)sdebug_store_sectors; + num_sectors = (int)get_sdebug_capacity(); max_part_secs = sectors_per_part = (num_sectors - sdebug_sectors_per) / sdebug_num_parts; heads_by_sects = sdebug_heads * sdebug_sectors_per;
If virtual_gb is passed while using num_parts, when creating the partitions, virtual_gb is not respected. Set num_sectors using get_sdebug_capacity() to pull virtual_gb if set. Signed-off-by: John Pittman <jpittman@redhat.com> --- drivers/scsi/scsi_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)