int len_diff;
int device_list_from_udev;
- init_dev_disable_after_error_count(
- find_config_tree_int(cmd, devices_disable_after_error_count_CFG, NULL));
-
if (!dev_cache_init(cmd))
return_0;
"apply to LVM RAID types like 'raid1' which handle failures in a\n"
"different way, making them a better choice for VG stacking.\n")
-cfg(devices_disable_after_error_count_CFG, "disable_after_error_count", devices_CFG_SECTION, 0, CFG_TYPE_INT, DEFAULT_DISABLE_AFTER_ERROR_COUNT, vsn(2, 2, 75), NULL, 0, NULL,
- "Number of I/O errors after which a device is skipped.\n"
- "During each LVM operation, errors received from each device are\n"
- "counted. If the counter of a device exceeds the limit set here,\n"
- "no further I/O is sent to that device for the remainder of the\n"
- "operation. Setting this to 0 disables the counters altogether.\n")
+cfg(devices_disable_after_error_count_CFG, "disable_after_error_count", devices_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(2, 2, 75), NULL, vsn(3, 0, 0), NULL,
+ "This setting is no longer used.\n")
cfg(devices_require_restorefile_with_uuid_CFG, "require_restorefile_with_uuid", devices_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID, vsn(2, 2, 73), NULL, 0, NULL,
"Allow use of pvcreate --uuid without requiring --restorefile.\n")
#define DEFAULT_IGNORE_LVM_MIRRORS 1
#define DEFAULT_MULTIPATH_COMPONENT_DETECTION 1
#define DEFAULT_IGNORE_SUSPENDED_DEVICES 0
-#define DEFAULT_DISABLE_AFTER_ERROR_COUNT 0
#define DEFAULT_REQUIRE_RESTOREFILE_WITH_UUID 1
#define DEFAULT_DATA_ALIGNMENT_OFFSET_DETECTION 1
#define DEFAULT_DATA_ALIGNMENT_DETECTION 1
#define DEFAULT_MAX_HISTORY 100
-#define DEFAULT_MAX_ERROR_COUNT NO_DEV_ERROR_COUNT_LIMIT
-
#define DEFAULT_REP_COMPACT_OUTPUT 0
#define DEFAULT_REP_ALIGNED 1
#define DEFAULT_REP_BUFFERED 1
int rec, int check_with_udev_db);
/* Setup non-zero members of passed zeroed 'struct device' */
-static void _dev_init(struct device *dev, int max_error_count)
+static void _dev_init(struct device *dev)
{
dev->phys_block_size = -1;
dev->block_size = -1;
dev->fd = -1;
dev->read_ahead = -1;
- dev->max_error_count = max_error_count;
dev->ext.enabled = 0;
dev->ext.src = DEV_EXT_NONE;
return NULL;
}
- _dev_init(dev, NO_DEV_ERROR_COUNT_LIMIT);
+ _dev_init(dev);
dev->flags = DEV_REGULAR | ((use_malloc) ? DEV_ALLOCED : 0);
dm_list_add(&dev->aliases, &alias->list);
return NULL;
}
- _dev_init(dev, dev_disable_after_error_count());
+ _dev_init(dev);
dev->dev = d;
return dev;
return NULL;
}
-void dev_reset_error_count(struct cmd_context *cmd)
-{
- struct dev_iter iter;
-
- if (!_cache.devices)
- return;
-
- iter.current = btree_first(_cache.devices);
- while (iter.current)
- _iter_next(&iter)->error_count = 0;
-}
-
int dev_fd(struct device *dev)
{
return dev->fd;
return _dev_close(dev, 1);
}
-static inline int _dev_is_valid(struct device *dev)
-{
- return (dev->max_error_count == NO_DEV_ERROR_COUNT_LIMIT ||
- dev->error_count < dev->max_error_count);
-}
-
-static void _dev_inc_error_count(struct device *dev)
-{
- if (++dev->error_count == dev->max_error_count)
- log_warn("WARNING: Error counts reached a limit of %d. "
- "Device %s was disabled",
- dev->max_error_count, dev_name(dev));
-}
-
int dev_read(struct device *dev, uint64_t offset, size_t len, dev_io_reason_t reason, void *buffer)
{
struct device_area where;
if (!dev->open_count)
return_0;
- if (!_dev_is_valid(dev))
- return 0;
-
where.dev = dev;
where.start = offset;
where.size = len;
ret = _aligned_io(&where, buffer, 0, reason);
- if (!ret)
- _dev_inc_error_count(dev);
return ret;
}
if (!dev->open_count)
return_0;
- if (!_dev_is_valid(dev))
- return 0;
-
if (!len) {
log_error(INTERNAL_ERROR "Attempted to write 0 bytes to %s at " FMTu64, dev_name(dev), offset);
return 0;
dev->flags |= DEV_ACCESSED_W;
ret = _aligned_io(&where, buffer, 1, reason);
- if (!ret)
- _dev_inc_error_count(dev);
return ret;
}
/* private */
int fd;
int open_count;
- int error_count;
- int max_error_count;
int phys_block_size;
int block_size;
int read_ahead;
static int _retry_deactivation = DEFAULT_RETRY_DEACTIVATION;
static int _activation_checks = 0;
static char _sysfs_dir_path[PATH_MAX] = "";
-static int _dev_disable_after_error_count = DEFAULT_DISABLE_AFTER_ERROR_COUNT;
static uint64_t _pv_min_size = (DEFAULT_PV_MIN_SIZE_KB * 1024L >> SECTOR_SHIFT);
static const char *_unknown_device_name = DEFAULT_UNKNOWN_DEVICE_NAME;
log_debug_activation("LVM activation checks disabled");
}
-void init_dev_disable_after_error_count(int value)
-{
- _dev_disable_after_error_count = value;
-}
-
void init_pv_min_size(uint64_t sectors)
{
_pv_min_size = sectors;
return _sysfs_dir_path;
}
-int dev_disable_after_error_count(void)
-{
- return _dev_disable_after_error_count;
-}
-
uint64_t pv_min_size(void)
{
return _pv_min_size;
void init_error_message_produced(int produced);
void init_is_static(unsigned value);
void init_udev_checking(int checking);
-void init_dev_disable_after_error_count(int value);
void init_pv_min_size(uint64_t sectors);
void init_activation_checks(int checks);
void init_retry_deactivation(int retry);
#define DMEVENTD_MONITOR_IGNORE -1
int dmeventd_monitor_mode(void);
-#define NO_DEV_ERROR_COUNT_LIMIT 0
-int dev_disable_after_error_count(void);
-
#endif