ports/emulators/qemu7/files/patch-block_export_fuse.c
Muhammad Moinur Rahman ca44054a63 emulators/qemu7*: Move qemu70 to qemu7
QEMU 7.X.X branch is reaching EOL as the upstream has released 8.X.X
branch. So there is no point in keeping multiple versions from 7.X.X
series. This is an interim commit to prepare to move emulators/qemu to
emulators/qemu7 so that emulators/qemu can be upgraded to latest 8.X.X
release.
2023-05-04 20:54:28 +02:00

60 lines
2 KiB
C

--- block/export/fuse.c.orig 2022-04-22 18:57:58 UTC
+++ block/export/fuse.c
@@ -637,12 +637,6 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t
return;
}
-#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
- if (mode & FALLOC_FL_KEEP_SIZE) {
- length = MIN(length, blk_len - offset);
- }
-#endif /* CONFIG_FALLOCATE_PUNCH_HOLE */
-
if (!mode) {
/* We can only fallocate at the EOF with a truncate */
if (offset < blk_len) {
@@ -662,44 +656,6 @@ static void fuse_fallocate(fuse_req_t req, fuse_ino_t
ret = fuse_do_truncate(exp, offset + length, true,
PREALLOC_MODE_FALLOC);
}
-#ifdef CONFIG_FALLOCATE_PUNCH_HOLE
- else if (mode & FALLOC_FL_PUNCH_HOLE) {
- if (!(mode & FALLOC_FL_KEEP_SIZE)) {
- fuse_reply_err(req, EINVAL);
- return;
- }
-
- do {
- int size = MIN(length, BDRV_REQUEST_MAX_BYTES);
-
- ret = blk_pdiscard(exp->common.blk, offset, size);
- offset += size;
- length -= size;
- } while (ret == 0 && length > 0);
- }
-#endif /* CONFIG_FALLOCATE_PUNCH_HOLE */
-#ifdef CONFIG_FALLOCATE_ZERO_RANGE
- else if (mode & FALLOC_FL_ZERO_RANGE) {
- if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + length > blk_len) {
- /* No need for zeroes, we are going to write them ourselves */
- ret = fuse_do_truncate(exp, offset + length, false,
- PREALLOC_MODE_OFF);
- if (ret < 0) {
- fuse_reply_err(req, -ret);
- return;
- }
- }
-
- do {
- int size = MIN(length, BDRV_REQUEST_MAX_BYTES);
-
- ret = blk_pwrite_zeroes(exp->common.blk,
- offset, size, 0);
- offset += size;
- length -= size;
- } while (ret == 0 && length > 0);
- }
-#endif /* CONFIG_FALLOCATE_ZERO_RANGE */
else {
ret = -EOPNOTSUPP;
}