From 5df9cbe36a7a0a3a3e6a87f6fa9345db6080bc5a Mon Sep 17 00:00:00 2001 From: Conghui Chen Date: Mon, 18 Feb 2019 22:04:36 +0000 Subject: [PATCH] dm: script: enable discard feature for virtio-blk To support discard for virtio-blk, the backend file should also located in a filesystem which support discard. So, mount /data partition with ' -o discard'. Then, add 'discard' to virtio-blk to enable this feature. 1. Erase operations on UOS will trigger the discard on SOS instead of writing zero, which will save erase time. 2. Discard in storage firmware will move the mapped host address range to the unmapped host address range. So, when delete a file in UOS, discard will trigger the space collection on storage, so that in the next write operation, it need not to do erase first. Tracked-On: #2547 Signed-off-by: Conghui Chen Reviewed-by: Yu Wang Acked-by: Binbin Wu --- devicemodel/samples/apl-mrb/launch_uos.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/devicemodel/samples/apl-mrb/launch_uos.sh b/devicemodel/samples/apl-mrb/launch_uos.sh index c40f85ac1..50512afc6 100755 --- a/devicemodel/samples/apl-mrb/launch_uos.sh +++ b/devicemodel/samples/apl-mrb/launch_uos.sh @@ -151,7 +151,7 @@ acrn-dm -A -m $mem_size -c $2$boot_GVT_option"$GVT_args" -s 0:0,hostbridge -s 1: -s 5,virtio-console,@pty:pty_port \ -s 6,virtio-hyper_dmabuf \ -s 8,wdt-i6300esb \ - -s 3,virtio-blk$boot_dev_flag,/data/$5/$5.img \ + -s 3,virtio-blk$boot_dev_flag,/data/$5/$5.img,discard \ -s 4,virtio-net,$tap $boot_image_option \ -s 7,xhci,1-1:1-2:1-3:2-1:2-2:2-3:cap=apl \ -s 9,passthru,0/15/1 \ @@ -352,7 +352,7 @@ echo "dm_run: after passthru dev preparing" > /dev/kmsg acrn-dm -A -m $mem_size -c $2$boot_GVT_option"$GVT_args" -s 0:0,hostbridge -s 1:0,lpc -l com1,stdio $npk_virt\ -s 9,virtio-net,$tap \ - -s 3,virtio-blk$boot_dev_flag,/data/$5/$5.img \ + -s 3,virtio-blk$boot_dev_flag,/data/$5/$5.img,discard \ -s 7,xhci,1-1:1-2:1-3:2-1:2-2:2-3:cap=apl \ -s 8,passthru,0/15/1 \ -s 13,virtio-rpmb \ @@ -424,7 +424,7 @@ if [ ! -b "/dev/mmcblk1p3" ]; then fi mkdir -p /data -mount /dev/mmcblk1p3 /data +mount -o discard /dev/mmcblk1p3 /data if [ $launch_type == 6 ]; then if [ -f "/data/android/android.img" ]; then