diff options
author | David Sterba <dsterba@suse.com> | 2024-03-16 18:55:37 +0100 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2024-03-16 22:25:50 +0100 |
commit | 054b314fbe5efc8b115a18bd93dfea52d15ea607 (patch) | |
tree | 8fa95b358e73c0653180bfe8688336918102cbf5 | |
parent | 060f7d6c81f98a7322b5414405109d7d735d6b8a (diff) | |
download | btrfs-progs-054b314fbe5efc8b115a18bd93dfea52d15ea607.tar.gz |
btrfs-progs: print error when zeroing device fails in device_zero_blocks()
Use the template to be verbose about device zeroing failure, this can be
called repeatedly.
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | common/device-utils.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/common/device-utils.c b/common/device-utils.c index f86120af..36108ec4 100644 --- a/common/device-utils.c +++ b/common/device-utils.c @@ -112,8 +112,11 @@ int device_zero_blocks(int fd, off_t start, size_t len, bool direct) return -ENOMEM; memset(buf, 0, len); written = btrfs_pwrite(fd, buf, len, start, direct); - if (written != len) + if (written != len) { + error_msg(ERROR_MSG_WRITE, "zeroing range from %llu: %m", + (unsigned long long)start); ret = -EIO; + } free(buf); return ret; } |