[PATCH 0/4] block/file: Show extent size in qemu-img info

Hanna Reitz posted 4 patches 1 year, 12 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20220503145529.37070-1-hreitz@redhat.com
Maintainers: Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, Markus Armbruster <armbru@redhat.com>, Eric Blake <eblake@redhat.com>
qapi/block-core.json | 32 ++++++++++++++++++++--
include/block/qapi.h |  3 +-
block/file-posix.c   | 30 ++++++++++++++++++++
block/qapi.c         | 65 +++++++++++++++++++++++++++++++++++++++++---
qemu-io-cmds.c       |  4 +--
5 files changed, 124 insertions(+), 10 deletions(-)
[PATCH 0/4] block/file: Show extent size in qemu-img info
Posted by Hanna Reitz 1 year, 12 months ago
Hi,

This series makes qemu-img info print the extent size of an image file
(if available).  To do so, we have to do a couple of things:
1. Add a .bdrv_get_specific_info handler to the file-posix driver
   (patch 4)
2. Have bdrv_query_image_info() collect this driver-specific info not
   only on the format level, but also on the protocol level (if there is
   an unambiguous node) so we actually get the information from the
   file-posix node when querying whatever format node is on top
   (patch 2)
3. Have bdrv_image_info_dump() print this protocol-level information
   (patch 3)

Extent size informations seems unavailable on ext4 at least, so if we
did just this, you would see the following for an image on ext4:

```
$ qemu-img info -f raw test.img
image: test.img
file format: raw
virtual size: 1 MiB (1048576 bytes)
disk size: 4 KiB
Protocol specific information:
```

That last part looks a bit strange -- it's a heading without a section.
So patch 1 makes bdrv_image_info_specific_dump() omit that heading if
there is no information that can be printed.


Hanna Reitz (4):
  block: Improve empty format-specific info dump
  block: Add protocol-specific image info
  block: Print protocol-specific information
  block/file: Add file-specific image info

 qapi/block-core.json | 32 ++++++++++++++++++++--
 include/block/qapi.h |  3 +-
 block/file-posix.c   | 30 ++++++++++++++++++++
 block/qapi.c         | 65 +++++++++++++++++++++++++++++++++++++++++---
 qemu-io-cmds.c       |  4 +--
 5 files changed, 124 insertions(+), 10 deletions(-)

-- 
2.35.1