On Tue, Jul 26, 2022 at 10:21:04PM +0800, Ming Lei wrote: > 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. I think it actually is easier for both. For the kernel the benefit is pretty clear seen by this patch, and for userspae there also is a lot less boilerplate code. > 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. I think even right now the memory usage is less. If a lot (and I mean a lot) new paramters are added, it might be slightly higher than the minimal config with an xarray, but not to the point where it matters. > 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. Well, it isn't exactly simple. And the apprach of a struct that just grows additional members has worked perfectly fine all over the kernel.