summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorDaniel Verkamp <dverkamp@chromium.org>2018-10-17 09:29:32 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-10-19 12:19:41 -0700
commitde198cc9be3f3741a4c9cc6f97275cc4ec7f7505 (patch)
tree060a1bf4445688d620c29188617ea7834d10e496 /src/main.rs
parent7f9b9ea344b5f9db68310d1d73e579b4e9bf59a8 (diff)
downloadcrosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.tar
crosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.tar.gz
crosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.tar.bz2
crosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.tar.lz
crosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.tar.xz
crosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.tar.zst
crosvm-de198cc9be3f3741a4c9cc6f97275cc4ec7f7505.zip
devices: virtio: block: ignore Discard failures
Our branch of the 3.18 kernel has FALLOC_FL_PUNCH_HOLE disabled for the
ext4 filesystem, which means that systems running that kernel always
take the fallback path of writing buffers full of zeroes.  This is not
necessary for the Discard command, since it is just a hint and is not
required to actually zero the blocks.

Split the WriteZeroes trait up into a new PunchHole trait, which
corresponds to fallocate() with FALLOC_FL_PUNCH_HOLE, and use the new
trait to implement the virtio block Discard command.

BUG=chromium:896314
TEST=`mkfs.btrfs /dev/vdb` and verify the desired fallocate() is used
     and no write() calls are issued when inducing a failure

Change-Id: I67fd9a132758d8d766531ccca8358c7fe67b0460
Signed-off-by: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1286224
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'src/main.rs')
0 files changed, 0 insertions, 0 deletions