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

Christoph Hellwig hch at lst.de
Wed Mar 10 08:49:43 GMT 2021


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.



More information about the Linux-nvme mailing list