Message ID | 20200902211434.9979-3-jpittman@redhat.com |
---|---|
State | Superseded |
Headers | show |
Series | scsi_debug: improve num_parts usage | expand |
On 2020-09-02 5:14 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. > Acked-by: Douglas Gilbert <dgilbert@interlog.com> > 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 ada0361eac83..a36652d41314 100644 > --- a/drivers/scsi/scsi_debug.c > +++ b/drivers/scsi/scsi_debug.c > @@ -5268,7 +5268,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(); > sectors_per_part = (num_sectors - sdebug_sectors_per) > / sdebug_num_parts; > heads_by_sects = sdebug_heads * sdebug_sectors_per; >
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index ada0361eac83..a36652d41314 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c @@ -5268,7 +5268,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(); 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(-)