Bug #2777
closedqemu: report discard support
0%
Description
todin reported problems enabling discard inside qemu.
I'm not sure if this is rbd-specific, but there seem to be some block device properties regarding discard that are not set which some tools (like fstrim and mkfs.ext4 -E discard) expect.
Updated by Dan Mick almost 12 years ago
I don't know what I'm talking about, but stumbling around in the kernel seems to point at QUEUE_FLAG_DISCARD as the flag indicating that a device supports
discard operations (and might be useful as a foothold for further investigation).
If this is obvious or wrong, just ignore me.
Updated by Josh Durgin almost 12 years ago
Yeah, QUEUE_FLAG_DISCARD is as far as I looked yesterday too. The question now is how to set that within qemu.
Updated by Josh Durgin almost 12 years ago
- Status changed from New to 7
It looks like this is handled by what qemu calls a 'device property', so you have to use a command line like:
kvm -drive file=rbd:rbd/client.0.0:conf=/tmp/cephtest/ceph.conf,format=raw,id=drive1,if=none -device driver=ide-hd,drive=drive1,discard_granularity=512
It's the discard_granularity property in particular that will be reported to the guest.
Updated by Martin Mailand almost 12 years ago
It works for me, I test ext4 with discard and ext4 with fstrim.