From: i.kononenko <i.kononenko@yadro.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Felipe Balbi <balbi@kernel.org>,
openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH 2/6] usb:gadget:mass-storage: refactoring the SCSI command handling
Date: Mon, 28 Jun 2021 13:38:27 +0300 [thread overview]
Message-ID: <914d457c-2d4a-808b-352c-8acadcecc53a@yadro.com> (raw)
In-Reply-To: <20210628010641.GB638648@rowland.harvard.edu>
On 28.06.2021 04:06, Alan Stern wrote:
> On Sun, Jun 27, 2021 at 08:14:48PM +0300, i.kononenko wrote:
>>
>>
>> On 27.06.2021 17:23, Alan Stern wrote:
>>> On Sun, Jun 27, 2021 at 12:18:15AM +0300, Igor Kononenko wrote:
>>>> Implements a universal way to define SCSI commands and configure
>>>> precheck handlers.
>>>
>>> What is the reason for doing this?
>>
>> I have started implementing a way to specify a backend-file of
>> mass-storage images greater than 2.1Gb for cdrom-like mediums.
>> I notice the implementation of each scsi-command handler uses too
>> many magic-constant, hardcoded indexes and shifts. I decided to
>> define structures that contained appropriate SCSI-defined fields
>> and constant-values to clarify the code.
>>
>> Additionally, I noticed, many kernel subsystems use the 'separate
>> data and logic' approach, making a code more explicit and readable.
>> This looks reasonable to me, and a code looks more clearly, at
>> least - we don't need to examine each magic constant and its purpose.
>>
>>>
>>> At first glance, it appears you have added a great deal of complexity
>>> to the driver. The patch replaces a large amount of easily understood
>>> (albeit rather repetitious) code with an approximately equal amount
>>> of rather complicated code. This does not seem like an improvement.
>>
>> The SCSI-commands table is defined as unifying a way to specify the
>> SCSI-command handler, with corresponding required data instead pass
>> it to each repeatedly switch-case block, which makes code more readable
>> to me. If there isn't, I can keep the definition of SCSI-handlers as is,
>> but the SCSI-data structures with their constant-values are still
>> required, in my opinion.
>>
>>>
>>> Furthermore, the code you removed is flexible; it easily allows for
>>> small variations as neede by some command handlers. But the code you
>>> added is all table-driven, which does not easily permit arbitrary
>>> variations.
>>>
>>
>> I don't think that the SCSI-command handlers table is an obstacle to
>> define variation into a specific handler because the current patch has
>> helper macros, which can specify a behavior for each requirement of
>> handler.
>>
>> Anyway, the definition of the scsi-command handlers table may be discarded,
>> because this work done to helping developers who will work the
>> 'usb:gadget:mass-storage' subsystem in the future.
>
> Can you submit a patch that adds only the data structures without the
> commands table?
Yes, I will remove the mentioned SCSI-handlers table. Thank you!
>
> Alan Stern
>
--
Best regards,
Igor Kononenko
next prev parent reply other threads:[~2021-06-28 10:38 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-26 21:18 [PATCH 0/6] USB-gadget: mass-storage: Support DVD-like images Igor Kononenko
2021-06-26 21:18 ` [PATCH 1/6] usb:gadget:mass-storage: Improve the signature of SCSI handler function Igor Kononenko
2021-06-27 14:18 ` Alan Stern
2021-06-27 15:32 ` i.kononenko
2021-06-27 16:39 ` Alan Stern
2021-06-26 21:18 ` [PATCH 2/6] usb:gadget:mass-storage: refactoring the SCSI command handling Igor Kononenko
2021-06-26 23:29 ` kernel test robot
2021-06-27 14:23 ` Alan Stern
2021-06-27 17:14 ` i.kononenko
2021-06-28 1:06 ` Alan Stern
2021-06-28 10:38 ` i.kononenko [this message]
2021-06-26 21:18 ` [PATCH 3/6] fms: Add TOC/PMA/ATIP DVD-ROM capabilities Igor Kononenko
2021-06-27 14:29 ` Alan Stern
2021-06-27 18:45 ` i.kononenko
2021-06-28 14:31 ` Alan Stern
2021-06-26 21:18 ` [PATCH 4/6] fms: Support the DVD/BD images size over 2.1Gb Igor Kononenko
2021-06-26 21:18 ` [PATCH 5/6] FMS: Add the SCSI Get Configuration command Igor Kononenko
2021-06-27 0:44 ` kernel test robot
2021-06-27 4:42 ` kernel test robot
2021-06-28 9:53 ` Christoph Hellwig
2021-06-28 10:34 ` i.kononenko
2021-06-26 21:18 ` [PATCH 6/6] FMS: Add SCSI Read Disc Information command Igor Kononenko
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=914d457c-2d4a-808b-352c-8acadcecc53a@yadro.com \
--to=i.kononenko@yadro.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=openbmc@lists.ozlabs.org \
--cc=stern@rowland.harvard.edu \
/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).