Skip to content

hostmem-file: Add "discard-data" option

Eduardo Habkost qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 6 repliesIn review
  2. v15 patches 13 repliesSuperseded

Changes in v2 from the cover letter

* Original subject line of v1 was:
'[PATCH 0/5] hostmem-file: Add "persistent" option'
* Replaced 'persistent=no' with 'discard-data=yes', to make it clear that the flag will destroy data on the backing file.
* Use qemu_madvise() instead of madvise()
* New patch added to series: "osdep: define QEMU_MADV_REMOVE"
* Call qemu_madvise() directly from the backend unparent() method, insteead of adding a new flag to the memory API and reusing ram_block_discard_range()
* In addition to simplifying the code a lot, this fixes a bug, because v1 relied on getting the memory region reference count back to 0, which doesn't happen when QEMU is exiting because there's no machine cleanup code to ensure that.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vl: Clean up user-creatable objects when exitinginclude/qom/object_interfaces.h qom/object_interfaces.c vl.c+14 -01 reply
2/3osdep: Define QEMU_MADV_REMOVEinclude/qemu/osdep.h+7 -01 reply
3/3hostmem-file: Add "discard-data" optionbackends/hostmem-file.c qemu-options.hx+33 -14 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-DaudéDr. David Alan GilbertDaniel P. Berrange
1/3A-b
2/3R-b
3/3R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v2 thread

Cover letter [Qemu-devel] [PATCH v2 0/3] hostmem-file: Add "discard-data" option

This series adds a new "discard-data" option to memory-backend-file. The new option will be useful if somebody is sharing RAM contents on a pre-existing file using share=on, but don't need data to be flushed to disk when QEMU exits.

Internally, it will trigger a madvise(MADV_REMOVE) call when the memory backend is removed or when QEMU exits.

To make we actually trigger the new code when QEMU exits, the first patch in the series ensures we destroy all user-created objects when exiting QEMU.

Changes v1 -> v2:
* Original subject line of v1 was:
'[PATCH 0/5] hostmem-file: Add "persistent" option'
* Replaced 'persistent=no' with 'discard-data=yes', to make it clear that the flag will destroy data on the backing file.
* Use qemu_madvise() instead of madvise()
* New patch added to series: "osdep: define QEMU_MADV_REMOVE"
* Call qemu_madvise() directly from the backend unparent() method, insteead of adding a new flag to the memory API and reusing ram_block_discard_range()
* In addition to simplifying the code a lot, this fixes a bug, because v1 relied on getting the memory region reference count back to 0, which doesn't happen when QEMU is exiting because there's no machine cleanup code to ensure that.

Eduardo Habkost (3):
vl: Clean up user-creatable objects when exiting
osdep: Define QEMU_MADV_REMOVE
hostmem-file: Add "discard-data" option

 include/qemu/osdep.h            |  7 +++++++
 include/qom/object_interfaces.h |  8 ++++++++
 backends/hostmem-file.c         | 29 +++++++++++++++++++++++++++++
 qom/object_interfaces.c         |  5 +++++
 vl.c                            |  1 +
 qemu-options.hx                 |  5 ++++-
 6 files changed, 54 insertions(+), 1 deletion(-)
Signature · 1 line
2.9.4