mbox series

[0/2] ublk_drv: add generic mechanism to get/set parameters

Message ID 20220723150713.750369-1-ming.lei@redhat.com (mailing list archive)
Headers show
Series ublk_drv: add generic mechanism to get/set parameters | expand

Message

Ming Lei July 23, 2022, 3:07 p.m. UTC
Hello,

The 1st patch implements generic mechanism to store & validate & apply
parameters.

The 2nd patch adds SET_PARA/GET_PARA control commands to support to
get/set parameters from userspace.

At least block device parameters and feature parameters can be supported
to get/set with this approach, so it could be easier to implement all
kinds of generic userspace block device with all sort of setting,
meantime can be extended easily in future.

Verified by two examples(demo_null.c & demo_event.c) in the following branch:

https://github.com/ming1/ubdsrv/tree/set_get_para

BTW, I plan to switch to exchange data between control and io task by json
first, then use SET/GET PARA command in ublksrv_tgt.c.

Ming Lei (2):
  ublk_drv: store device parameters
  ublk_drv: add SET_PARA/GET_PARA control command

 drivers/block/ublk_drv.c      | 349 ++++++++++++++++++++++++++++++++--
 include/uapi/linux/ublk_cmd.h |  45 +++++
 2 files changed, 382 insertions(+), 12 deletions(-)

Comments

Christoph Hellwig July 25, 2022, 6:47 a.m. UTC | #1
While we're at it, can we clean up how the logical block size,
device size and max transfer size are set?

I think we can drop setting all of them from the ADD_DEV ioctl,
as none of them is needed.  start_dev then just sets the device
size, and everything else goes through the SET_PARAM ioctl?
Ming Lei July 25, 2022, 7:10 a.m. UTC | #2
On Mon, Jul 25, 2022 at 08:47:16AM +0200, Christoph Hellwig wrote:
> While we're at it, can we clean up how the logical block size,
> device size and max transfer size are set?
> 
> I think we can drop setting all of them from the ADD_DEV ioctl,
> as none of them is needed.  start_dev then just sets the device
> size, and everything else goes through the SET_PARAM ioctl?
 
Yeah, that is exactly the plan to cleanup all, including removing
block_size, dev_blocks and rq_max_blocks from ublksrv_ctrl_dev_info.


Thanks, 
Ming