Project

General

Profile

Bug #2777

qemu: report discard support

Added by Josh Durgin over 11 years ago. Updated over 11 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Target version:
-
% Done:

0%

Source:
Community (user)
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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.

History

#1 Updated by Dan Mick over 11 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.

#2 Updated by Josh Durgin over 11 years ago

Yeah, QUEUE_FLAG_DISCARD is as far as I looked yesterday too. The question now is how to set that within qemu.

#3 Updated by Josh Durgin over 11 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.

#4 Updated by Martin Mailand over 11 years ago

It works for me, I test ext4 with discard and ext4 with fstrim.

#5 Updated by Josh Durgin over 11 years ago

  • Status changed from 7 to Resolved

Also available in: Atom PDF