From: Ming Lei <ming.lei@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
ZiyangZhang <ZiyangZhang@linux.alibaba.com>
Subject: Re: [PATCH 1/2] ublk_drv: store device parameters
Date: Tue, 26 Jul 2022 22:21:04 +0800 [thread overview]
Message-ID: <Yt/4UBGtFDqr2SfA@T590> (raw)
In-Reply-To: <20220726123224.GA9435@lst.de>
On Tue, Jul 26, 2022 at 02:32:24PM +0200, Christoph Hellwig wrote:
> On Mon, Jul 25, 2022 at 03:06:50PM +0800, Ming Lei wrote:
> > There could be more parameters than the two types(), such as segments,
> > zoned, ..., also in future, feature related parameters can be added
> > in this way too, and most of them are optional.
>
> Yes. But just having a struct that grows is much cleaner and simpler
> than those indirections. e.g something like this patch on top of this
But most of fields in ublk_params aren't required for one device,
sending them all isn't friendly from both userspace and kernel side.
Especially inside kernel, a big chunk buffer is allocated for
the structure, but only few fields are useful for one device. There can
be lots of ublk device, and total wasted memory can't be ignored.
If we group parameters, it is easier to extend by adding new parameter
type. One ublk device usually just uses several parameter types.
And the xarray implementation is simple enough too, which is just one
array, but really sparsed.
Adding one parameter type just needs to add two callbacks, so pretty easy
to review.
So I really suggest to keep the parameter type and xarray
implementation, and will post V2 after ublksrv side is updated.
> series. With this new fields can just be added to the end of
> struct ublk_params. Old kernels will ignore them, but due to the copy
> back of the parsed structure userspace can detect that if it cares:
There has to be one length field in header, otherwise ublk driver can't
know the exact length for copying back.
With parameter type approach, it is natural to handle new/old app and
old/new kernel, since kernel will fail set parameter command simply
if one parameter type isn't supported.
Thanks,
Ming
next prev parent reply other threads:[~2022-07-26 14:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-23 15:07 [PATCH 0/2] ublk_drv: add generic mechanism to get/set parameters Ming Lei
2022-07-23 15:07 ` [PATCH 1/2] ublk_drv: store device parameters Ming Lei
2022-07-25 6:42 ` Christoph Hellwig
2022-07-25 7:06 ` Ming Lei
2022-07-26 12:32 ` Christoph Hellwig
2022-07-26 14:21 ` Ming Lei [this message]
2022-07-26 17:47 ` Christoph Hellwig
2022-07-27 0:12 ` Ming Lei
2022-07-23 15:07 ` [PATCH 2/2] ublk_drv: add SET_PARA/GET_PARA control command Ming Lei
2022-07-25 6:45 ` Christoph Hellwig
2022-07-25 7:07 ` Ming Lei
2022-07-25 6:47 ` [PATCH 0/2] ublk_drv: add generic mechanism to get/set parameters Christoph Hellwig
2022-07-25 7:10 ` Ming Lei
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=Yt/4UBGtFDqr2SfA@T590 \
--to=ming.lei@redhat.com \
--cc=ZiyangZhang@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.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).