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 <conghui.chen@intel.com>
Reviewed-by: Yu Wang <yu1.wang@intel.com>
Acked-by: Binbin Wu <binbin.wu@intel.com>
This commit is contained in:
Conghui Chen 2019-02-18 22:04:36 +00:00 committed by wenlingz
parent a82cafe92d
commit 5df9cbe36a

View File

@ -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