qemu-block
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Outreachy project task: Adding QEMU block layer APIs resembling Linu


From: Sam Li
Subject: Re: Outreachy project task: Adding QEMU block layer APIs resembling Linux ZBD ioctls.
Date: Wed, 1 Jun 2022 10:57:17 +0800

Hi Stefan,

Stefan Hajnoczi <stefanha@gmail.com> 于2022年5月30日周一 19:19写道:


>
> On Mon, 30 May 2022 at 06:09, Sam Li <faithilikerun@gmail.com> wrote:
> >
> > Hi everyone,
> > I'm Sam Li, working on the Outreachy project which is to add zoned
> > device support to QEMU's virtio-blk emulation.
> >
> > For the first goal, adding QEMU block layer APIs resembling Linux ZBD
> > ioctls, I think the naive approach would be to introduce a new stable
> > struct zbd_zone descriptor for the library function interface. More
> > specifically, what I'd like to add to the BlockDriver struct are:
> > 1. zbd_info as zone block device information: includes numbers of
> > zones, size of logical blocks, and physical blocks.
> > 2. zbd_zone_type and zbd_zone_state
> > 3. zbd_dev_model: host-managed zbd, host-aware zbd
> > With those basic structs, we can start to implement new functions as
> > bdrv*() APIs for BLOCK*ZONE ioctls.
> >
> > I'll start to finish this task based on the above description. If
> > there is any problem or something I may miss in the design, please let
> > me know.
>
> Hi Sam,
> Can you propose function prototypes for the new BlockDriver callbacks
> needed for zoned devices?

I have made some modifications based on Damien's device in design part
1 and added the function prototypes in design part 2. If there is any
problem or part I missed, please let me know.

Design of Block Layer APIs in BlockDriver:
1. introduce a new stable struct zbd_zone descriptor for the library
function interface.
  a. zbd_info as zone block device information: includes numbers of
zones, size of blocks, write granularity in byte(minimal write size
and alignment
    - write granularity: 512e SMRs: writes in units of physical block
size, 4096 bytes; NVMe ZNS write granularity is equal to the block
size.
    - zone descriptor: start, length, capacity, write pointer, zone type
  b. zbd_zone_type
    - zone type: conventional, sequential write required, sequential
write preferred
  c. zbd_dev_model: host-managed zbd, host-aware zbd

 2. implement new functions as bdrv*() APIs for BLK*ZONE ioctls
   a. support basic operations: get the APIs working when executing
the zone operations from a guest
    - zone information access: report
    - zone manipulation: reset,open,close,finish
  b. support zone append operation: zone capacity, write pointer
positions of all zones(excluded for now)
    - can track the zone state we need: zone is full or not.

More specifically, the function prototypes for 2a are as follows:

int zbd_report_zones(int fd, off_t offset, off_t len, enum
zbd_report_opetion ro, struct zbd_zone *zones, unsigned int
*nr_zones);
int zbd_reset_zones(int fd, off_t offset, off_t len);
int zbd_open_zones(int fd, off_t offset, off_t len);
int zbd_close_zones(int fd, off_t offset, off_t len);
int zbd_finish_zones(int fd, off_t offset, off_t len);

>
> Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]