fix: buffered disk cache so btrfs checksums stay valid
This commit is contained in:
@@ -637,8 +637,11 @@ if conformant and E["CONVERT"] == "1":
|
||||
if "device='disk'" not in d or ("bus='nvme'" in d and "<serial>" in d):
|
||||
return d
|
||||
d = re.sub(r"<target dev='([^']*)' bus='(virtio|sata|scsi)'/>", r"<target dev='\1' bus='nvme'/>", d)
|
||||
# cache='none' is O_DIRECT: on btrfs the guest can change a page while the
|
||||
# write is in flight, so the stored checksum never matches and later reads
|
||||
# fail with EIO. Buffered writes hand the filesystem a stable page.
|
||||
d = re.sub(r"<driver name='qemu' type='([^']*)'[^/]*/>",
|
||||
r"<driver name='qemu' type='\1' cache='none' io='native' discard='unmap'/>", d)
|
||||
r"<driver name='qemu' type='\1' cache='writeback' io='threads' discard='unmap'/>", d)
|
||||
d = re.sub(r"\s*<address type='(pci|drive)'[^/]*/>", "", d)
|
||||
if "<serial>" not in d:
|
||||
serial = E["NVME_SERIAL"] if n[0] == 0 else E["NVME_SERIAL"][:-1] + "0123456789ABCDEF"[n[0] % 16]
|
||||
|
||||
Reference in New Issue
Block a user