mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-24 14:33:38 +00:00
dm: storage: change DISCARD to synchronous mode
For virtio-blk, when the backend is a regular file, the discard and is implemented by fallocate(), but this function will not wait for the discard command handled by disk. So, add fdatasync to make sure the DISCARD is executed synchronously. Tracked-On: #2547 Signed-off-by: Conghui Chen <conghui.chen@intel.com> Acked-by: Wang Yu <yu1.wang@intel.com>
This commit is contained in:
parent
b595abcc23
commit
a82cafe92d
@ -313,6 +313,8 @@ blockif_process_discard(struct blockif_ctxt *bc, struct blockif_req *br)
|
||||
*/
|
||||
err = fallocate(bc->fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
|
||||
arg[i][0], arg[i][1]);
|
||||
if (!err)
|
||||
err = fdatasync(bc->fd);
|
||||
}
|
||||
if (err) {
|
||||
WPRINTF(("Failed to discard offset=%ld nbytes=%ld err code: %d\n",
|
||||
|
Loading…
Reference in New Issue
Block a user