static void log_sys_warn(const char *call)
{
- log_warn("%s failed: %s", call, strerror(errno));
+ log_warn("WARNING: %s failed: %s.", call, strerror(errno));
}
// Assumes the list is not empty.
// never be in flight IO.
if (!dm_list_empty(&cbs->allocated)) {
// bail out
- log_error("async io still in flight");
+ log_warn("WARNING: async io still in flight.");
return;
}
struct block *b = v.ptr;
if (_test_flags(b, BF_DIRTY))
- _issue_write(b);
+ _issue_write(b);
- return true;
+ return true;
}
static bool _invalidate_v(struct radix_tree_iterator *it,
uint8_t *kb, uint8_t *ke, union radix_value v)
{
struct block *b = v.ptr;
- struct invalidate_iterator *iit = container_of(it, struct invalidate_iterator, it);
+ struct invalidate_iterator *iit = container_of(it, struct invalidate_iterator, it);
if (b->error || _test_flags(b, BF_DIRTY)) {
- log_warn("bcache_invalidate: block (%d, %llu) still dirty",
- b->di, (unsigned long long) b->index);
- iit->success = false;
- return true;
+ log_warn("WARNING: bcache_invalidate: block (%d, %llu) still dirty.",
+ b->di, (unsigned long long) b->index);
+ iit->success = false;
+ return true;
}
if (b->ref_count) {
- log_warn("bcache_invalidate: block (%d, %llu) still held",
+ log_warn("WARNING: bcache_invalidate: block (%d, %llu) still held.",
b->di, (unsigned long long) b->index);
iit->success = false;
return true;
bool bcache_invalidate_di(struct bcache *cache, int di)
{
- union key k;
+ union key k;
struct invalidate_iterator it;
k.parts.di = di;
void bcache_abort_di(struct bcache *cache, int di)
{
- union key k;
+ union key k;
struct radix_tree_iterator it;
k.parts.di = di;
if (di >= _fd_table_size)
return 0;
if (di < 0) {
- log_error(INTERNAL_ERROR "Cannot change not openned DI with FD:%d", fd);
+ log_error(INTERNAL_ERROR "Cannot change not opened DI with FD:%d", fd);
return 0;
}
_fd_table[di] = fd;
return 1;
}
-
}
if (ioctl(fd, BLKGETSIZE64, size) < 0) {
- log_sys_error("ioctl BLKGETSIZE64", name);
+ log_warn("WARNING: %s: ioctl BLKGETSIZE64 %s", name, strerror(errno));
if (do_close && !dev_close_immediate(dev))
stack;
return 0;
}
if (!dev_open_readonly_quiet(dev)) {
- log_error("Failed to open to get readahead %s", dev_name(dev));
+ log_warn("WARNING: Failed to open %s to get readahead %s.",
+ dev_name(dev), strerror(errno));
return 0;
}
if (ioctl(dev->fd, BLKRAGET, &read_ahead_long) < 0) {
- log_sys_error("ioctl BLKRAGET", dev_name(dev));
+ log_warn("WARNING: %s: ioctl BLKRAGET %s.", dev_name(dev), strerror(errno));
if (!dev_close_immediate(dev))
stack;
return 0;
test_mode() ? " (test mode - suppressed)" : "");
if (!test_mode() && ioctl(dev->fd, BLKDISCARD, &discard_range) < 0) {
- log_error("%s: BLKDISCARD ioctl at offset %" PRIu64 " size %" PRIu64 " failed: %s.",
+ log_warn("WARNING: %s: ioctl BLKDISCARD at offset %" PRIu64 " size %" PRIu64 " failed: %s.",
dev_name(dev), offset_bytes, size_bytes, strerror(errno));
if (!dev_close_immediate(dev))
stack;
log_error("Expecting string in devices/types "
"in config file");
if (fclose(pd))
- log_sys_error("fclose", proc_devices);
+ log_sys_debug("fclose", proc_devices);
goto bad;
}
dev_len = strlen(cv->v.str);
"in devices/types in config file",
name);
if (fclose(pd))
- log_sys_error("fclose", proc_devices);
+ log_sys_debug("fclose", proc_devices);
goto bad;
}
if (!cv->v.i) {
"%s in devices/types in config file",
name);
if (fclose(pd))
- log_sys_error("fclose", proc_devices);
+ log_sys_debug("fclose", proc_devices);
goto bad;
}
if (dev_len <= strlen(line + i) &&
/* check if dev is a partition */
if (dm_snprintf(path, sizeof(path), "%s/dev/block/%d:%d/partition",
dm_sysfs_dir(), major, minor) < 0) {
- log_error("dm_snprintf partition failed");
+ log_warn("WARNING: %s: partition path is too long.", dev_name(dev));
return 0;
}
if (stat(path, &info) == -1) {
if (errno != ENOENT)
- log_sys_error("stat", path);
+ log_sys_debug("stat", path);
return 0;
}
return 1;
*/
int dev_get_primary_dev(struct dev_types *dt, struct device *dev, dev_t *result)
{
- const char *sysfs_dir = dm_sysfs_dir();
int major = (int) MAJOR(dev->dev);
int minor = (int) MINOR(dev->dev);
char path[PATH_MAX];
* Parent's 'dev' sysfs attribute = /sys/block/md0/dev
*/
if ((size = readlink(dirname(path), temp_path, sizeof(temp_path) - 1)) < 0) {
- log_sys_error("readlink", path);
+ log_warn("WARNING: Readlink of %s failed.", path);
goto out;
}
temp_path[size] = '\0';
if (dm_snprintf(path, sizeof(path), "%s/block/%s/dev",
- sysfs_dir, basename(dirname(temp_path))) < 0) {
- log_error("dm_snprintf dev failed");
+ dm_sysfs_dir(), basename(dirname(temp_path))) < 0) {
+ log_warn("WARNING: sysfs path for %s is too long.",
+ basename(dirname(temp_path)));
goto out;
}
/* finally, parse 'dev' attribute and create corresponding dev_t */
if (!(fp = fopen(path, "r"))) {
if (errno == ENOENT)
- log_error("sysfs file %s does not exist.", path);
+ log_debug("sysfs file %s does not exist.", path);
else
- log_sys_error("fopen", path);
+ log_sys_debug("fopen", path);
goto out;
}
}
if (sscanf(buffer, "%d:%d", &major, &minor) != 2) {
- log_error("sysfs file %s not in expected MAJ:MIN format: %s",
+ log_warn("WARNING: sysfs file %s not in expected MAJ:MIN format: %s",
path, buffer);
goto out;
}
ret = 2;
out:
if (fp && fclose(fp))
- log_sys_error("fclose", path);
+ log_sys_debug("fclose", path);
return ret;
}
return 0;
}
- log_error("WARNING: " MSG_FAILED_SIG_OFFSET MSG_WIPING_SKIPPED, type, name);
+ log_warn("WARNING: " MSG_FAILED_SIG_OFFSET MSG_WIPING_SKIPPED, type, name);
return 2;
}
if (blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) {
yes, force, wiped);
#endif
if (blkid_wiping_enabled) {
- log_warn("allocation/use_blkid_wiping=1 configuration setting is set "
+ log_warn("WARNING: allocation/use_blkid_wiping=1 configuration setting is set "
"while LVM is not compiled with blkid wiping support.");
- log_warn("Falling back to native LVM signature detection.");
+ log_warn("WARNING: Falling back to native LVM signature detection.");
}
return _wipe_known_signatures_with_lvm(dev, name,
types_to_exclude,
if (dm_snprintf(buf, buf_size, "%s/dev/block/%d:%d/%s", sysfs_dir,
(int)MAJOR(dev), (int)MINOR(dev),
attribute) < 0) {
- log_warn("dm_snprintf %s failed.", attribute);
+ log_warn("WARNING: sysfs path for %s attribute is too long.", attribute);
return 0;
}