summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2023-04-13 13:15:31 +0100
committerPádraig Brady <P@draigBrady.com>2023-04-13 20:19:09 +0100
commit854c90ecc031232a3bd6d94b149f84d5c2e1ab11 (patch)
treeb987568c69e64edad51b07a60b7576ac0974ac77
parentcc95246ee2ed674cd407f0f80fd77f3364012458 (diff)
downloadcoreutils-854c90ecc031232a3bd6d94b149f84d5c2e1ab11.tar.gz
copy: --debug: indicate if NUL detection is used with SEEK_HOLE
* src/copy.c (sparse_copy): With --sparse=always we also detect NULs in extents we're copying, so indicate this with --debug.
-rw-r--r--src/copy.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/copy.c b/src/copy.c
index 0476d95ca..13d93324f 100644
--- a/src/copy.c
+++ b/src/copy.c
@@ -146,6 +146,7 @@ enum copy_debug_val
COPY_DEBUG_NO,
COPY_DEBUG_YES,
COPY_DEBUG_EXTERNAL,
+ COPY_DEBUG_EXTERNAL_INTERNAL,
COPY_DEBUG_AVOIDED,
COPY_DEBUG_UNSUPPORTED,
};
@@ -179,6 +180,7 @@ copy_debug_sparse_string (enum copy_debug_val debug_val)
case COPY_DEBUG_NO: return "no";
case COPY_DEBUG_YES: return "zeros";
case COPY_DEBUG_EXTERNAL: return "SEEK_HOLE";
+ case COPY_DEBUG_EXTERNAL_INTERNAL: return "SEEK_HOLE + zeros";
default: return "unknown";
}
}
@@ -325,6 +327,8 @@ sparse_copy (int src_fd, int dest_fd, char **abuf, size_t buf_size,
if (copy_debug.sparse_detection == COPY_DEBUG_UNKNOWN)
copy_debug.sparse_detection = hole_size ? COPY_DEBUG_YES : COPY_DEBUG_NO;
+ else if (hole_size && copy_debug.sparse_detection == COPY_DEBUG_EXTERNAL)
+ copy_debug.sparse_detection = COPY_DEBUG_EXTERNAL_INTERNAL;
/* If not looking for holes, use copy_file_range if functional,
but don't use if reflink disallowed as that may be implicit. */