[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <25011fed186bd8bfd1f25640158fbce60a7ad9ef.camel@redhat.com>
Date: Tue, 28 Jul 2020 17:27:41 +0300
From: Maxim Levitsky <mlevitsk@...hat.com>
To: "Martin K. Petersen" <martin.petersen@...cle.com>,
Christoph Hellwig <hch@....de>
Cc: linux-kernel@...r.kernel.org, Keith Busch <kbusch@...nel.org>,
Josef Bacik <josef@...icpanda.com>,
"open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
Sagi Grimberg <sagi@...mberg.me>, Jens Axboe <axboe@...nel.dk>,
"open list:NVM EXPRESS DRIVER" <linux-nvme@...ts.infradead.org>,
"open list:SCSI CDROM DRIVER" <linux-scsi@...r.kernel.org>,
Tejun Heo <tj@...nel.org>,
Bart Van Assche <bvanassche@....org>,
Damien Le Moal <damien.lemoal@....com>,
Jason Wang <jasowang@...hat.com>,
Maxim Levitsky <maximlevitsky@...il.com>,
Stefan Hajnoczi <stefanha@...hat.com>,
Colin Ian King <colin.king@...onical.com>,
"Michael S. Tsirkin" <mst@...hat.com>,
Paolo Bonzini <pbonzini@...hat.com>,
Ulf Hansson <ulf.hansson@...aro.org>,
Ajay Joshi <ajay.joshi@....com>,
Ming Lei <ming.lei@...hat.com>,
"open list:SONY MEMORYSTICK SUBSYSTEM" <linux-mmc@...r.kernel.org>,
Satya Tangirala <satyat@...gle.com>,
"open list:NETWORK BLOCK DEVICE (NBD)" <nbd@...er.debian.org>,
Hou Tao <houtao1@...wei.com>, Jens Axboe <axboe@...com>,
"open list:VIRTIO CORE AND NET DRIVERS"
<virtualization@...ts.linux-foundation.org>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
Alex Dubov <oakad@...oo.com>
Subject: Re: [PATCH 02/10] block: virtio-blk: check logical block size
On Wed, 2020-07-22 at 12:11 +0300, Maxim Levitsky wrote:
> On Tue, 2020-07-21 at 22:55 -0400, Martin K. Petersen wrote:
> > Christoph,
> >
> > > Hmm, I wonder if we should simply add the check and warning to
> > > blk_queue_logical_block_size and add an error in that case. Then
> > > drivers only have to check the error return, which might add a lot
> > > less boiler plate code.
> >
> > Yep, I agree.
> >
>
> I also agree that this would be cleaner (I actually tried to implement
> this the way you suggest), but let me explain my reasoning for doing
> it
> this way.
>
> The problem is that most current users of blk_queue_logical_block_size
> (43 uses in the tree, out of which only 9 use constant block size)
> check
> for the block size relatively early, often store it in some internal
> struct etc, prior to calling blk_queue_logical_block_size thus making
> them only to rely on blk_queue_logical_block_size as the check for
> block size validity will need non-trivial changes in their code.
>
> Instead of this adding blk_is_valid_logical_block_size allowed me
> to trivially convert most of the uses.
>
> For RFC I converted only some drivers that I am more familiar with
> and/or can test but I can remove the driver's own checks in most other
> drivers with low chance of introducing a bug, even if I can't test the
> driver.
>
> What do you think?
>
> I can also both make blk_queue_logical_block_size return an error
> value,
> and have blk_is_valid_logical_block_size and use either of these
> checks,
> depending on the driver with eventual goal of un-exporting
> blk_is_valid_logical_block_size.
>
> Also note that I did add WARN_ON to blk_queue_logical_block_size.
Any update on this?
Best regards,
Maxim Levitsky
>
> Best regards,
> Maxim Levitsky
Powered by blists - more mailing lists