From: Damien Le Moal <Damien.LeMoal@wdc.com>
To: Maxim Levitsky <mlevitsk@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: Keith Busch <kbusch@kernel.org>,
Josef Bacik <josef@toxicpanda.com>,
"open list:BLOCK LAYER" <linux-block@vger.kernel.org>,
Sagi Grimberg <sagi@grimberg.me>, Jens Axboe <axboe@kernel.dk>,
"open list:NVM EXPRESS DRIVER" <linux-nvme@lists.infradead.org>,
"open list:SCSI CDROM DRIVER" <linux-scsi@vger.kernel.org>,
Tejun Heo <tj@kernel.org>, Bart Van Assche <bvanassche@acm.org>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
Jason Wang <jasowang@redhat.com>,
Maxim Levitsky <maximlevitsky@gmail.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Colin Ian King <colin.king@canonical.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Ulf Hansson <ulf.hansson@linaro.org>,
Ajay Joshi <Ajay.Joshi@wdc.com>, Ming Lei <ming.lei@redhat.com>,
"open list:SONY MEMORYSTICK SUBSYSTEM"
<linux-mmc@vger.kernel.org>, Christoph Hellwig <hch@lst.de>,
Satya Tangirala <satyat@google.com>,
"open list:NETWORK BLOCK DEVICE (NBD)" <nbd@other.debian.org>,
Hou Tao <houtao1@huawei.com>, Jens Axboe <axboe@fb.com>,
"open list:VIRTIO CORE AND NET DRIVERS"
<virtualization@lists.linux-foundation.org>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
Alex Dubov <oakad@yahoo.com>
Subject: Re: [PATCH 10/10] block: scsi: sr: use blk_is_valid_logical_block_size
Date: Tue, 21 Jul 2020 11:29:48 +0000 [thread overview]
Message-ID: <CY4PR04MB37517861074A4A448180E136E7780@CY4PR04MB3751.namprd04.prod.outlook.com> (raw)
In-Reply-To: 20200721105239.8270-11-mlevitsk@redhat.com
On 2020/07/21 19:55, Maxim Levitsky wrote:
> Plus some tiny refactoring.
>
> Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com>
> ---
> drivers/scsi/sr.c | 31 +++++++++++++------------------
> 1 file changed, 13 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
> index 0c4aa4665a2f9..0e96338029310 100644
> --- a/drivers/scsi/sr.c
> +++ b/drivers/scsi/sr.c
> @@ -866,31 +866,26 @@ static void get_sectorsize(struct scsi_cd *cd)
> cd->capacity = max_t(long, cd->capacity, last_written);
>
> sector_size = get_unaligned_be32(&buffer[4]);
> - switch (sector_size) {
> - /*
> - * HP 4020i CD-Recorder reports 2340 byte sectors
> - * Philips CD-Writers report 2352 byte sectors
> - *
> - * Use 2k sectors for them..
> - */
> - case 0:
> - case 2340:
> - case 2352:
> +
> + /*
> + * HP 4020i CD-Recorder reports 2340 byte sectors
> + * Philips CD-Writers report 2352 byte sectors
> + *
> + * Use 2k sectors for them..
> + */
> +
No need for the blank line here.
> + if (!sector_size || sector_size == 2340 || sector_size == 2352)
> sector_size = 2048;
> - /* fall through */
> - case 2048:
> - cd->capacity *= 4;
> - /* fall through */
> - case 512:
> - break;
> - default:
> +
> + cd->capacity *= (sector_size >> SECTOR_SHIFT);
Where does this come from ? There is no such code in sr get_sectorsize()...
> +
> + if (!blk_is_valid_logical_block_size(sector_size)) {
> sr_printk(KERN_INFO, cd,
> "unsupported sector size %d.", sector_size);
> cd->capacity = 0;
> }
>
> cd->device->sector_size = sector_size;
> -
White line change.
> /*
> * Add this so that we have the ability to correctly gauge
> * what the device is capable of.
>
--
Damien Le Moal
Western Digital Research
prev parent reply other threads:[~2020-07-21 11:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-21 10:52 [PATCH 00/10] RFC: move logical block size checking to the block core Maxim Levitsky
2020-07-21 10:52 ` [PATCH 01/10] block: introduce blk_is_valid_logical_block_size Maxim Levitsky
2020-07-21 11:05 ` Damien Le Moal
2020-07-21 11:09 ` Maxim Levitsky
2020-07-21 11:31 ` Damien Le Moal
2020-07-21 15:13 ` Christoph Hellwig
2020-07-22 8:50 ` Maxim Levitsky
2020-07-21 10:52 ` [PATCH 02/10] block: virtio-blk: check logical block size Maxim Levitsky
2020-07-21 11:07 ` Damien Le Moal
2020-07-21 15:14 ` Christoph Hellwig
2020-07-22 2:55 ` Martin K. Petersen
2020-07-22 9:11 ` Maxim Levitsky
2020-07-28 14:27 ` Maxim Levitsky
2020-07-29 4:32 ` Martin K. Petersen
2020-07-28 15:44 ` Stefan Hajnoczi
2020-07-21 10:52 ` [PATCH 03/10] block: loop: use blk_is_valid_logical_block_size Maxim Levitsky
2020-07-21 11:08 ` Damien Le Moal
2020-07-21 10:52 ` [PATCH 04/10] block: nbd: " Maxim Levitsky
2020-07-21 11:09 ` Damien Le Moal
2020-07-21 10:52 ` [PATCH 05/10] block: null: " Maxim Levitsky
2020-07-21 11:15 ` Damien Le Moal
2020-07-21 12:42 ` Maxim Levitsky
2020-07-21 10:52 ` [PATCH 06/10] block: ms_block: " Maxim Levitsky
2020-07-21 11:17 ` Damien Le Moal
2020-07-21 10:52 ` [PATCH 07/10] block: mspro_blk: " Maxim Levitsky
2020-07-21 11:17 ` Damien Le Moal
2020-07-21 10:52 ` [PATCH 08/10] block: nvme: " Maxim Levitsky
2020-07-21 11:23 ` Damien Le Moal
2020-07-21 10:52 ` [PATCH 09/10] block: scsi: sd: " Maxim Levitsky
2020-07-21 11:25 ` Damien Le Moal
2020-07-21 12:55 ` Maxim Levitsky
2020-07-21 10:52 ` [PATCH 10/10] block: scsi: sr: " Maxim Levitsky
2020-07-21 11:29 ` Damien Le Moal [this message]
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=CY4PR04MB37517861074A4A448180E136E7780@CY4PR04MB3751.namprd04.prod.outlook.com \
--to=damien.lemoal@wdc.com \
--cc=Ajay.Joshi@wdc.com \
--cc=axboe@fb.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=colin.king@canonical.com \
--cc=hch@lst.de \
--cc=houtao1@huawei.com \
--cc=jasowang@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=josef@toxicpanda.com \
--cc=kbusch@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=maximlevitsky@gmail.com \
--cc=ming.lei@redhat.com \
--cc=mlevitsk@redhat.com \
--cc=mst@redhat.com \
--cc=nbd@other.debian.org \
--cc=oakad@yahoo.com \
--cc=pbonzini@redhat.com \
--cc=sagi@grimberg.me \
--cc=satyat@google.com \
--cc=stefanha@redhat.com \
--cc=tj@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=virtualization@lists.linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).