|
From: | ching |
Subject: | Re: [Qemu-devel] check trim/unmap |
Date: | Thu, 30 Jan 2014 20:16:26 +0800 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
My updated config is Gentoo x64 stable branch, kernel 3.10, libvirt 1.2.1, qemu 1.7.0, lvm2(non-thin) on ssd i attach a lvm (non-thin) partition to a vm <disk type='block' device='disk'> <driver name='qemu' type='raw' cache='none' io='native' discard='unmap'/> <source dev='/dev/volume_group/temp'/> <target dev='sdb' bus='sata'/> <boot order='2'/> <address type='drive' controller='0' bus='0' target='0' unit='1'/> </disk> and the qemu command line captured:LC_ALL=C PATH=/bin:/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin HOME=/ USER=root QEMU_AUDIO_DRV=spice /usr/bin/qemu-system-x86_64 -name Temp -S -machine pc-i440fx-1.7,accel=kvm,usb=off -cpu SandyBridge,+osxsave,+pcid,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pbe,+tm,+ht,+ss,+acpi,+ds,+vme -m 4096 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 79f72ed3-1e27-a518-4ea9-ec8385982af0 -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/Temp.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc,driftfix=slew -global kvm-pit.lost_tick_policy=discard -no-shutdown -boot strict=on -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-scsi-pci,id=scsi0,bus=pci.0,addr=0x9 -device ahci,id=ahci0,bus=pci.0,addr=0x4 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/tmp/cdrom.iso,if=none,media=cdrom,id=drive-sata0-0-0,readonly=on,format=raw,cache=unsafe,aio=native -device ide-cd,bus=ahci0.0,drive=drive-sata0-0-0,id=sata0-0-0,bootindex=1 -drive file=/dev/volume_group/temp,if=none,id=drive-sata0-0-1,format=raw,cache=none,discard=unmap,aio=native -device ide-hd,bus=ahci0.1,drive=drive-sata0-0-1,id=sata0-0-1,bootindex=2 -netdev tap,fd=19,id=hostnet0,vhost=on,vhostfd=20 -device virtio-net-pci,netdev=hostnet0,id=net0,mac=00:0c:29:09:8c:bc,bus=pci.0,addr=0x3 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,bus=pci.0,addr=0x2 -device intel-hda,id=sound0,bus=pci.0,addr=0xb -device hda-micro,id=sound0-codec0,bus=sound0.0,cad=0 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
In the linux guest, i try "hdparm -I /dev/sda | grep TRIM", but there is no trim feature listed. is there any thing i am missing? ching On 28/01/2014 08:17 PM, ching wrote:
Thanks for the information. Hopefully, there will be better debug/tracing facility for this. This is useful for sysadmin to ensure the whole storage stack is functioning as expected. ching On 28/01/2014 06:46 PM, Paolo Bonzini wrote:Il 28/01/2014 11:31, ching ha scritto:My config is Gentoo x64 stable branch, kernel 3.10, libvirt 1.1.3, qemu 1.5, lvm2(non-thin) on ssd How can i check that if: 1. qemu receives trim/unmap from guest 2. qemu is punching hole/issue blkdiscards/writing zeros?First of all, I suggest that you use current QEMU git. The trim/unmap feature was completed after 1.7 was released. To use trim/discard, you need to use the discard=on option for QEMU's -drive command-line option. You also need to use cache=none (because of a Linux kernel bug, QEMU may disable thin provisioning in other cache modes). In libvirt, this means adding cache='none and discard='on' like this: <driver name='qemu' type='qcow2' cache='none' discard='on'/> You can check if QEMU is punching a hole into a file using "qemu-img map" on the file. You must not run "qemu-img map" while the VM is running though; that can give incorrect results. There is no equivalent for block devices yet. Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |