[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v7 4/8] block: add block layer APIs resembling Linux ZonedBlo
From: |
Stefan Hajnoczi |
Subject: |
Re: [PATCH v7 4/8] block: add block layer APIs resembling Linux ZonedBlockDevice ioctls |
Date: |
Tue, 23 Aug 2022 08:40:22 -0400 |
On Tue, Aug 23, 2022 at 12:12:44PM +0800, Sam Li wrote:
> Stefan Hajnoczi <stefanha@redhat.com> 于2022年8月23日周二 08:49写道:
> > On Tue, Aug 16, 2022 at 02:25:18PM +0800, Sam Li wrote:
> > > +static int handle_aiocb_zone_report(void *opaque) {
> > > +#if defined(CONFIG_BLKZONED)
> > > + RawPosixAIOData *aiocb = opaque;
> > > + int fd = aiocb->aio_fildes;
> > > + unsigned int *nr_zones = aiocb->zone_report.nr_zones;
> > > + BlockZoneDescriptor *zones = aiocb->zone_report.zones;
> > > + int64_t sector = aiocb->aio_offset;
> > > +
> > > + struct blk_zone *blkz;
> > > + int64_t rep_size;
> > > + unsigned int nrz;
> > > + int ret, n = 0, i = 0;
> > > +
> > > + nrz = *nr_zones;
> > > + rep_size = sizeof(struct blk_zone_report) + nrz * sizeof(struct
> > > blk_zone);
> > > + g_autofree struct blk_zone_report *rep = NULL;
> > > + rep = g_malloc(rep_size);
> > > +
> > > + blkz = (struct blk_zone *)(rep + 1);
> > > + while (n < nrz) {
> > > + memset(rep, 0, rep_size);
> > > + rep->sector = sector;
> > > + rep->nr_zones = nrz - n;
> > > +
> > > + ret = ioctl(fd, BLKREPORTZONE, rep);
> >
> > Does this ioctl() need "do { ... } while (ret == -1 && errno == EINTR)"?
>
> No? We discussed this before. I guess even EINTR should be propagated
> back to the guest. Maybe Damien can talk more about why.
No, EINTR is an internal error that must be handled by QEMU. It means
the QEMU process' syscall was interrupted by a signal and the syscall
must be retried. The guest shouldn't see EINTR (and there is no
virtio-blk error code defined for it).
signature.asc
Description: PGP signature
[PATCH v7 5/8] raw-format: add zone operations to pass through requests, Sam Li, 2022/08/16
[PATCH v7 6/8] config: add check to block layer, Sam Li, 2022/08/16
[PATCH v7 7/8] qemu-iotests: test new zone operations, Sam Li, 2022/08/16
[PATCH v7 8/8] docs/zoned-storage: add zoned device documentation, Sam Li, 2022/08/16