[PATCH V10 1/8] nvmet: trim args for nvmet_copy_ns_identifier()

Chaitanya Kulkarni Chaitanya.Kulkarni at wdc.com
Wed Mar 10 08:52:38 GMT 2021


> On Mar 10, 2021, at 12:49 AM, Christoph Hellwig <hch at lst.de> wrote:
> 
> On Tue, Mar 09, 2021 at 09:03:26PM +0000, Chaitanya Kulkarni wrote:
>> Looking at the code again, this is not a generic copy function but this
>> is a designated function for the identifier copy, and for each
>> identifier we have a length parameter that has 1:1 mapping [1], so why
>> pass that values for each call ?
> 
> The point is to keep the levels of abstraction sane.  Right now
> nvmet_copy_ns_identifier is a dumb copy function that doesn't know
> about the type of the identifier copied, and the caller has all
> information about each identifier, nicely together in a single line.
> If you move the size derivation into nvmet_copy_ns_identifier everyone
> adding a new identifier or just trying to understand the code needs
> to deal with two functions.  Due to the extra branches it will probably
> also generate worse binary code.

I see thanks for the explanation. Now I understand it better, will drop that patch.




More information about the Linux-nvme mailing list