67 lines
2.0 KiB
Diff
67 lines
2.0 KiB
Diff
From a41be72f9d2fe9a8ba6ee4f0549dd0c149bd2c96 Mon Sep 17 00:00:00 2001
|
|
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
Date: Thu, 1 May 2025 10:26:41 +0100
|
|
Subject: [PATCH] file: Rename h->can_zeroout to h->can_blkzeroout to reflect
|
|
ioctl
|
|
|
|
Since we're calling the blockdev-specific BLKZEROOUT ioctl when this
|
|
flag is set, rename the flag.
|
|
|
|
(cherry picked from commit fba20ce06c2f0e7c4be7e52e8e1934933851dfbc)
|
|
(cherry picked from commit bc4598f3d2d1ef2f4ebdf5b365ed08eff14d5654)
|
|
---
|
|
plugins/file/file.c | 10 +++++-----
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/plugins/file/file.c b/plugins/file/file.c
|
|
index d94d5b78..55941bb8 100644
|
|
--- a/plugins/file/file.c
|
|
+++ b/plugins/file/file.c
|
|
@@ -476,7 +476,7 @@ struct handle {
|
|
bool can_punch_hole;
|
|
bool can_zero_range;
|
|
bool can_fallocate;
|
|
- bool can_zeroout;
|
|
+ bool can_blkzeroout;
|
|
};
|
|
|
|
/* Common code for opening a file by name, used by mode_filename and
|
|
@@ -682,7 +682,7 @@ file_open (int readonly)
|
|
#endif
|
|
|
|
h->can_fallocate = true;
|
|
- h->can_zeroout = h->is_block_device;
|
|
+ h->can_blkzeroout = h->is_block_device;
|
|
|
|
return h;
|
|
}
|
|
@@ -975,14 +975,14 @@ file_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
|
|
|
|
#ifdef BLKZEROOUT
|
|
/* For aligned range and block device, we can use BLKZEROOUT. */
|
|
- if (h->can_zeroout && IS_ALIGNED (offset | count, h->sector_size)) {
|
|
+ if (h->can_blkzeroout && IS_ALIGNED (offset | count, h->sector_size)) {
|
|
int r;
|
|
uint64_t range[2] = {offset, count};
|
|
|
|
r = ioctl (h->fd, BLKZEROOUT, &range);
|
|
if (r == 0) {
|
|
if (file_debug_zero)
|
|
- nbdkit_debug ("h->can_zeroout && IS_ALIGNED: "
|
|
+ nbdkit_debug ("h->can_blkzeroout && IS_ALIGNED: "
|
|
"zero succeeded using BLKZEROOUT");
|
|
goto out;
|
|
}
|
|
@@ -992,7 +992,7 @@ file_zero (void *handle, uint32_t count, uint64_t offset, uint32_t flags)
|
|
return -1;
|
|
}
|
|
|
|
- h->can_zeroout = false;
|
|
+ h->can_blkzeroout = false;
|
|
}
|
|
#endif
|
|
|
|
--
|
|
2.47.1
|
|
|