@@ -42,6 +42,7 @@ static int discard_range(struct log *log, u64 start, u64 len)
static int zero_range(struct log *log, u64 start, u64 len)
{
+ u64 range[2] = { start, len };
u64 bufsize = len;
ssize_t ret;
char *buf = NULL;
@@ -54,6 +55,15 @@ static int zero_range(struct log *log, u64 start, u64 len)
return 0;
}
+ if (!(log->flags & LOG_ZEROOUT_NOT_SUPP)) {
+ if (ioctl(log->replayfd, BLKZEROOUT, &range) < 0) {
+ if (log_writes_verbose)
+ printf(
+ "replay device doesn't support zeroout, switching to writing zeros\n");
+ log->flags |= LOG_ZEROOUT_NOT_SUPP;
+ }
+ }
+
while (!buf) {
buf = malloc(bufsize);
if (!buf)
@@ -63,6 +63,7 @@ struct log_write_entry {
#define LOG_IGNORE_DISCARD (1 << 0)
#define LOG_DISCARD_NOT_SUPP (1 << 1)
+#define LOG_ZEROOUT_NOT_SUPP (1 << 2)
struct log {
int logfd;