1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

devices: clean up io error messages

Remove the io error message from bcache.c since it is not
very useful without the device path.

Make the io error messages from dev_read_bytes/dev_write_bytes
more user friendly.
This commit is contained in:
David Teigland 2018-06-06 10:05:08 -05:00
parent 3e781ea446
commit c67bd8b47b
2 changed files with 22 additions and 19 deletions

View File

@ -623,7 +623,6 @@ static void _complete_io(void *context, int err)
dm_list_del(&b->list);
if (b->error) {
log_warn("bcache io error %d fd %d", b->error, b->fd);
dm_list_add(&cache->errored, &b->list);
} else {

View File

@ -1122,14 +1122,15 @@ bool dev_read_bytes(struct device *dev, uint64_t start, size_t len, void *data)
if (dev->bcache_fd <= 0) {
/* This is not often needed, perhaps only with lvmetad. */
if (!label_scan_open(dev)) {
log_error("dev_read_bytes %s cannot open dev", dev_name(dev));
log_error("Error opening device %s for reading at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
return false;
}
}
if (!bcache_read_bytes(scan_bcache, dev->bcache_fd, start, len, data)) {
log_error("dev_read_bytes %s at %u failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error reading device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}
@ -1151,21 +1152,22 @@ bool dev_write_bytes(struct device *dev, uint64_t start, size_t len, void *data)
if (dev->bcache_fd <= 0) {
/* This is not often needed, perhaps only with lvmetad. */
if (!label_scan_open(dev)) {
log_error("dev_write_bytes %s cannot open dev", dev_name(dev));
log_error("Error opening device %s for writing at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
return false;
}
}
if (!bcache_write_bytes(scan_bcache, dev->bcache_fd, start, len, data)) {
log_error("dev_write_bytes %s at %u bcache write failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}
if (!bcache_flush(scan_bcache)) {
log_error("dev_write_bytes %s at %u bcache flush failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}
@ -1185,21 +1187,22 @@ bool dev_write_zeros(struct device *dev, uint64_t start, size_t len)
if (dev->bcache_fd <= 0) {
/* This is not often needed, perhaps only with lvmetad. */
if (!label_scan_open(dev)) {
log_error("dev_write_zeros %s cannot open dev", dev_name(dev));
log_error("Error opening device %s for writing at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
return false;
}
}
if (!bcache_zero_bytes(scan_bcache, dev->bcache_fd, start, len)) {
log_error("dev_write_zeros %s at %u bcache write failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}
if (!bcache_flush(scan_bcache)) {
log_error("dev_write_zeros %s at %u bcache flush failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}
@ -1219,21 +1222,22 @@ bool dev_set_bytes(struct device *dev, uint64_t start, size_t len, uint8_t val)
if (dev->bcache_fd <= 0) {
/* This is not often needed, perhaps only with lvmetad. */
if (!label_scan_open(dev)) {
log_error("dev_set_bytes %s cannot open dev", dev_name(dev));
log_error("Error opening device %s for writing at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
return false;
}
}
if (!bcache_set_bytes(scan_bcache, dev->bcache_fd, start, len, val)) {
log_error("dev_set_bytes %s at %u bcache write failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}
if (!bcache_flush(scan_bcache)) {
log_error("dev_set_bytes %s at %u bcache flush failed invalidate fd %d",
dev_name(dev), (uint32_t)start, dev->bcache_fd);
log_error("Error writing device %s at %llu length %u.",
dev_name(dev), (unsigned long long)start, (uint32_t)len);
label_scan_invalidate(dev);
return false;
}