mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-08 10:03:17 +03:00
tidy: prefer not using else after return
clang-tidy: avoid using 'else' after return - give more readable code, and also saves indention level.
This commit is contained in:
parent
0d0a3397c2
commit
0bf836aa14
@ -2252,7 +2252,8 @@ int main(int argc, char *argv[])
|
||||
"for %ld second(s), exiting.",
|
||||
(long) (time(NULL) - _idle_since));
|
||||
break;
|
||||
} else if (idle_exit_timeout) {
|
||||
}
|
||||
if (idle_exit_timeout) {
|
||||
now = time(NULL);
|
||||
if (now < _idle_since)
|
||||
_idle_since = now; /* clock change? */
|
||||
|
@ -250,10 +250,9 @@ static int _daemon_read(struct dm_event_fifos *fifos,
|
||||
if (ret < 0) {
|
||||
if ((errno == EINTR) || (errno == EAGAIN))
|
||||
continue;
|
||||
else {
|
||||
log_error("Unable to read from event server.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_error("Unable to read from event server.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytes += ret;
|
||||
@ -329,10 +328,9 @@ static int _daemon_write(struct dm_event_fifos *fifos,
|
||||
if (ret < 0) {
|
||||
if ((errno == EINTR) || (errno == EAGAIN))
|
||||
continue;
|
||||
else {
|
||||
log_error("Unable to talk to event daemon.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_error("Unable to talk to event daemon.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
bytes += ret;
|
||||
@ -454,7 +452,8 @@ static int _start_daemon(char *dmeventd_path, struct dm_event_fifos *fifos)
|
||||
if (close(fifos->client))
|
||||
log_sys_debug("close", fifos->client_path);
|
||||
return 1;
|
||||
} else if (errno != ENXIO && errno != ENOENT) {
|
||||
}
|
||||
if (errno != ENXIO && errno != ENOENT) {
|
||||
/* problem */
|
||||
log_sys_error("open", fifos->client_path);
|
||||
return 0;
|
||||
|
@ -797,14 +797,18 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
|
||||
status->info.exists = 0; /* So pool LV is not active */
|
||||
}
|
||||
return 1;
|
||||
} else if (lv_is_external_origin(lv)) {
|
||||
}
|
||||
|
||||
if (lv_is_external_origin(lv)) {
|
||||
if (!_lv_info(cmd, lv, 0, &status->info, NULL, NULL,
|
||||
with_open_count, with_read_ahead))
|
||||
return_0;
|
||||
|
||||
(void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
|
||||
return 1;
|
||||
} else if (lv_is_origin(lv)) {
|
||||
}
|
||||
|
||||
if (lv_is_origin(lv)) {
|
||||
/* Query segment status for 'layered' (-real) device most of the time,
|
||||
* only for merging snapshot, query its progress.
|
||||
* TODO: single LV may need couple status to be exposed at once....
|
||||
@ -821,7 +825,9 @@ int lv_info_with_seg_status(struct cmd_context *cmd,
|
||||
/* Grab STATUS from layered -real */
|
||||
(void) _lv_info(cmd, lv, 1, NULL, lv_seg, &status->seg_status, 0, 0);
|
||||
return 1;
|
||||
} else if (lv_is_cow(lv)) {
|
||||
}
|
||||
|
||||
if (lv_is_cow(lv)) {
|
||||
if (lv_is_merging_cow(lv)) {
|
||||
olv = origin_from_cow(lv);
|
||||
|
||||
|
@ -1056,10 +1056,11 @@ static int _percent(struct dev_manager *dm, const char *name, const char *dlid,
|
||||
if (_percent_run(dm, NULL, dlid, target_type, wait, lv, percent,
|
||||
event_nr, fail_if_percent_unsupported))
|
||||
return 1;
|
||||
else if (_original_uuid_format_check_required(dm->cmd) &&
|
||||
_percent_run(dm, NULL, dlid + sizeof(UUID_PREFIX) - 1,
|
||||
target_type, wait, lv, percent,
|
||||
event_nr, fail_if_percent_unsupported))
|
||||
|
||||
if (_original_uuid_format_check_required(dm->cmd) &&
|
||||
_percent_run(dm, NULL, dlid + sizeof(UUID_PREFIX) - 1,
|
||||
target_type, wait, lv, percent,
|
||||
event_nr, fail_if_percent_unsupported))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -186,11 +186,11 @@ static int _mk_link(const char *dev_dir, const char *vg_name,
|
||||
!stat(lv_path, &buf)) {
|
||||
if (buf_lp.st_rdev == buf.st_rdev)
|
||||
return 1;
|
||||
else
|
||||
log_warn("Symlink %s that should have been "
|
||||
"created by udev does not have "
|
||||
"correct target. Falling back to "
|
||||
"direct link creation", lv_path);
|
||||
|
||||
log_warn("Symlink %s that should have been "
|
||||
"created by udev does not have "
|
||||
"correct target. Falling back to "
|
||||
"direct link creation", lv_path);
|
||||
} else
|
||||
log_warn("Symlink %s that should have been "
|
||||
"created by udev could not be checked "
|
||||
@ -239,7 +239,9 @@ static int _rm_link(const char *dev_dir, const char *vg_name,
|
||||
return 1;
|
||||
log_sys_error("lstat", lv_path);
|
||||
return 0;
|
||||
} else if (dm_udev_get_sync_support() && udev_checking() && check_udev)
|
||||
}
|
||||
|
||||
if (dm_udev_get_sync_support() && udev_checking() && check_udev)
|
||||
log_warn("The link %s should have been removed by udev "
|
||||
"but it is still present. Falling back to "
|
||||
"direct link removal.", lv_path);
|
||||
@ -478,9 +480,9 @@ int fs_rename_lv(const struct logical_volume *lv, const char *dev,
|
||||
_fs_op(FS_ADD, lv->vg->cmd->dev_dir, lv->vg->name,
|
||||
lv->name, dev, "", lv->vg->cmd->current_settings.udev_rules));
|
||||
}
|
||||
else
|
||||
return _fs_op(FS_RENAME, lv->vg->cmd->dev_dir, lv->vg->name, lv->name,
|
||||
dev, old_lvname, lv->vg->cmd->current_settings.udev_rules);
|
||||
|
||||
return _fs_op(FS_RENAME, lv->vg->cmd->dev_dir, lv->vg->name, lv->name,
|
||||
dev, old_lvname, lv->vg->cmd->current_settings.udev_rules);
|
||||
}
|
||||
|
||||
void fs_unlock(void)
|
||||
|
13
lib/cache/lvmetad.c
vendored
13
lib/cache/lvmetad.c
vendored
@ -145,13 +145,14 @@ int lvmetad_connect(struct cmd_context *cmd)
|
||||
_lvmetad_use = 1;
|
||||
_lvmetad_cmd = cmd;
|
||||
return 1;
|
||||
} else {
|
||||
log_debug_lvmetad("Failed to connect to lvmetad: %s", strerror(_lvmetad.error));
|
||||
_lvmetad_connected = 0;
|
||||
_lvmetad_use = 0;
|
||||
_lvmetad_cmd = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_debug_lvmetad("Failed to connect to lvmetad: %s", strerror(_lvmetad.error));
|
||||
_lvmetad_connected = 0;
|
||||
_lvmetad_use = 0;
|
||||
_lvmetad_cmd = NULL;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lvmetad_used(void)
|
||||
|
@ -481,7 +481,8 @@ int override_config_tree_from_profile(struct cmd_context *cmd,
|
||||
|
||||
if (profile->source == CONFIG_PROFILE_COMMAND)
|
||||
return _override_config_tree_from_command_profile(cmd, profile);
|
||||
else if (profile->source == CONFIG_PROFILE_METADATA)
|
||||
|
||||
if (profile->source == CONFIG_PROFILE_METADATA)
|
||||
return _override_config_tree_from_metadata_profile(cmd, profile);
|
||||
|
||||
log_error(INTERNAL_ERROR "override_config_tree_from_profile: incorrect profile source type");
|
||||
|
@ -320,8 +320,8 @@ static int _compare_paths(const char *path0, const char *path1)
|
||||
/* ASCII comparison */
|
||||
if (strcmp(path0, path1) < 0)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int _add_alias(struct device *dev, const char *path)
|
||||
@ -898,10 +898,10 @@ int dev_cache_index_devs(void)
|
||||
if (errno == ENOENT) {
|
||||
sysfs_has_dev_block = 0;
|
||||
return 1;
|
||||
} else {
|
||||
log_sys_error("stat", path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
log_sys_error("stat", path);
|
||||
return 0;
|
||||
}
|
||||
} else if (!sysfs_has_dev_block)
|
||||
return 1;
|
||||
|
@ -405,8 +405,8 @@ int dev_get_size(struct device *dev, uint64_t *size)
|
||||
|
||||
if ((dev->flags & DEV_REGULAR))
|
||||
return _dev_get_size_file(dev, size);
|
||||
else
|
||||
return _dev_get_size_dev(dev, size);
|
||||
|
||||
return _dev_get_size_dev(dev, size);
|
||||
}
|
||||
|
||||
int dev_get_read_ahead(struct device *dev, uint32_t *read_ahead)
|
||||
|
@ -615,38 +615,38 @@ static int _blkid_wipe(blkid_probe probe, struct device *dev, const char *name,
|
||||
if (force < DONT_PROMPT) {
|
||||
log_error(MSG_FAILED_SIG_OFFSET, type, name);
|
||||
return 0;
|
||||
} else {
|
||||
log_error("WARNING: " MSG_FAILED_SIG_OFFSET MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
|
||||
log_error("WARNING: " MSG_FAILED_SIG_OFFSET MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
if (blkid_probe_lookup_value(probe, "SBMAGIC", &magic, &len)) {
|
||||
if (force < DONT_PROMPT) {
|
||||
log_error(MSG_FAILED_SIG_LENGTH, type, name);
|
||||
return 0;
|
||||
} else {
|
||||
log_warn("WARNING: " MSG_FAILED_SIG_LENGTH MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
|
||||
log_warn("WARNING: " MSG_FAILED_SIG_LENGTH MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
} else if (!blkid_probe_lookup_value(probe, "PTTYPE", &type, NULL)) {
|
||||
if (blkid_probe_lookup_value(probe, "PTMAGIC_OFFSET", &offset, NULL)) {
|
||||
if (force < DONT_PROMPT) {
|
||||
log_error(MSG_FAILED_SIG_OFFSET, type, name);
|
||||
return 0;
|
||||
} else {
|
||||
log_warn("WARNING: " MSG_FAILED_SIG_OFFSET MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
|
||||
log_warn("WARNING: " MSG_FAILED_SIG_OFFSET MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
if (blkid_probe_lookup_value(probe, "PTMAGIC", &magic, &len)) {
|
||||
if (force < DONT_PROMPT) {
|
||||
log_error(MSG_FAILED_SIG_LENGTH, type, name);
|
||||
return 0;
|
||||
} else {
|
||||
log_warn("WARNING: " MSG_FAILED_SIG_LENGTH MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
|
||||
log_warn("WARNING: " MSG_FAILED_SIG_LENGTH MSG_WIPING_SKIPPED, type, name);
|
||||
return 2;
|
||||
}
|
||||
usage = "partition table";
|
||||
} else
|
||||
|
@ -274,8 +274,9 @@ static int _accept_p(struct dev_filter *f, struct device *dev)
|
||||
if (!_set_lookup(ds, dev->dev)) {
|
||||
log_debug_devs("%s: Skipping (sysfs)", dev_name(dev));
|
||||
return 0;
|
||||
} else
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void _destroy(struct dev_filter *f)
|
||||
|
@ -152,8 +152,8 @@ static uint64_t _get_prev_sector_circular(uint64_t region_start,
|
||||
{
|
||||
if (region_ptr >= region_start + SECTOR_SIZE)
|
||||
return region_ptr - SECTOR_SIZE;
|
||||
else
|
||||
return (region_start + region_size - SECTOR_SIZE);
|
||||
|
||||
return (region_start + region_size - SECTOR_SIZE);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -447,9 +447,9 @@ static struct raw_locn *_find_vg_rlocn(struct device_area *dev_area,
|
||||
if (!strncmp(vgnamebuf, vgname, len = strlen(vgname)) &&
|
||||
(isspace(vgnamebuf[len]) || vgnamebuf[len] == '{'))
|
||||
return rlocn;
|
||||
else
|
||||
log_debug_metadata("Volume group name found in metadata does "
|
||||
"not match expected name %s.", vgname);
|
||||
|
||||
log_debug_metadata("Volume group name found in metadata does "
|
||||
"not match expected name %s.", vgname);
|
||||
|
||||
bad:
|
||||
if ((info = lvmcache_info_from_pvid(dev_area->dev->pvid, dev_area->dev, 0)) &&
|
||||
@ -893,8 +893,9 @@ static struct volume_group *_vg_read_file_name(struct format_instance *fid,
|
||||
log_error("'%s' does not contain volume group '%s'.",
|
||||
read_path, vgname);
|
||||
return NULL;
|
||||
} else
|
||||
log_debug_metadata("Read volume group %s from %s", vg->name, read_path);
|
||||
}
|
||||
|
||||
log_debug_metadata("Read volume group %s from %s", vg->name, read_path);
|
||||
|
||||
return vg;
|
||||
}
|
||||
@ -1634,10 +1635,10 @@ static int _text_pv_initialise(const struct format_type *fmt,
|
||||
log_error("%s: Bootloader area would overlap "
|
||||
"data area.", pv_dev_name(pv));
|
||||
return 0;
|
||||
} else {
|
||||
pv->ba_start = pva->ba_start ? : final_alignment;
|
||||
pv->ba_size = pva->ba_size;
|
||||
}
|
||||
|
||||
pv->ba_start = pva->ba_start ? : final_alignment;
|
||||
pv->ba_size = pva->ba_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,11 +519,14 @@ static int decode_lock_type(const char *response)
|
||||
{
|
||||
if (!response)
|
||||
return LCK_NULL;
|
||||
else if (!strcmp(response, "EX"))
|
||||
|
||||
if (!strcmp(response, "EX"))
|
||||
return LCK_EXCL;
|
||||
else if (!strcmp(response, "CR"))
|
||||
|
||||
if (!strcmp(response, "CR"))
|
||||
return LCK_READ;
|
||||
else if (!strcmp(response, "PR"))
|
||||
|
||||
if (!strcmp(response, "PR"))
|
||||
return LCK_PREAD;
|
||||
|
||||
return_0;
|
||||
|
@ -187,9 +187,9 @@ int init_locking(int type, struct cmd_context *cmd, int suppress_messages)
|
||||
"be inaccessible.");
|
||||
if (init_file_locking(&_locking, cmd, suppress_messages))
|
||||
return 1;
|
||||
else
|
||||
log_error_suppress(suppress_messages,
|
||||
"File-based locking initialisation failed.");
|
||||
|
||||
log_error_suppress(suppress_messages,
|
||||
"File-based locking initialisation failed.");
|
||||
}
|
||||
|
||||
if (!ignorelockingfailure())
|
||||
@ -232,7 +232,9 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname)
|
||||
log_error("%s exists: Is the original LVM driver using "
|
||||
"this volume group?", path);
|
||||
return 0;
|
||||
} else if (errno != ENOENT && errno != ENOTDIR) {
|
||||
}
|
||||
|
||||
if (errno != ENOENT && errno != ENOTDIR) {
|
||||
log_sys_error("stat", path);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1596,15 +1596,15 @@ int lockd_gl(struct cmd_context *cmd, const char *def_mode, uint32_t flags)
|
||||
*/
|
||||
log_error("Global lock failed: held by other host.");
|
||||
return 0;
|
||||
} else {
|
||||
/*
|
||||
* We don't intend to reach this. We should check
|
||||
* any known/possible error specifically and print
|
||||
* a more helpful message. This is for completeness.
|
||||
*/
|
||||
log_error("Global lock failed: error %d.", result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't intend to reach this. We should check
|
||||
* any known/possible error specifically and print
|
||||
* a more helpful message. This is for completeness.
|
||||
*/
|
||||
log_error("Global lock failed: error %d.", result);
|
||||
return 0;
|
||||
}
|
||||
|
||||
allow:
|
||||
@ -2330,15 +2330,16 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
|
||||
if (!_lvmlockd_connected)
|
||||
return 0;
|
||||
|
||||
if (!lp->needs_lockd_init) {
|
||||
if (!lp->needs_lockd_init)
|
||||
/* needs_lock_init is set for LVs that need a lockd lock. */
|
||||
return 1;
|
||||
|
||||
} else if (seg_is_cache(lp) || seg_is_cache_pool(lp)) {
|
||||
if (seg_is_cache(lp) || seg_is_cache_pool(lp)) {
|
||||
log_error("Use lvconvert for cache with lock type %s", vg->lock_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else if (!seg_is_thin_volume(lp) && lp->snapshot) {
|
||||
if (!seg_is_thin_volume(lp) && lp->snapshot) {
|
||||
struct logical_volume *origin_lv;
|
||||
|
||||
/*
|
||||
@ -2363,8 +2364,9 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
|
||||
}
|
||||
lv->lock_args = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else if (seg_is_thin(lp)) {
|
||||
if (seg_is_thin(lp)) {
|
||||
if ((seg_is_thin_volume(lp) && !lp->create_pool) ||
|
||||
(!seg_is_thin_volume(lp) && lp->snapshot)) {
|
||||
struct lv_list *lvl;
|
||||
@ -2385,8 +2387,9 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
|
||||
}
|
||||
lv->lock_args = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
} else if (seg_is_thin_volume(lp) && lp->create_pool) {
|
||||
if (seg_is_thin_volume(lp) && lp->create_pool) {
|
||||
/*
|
||||
* Creating a thin pool and a thin lv in it. We could
|
||||
* probably make this work.
|
||||
@ -2394,21 +2397,21 @@ int lockd_init_lv(struct cmd_context *cmd, struct volume_group *vg, struct logic
|
||||
log_error("Create thin pool and thin LV separately with lock type %s",
|
||||
vg->lock_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else if (!seg_is_thin_volume(lp) && lp->create_pool) {
|
||||
if (!seg_is_thin_volume(lp) && lp->create_pool) {
|
||||
/* Creating a thin pool only. */
|
||||
/* lv_name_lock = lp->pool_name; */
|
||||
|
||||
} else {
|
||||
log_error("Unknown thin options for lock init.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
/* Creating a normal lv. */
|
||||
/* lv_name_lock = lv_name; */
|
||||
log_error("Unknown thin options for lock init.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Creating a normal lv. */
|
||||
/* lv_name_lock = lv_name; */
|
||||
|
||||
/*
|
||||
* The LV gets its own lock, so set lock_args to non-NULL.
|
||||
*
|
||||
|
@ -581,8 +581,8 @@ static char *_do_lv_origin_dup(struct dm_pool *mem, const struct logical_volume
|
||||
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, origin_lv);
|
||||
else
|
||||
return lv_name_dup(mem, origin_lv);
|
||||
|
||||
return lv_name_dup(mem, origin_lv);
|
||||
}
|
||||
|
||||
char *lv_origin_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
@ -650,6 +650,7 @@ char *lv_modules_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
|
||||
if (!list_lv_modules(mem, lv, modules))
|
||||
return_NULL;
|
||||
|
||||
return tags_format_and_copy(mem, modules);
|
||||
}
|
||||
|
||||
@ -675,8 +676,8 @@ static char *_do_lv_mirror_log_dup(struct dm_pool *mem, const struct logical_vol
|
||||
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, mirror_log_lv);
|
||||
else
|
||||
return lv_name_dup(mem, mirror_log_lv);
|
||||
|
||||
return lv_name_dup(mem, mirror_log_lv);
|
||||
}
|
||||
|
||||
char *lv_mirror_log_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
@ -708,8 +709,8 @@ static char *_do_lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume
|
||||
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, pool_lv);
|
||||
else
|
||||
return lv_name_dup(mem, pool_lv);
|
||||
|
||||
return lv_name_dup(mem, pool_lv);
|
||||
}
|
||||
|
||||
char *lv_pool_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
@ -741,8 +742,8 @@ static char *_do_lv_data_lv_dup(struct dm_pool *mem, const struct logical_volume
|
||||
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, data_lv);
|
||||
else
|
||||
return lv_name_dup(mem, data_lv);
|
||||
|
||||
return lv_name_dup(mem, data_lv);
|
||||
}
|
||||
|
||||
char *lv_data_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
@ -774,8 +775,8 @@ static char *_do_lv_metadata_lv_dup(struct dm_pool *mem, const struct logical_vo
|
||||
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, metadata_lv);
|
||||
else
|
||||
return lv_name_dup(mem, metadata_lv);
|
||||
|
||||
return lv_name_dup(mem, metadata_lv);
|
||||
}
|
||||
|
||||
char *lv_metadata_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
@ -792,7 +793,8 @@ const char *lv_layer(const struct logical_volume *lv)
|
||||
{
|
||||
if (lv_is_thin_pool(lv))
|
||||
return "tpool";
|
||||
else if (lv_is_origin(lv) || lv_is_external_origin(lv))
|
||||
|
||||
if (lv_is_origin(lv) || lv_is_external_origin(lv))
|
||||
return "real";
|
||||
|
||||
return NULL;
|
||||
@ -841,8 +843,8 @@ static char *_do_lv_convert_lv_dup(struct dm_pool *mem, const struct logical_vol
|
||||
|
||||
if (uuid)
|
||||
return lv_uuid_dup(mem, convert_lv);
|
||||
else
|
||||
return lv_name_dup(mem, convert_lv);
|
||||
|
||||
return lv_name_dup(mem, convert_lv);
|
||||
}
|
||||
|
||||
char *lv_convert_lv_dup(struct dm_pool *mem, const struct logical_volume *lv)
|
||||
@ -877,8 +879,8 @@ static char *_do_lv_move_pv_dup(struct dm_pool *mem, const struct logical_volume
|
||||
|
||||
if (uuid)
|
||||
return pv_uuid_dup(mem, pvseg->pv);
|
||||
else
|
||||
return pv_name_dup(mem, pvseg->pv);
|
||||
|
||||
return pv_name_dup(mem, pvseg->pv);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1104,12 +1106,8 @@ int lv_raid_healthy(const struct logical_volume *lv)
|
||||
if (!lv_raid_dev_health(raid_seg->lv, &raid_health))
|
||||
return_0;
|
||||
|
||||
if (lv_is_raid(lv)) {
|
||||
if (strchr(raid_health, 'D'))
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
if (lv_is_raid(lv))
|
||||
return (strchr(raid_health, 'D')) ? 0 : 1;
|
||||
|
||||
/* Find out which sub-LV this is. */
|
||||
for (s = 0; s < raid_seg->area_count; s++)
|
||||
|
@ -990,7 +990,8 @@ static uint32_t _raid_data_copies(struct lv_segment *seg)
|
||||
*/
|
||||
if (seg_is_raid10(seg))
|
||||
return 2;
|
||||
else if (seg_is_raid1(seg))
|
||||
|
||||
if (seg_is_raid1(seg))
|
||||
return seg->area_count;
|
||||
|
||||
return seg->segtype->parity_devs + 1;
|
||||
@ -1531,11 +1532,11 @@ int historical_glv_remove(struct generic_logical_volume *glv)
|
||||
log_error(INTERNAL_ERROR "historical_glv_remove: historical LV %s/-%s not found ",
|
||||
hlv->vg->name, hlv->name);
|
||||
return 0;
|
||||
} else {
|
||||
log_verbose("Historical LV %s/-%s already on removed list ",
|
||||
hlv->vg->name, hlv->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_verbose("Historical LV %s/-%s already on removed list ",
|
||||
hlv->vg->name, hlv->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((origin_glv = hlv->indirect_origin) &&
|
||||
@ -2057,7 +2058,7 @@ static int _comp_area(const void *l, const void *r)
|
||||
if (lhs->used < rhs->used)
|
||||
return 1;
|
||||
|
||||
else if (lhs->used > rhs->used)
|
||||
if (lhs->used > rhs->used)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
@ -5773,7 +5774,9 @@ struct logical_volume *lv_create_empty(const char *name,
|
||||
log_error("Failed to generate unique name for the new "
|
||||
"logical volume");
|
||||
return NULL;
|
||||
} else if (lv_name_is_used_in_vg(vg, name, &historical)) {
|
||||
}
|
||||
|
||||
if (lv_name_is_used_in_vg(vg, name, &historical)) {
|
||||
log_error("Unable to create LV %s in Volume Group %s: "
|
||||
"name already in use%s.", name, vg->name,
|
||||
historical ? " by historical LV" : "");
|
||||
@ -6000,7 +6003,9 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
log_error("Can't remove logical volume %s used by a pool.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
} else if (lv_is_thin_volume(lv)) {
|
||||
}
|
||||
|
||||
if (lv_is_thin_volume(lv)) {
|
||||
if (!(pool_lv = first_seg(lv)->pool_lv)) {
|
||||
log_error(INTERNAL_ERROR "Thin LV %s without pool.",
|
||||
display_lvname(lv));
|
||||
@ -6036,9 +6041,9 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
display_lvname(lv)) == 'n') {
|
||||
log_error("Logical volume %s not removed.", display_lvname(lv));
|
||||
return 0;
|
||||
} else {
|
||||
ask_discard = 0;
|
||||
}
|
||||
|
||||
ask_discard = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -6269,18 +6274,21 @@ int lv_remove_with_dependencies(struct cmd_context *cmd, struct logical_volume *
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((snap_percent != DM_PERCENT_INVALID) &&
|
||||
(snap_percent != LVM_PERCENT_MERGE_FAILED)) {
|
||||
log_error("Can't remove merging snapshot logical volume %s.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
} else if ((snap_percent == LVM_PERCENT_MERGE_FAILED) &&
|
||||
(force == PROMPT) &&
|
||||
yes_no_prompt("Removing snapshot %s that failed to merge "
|
||||
"may leave origin %s inconsistent. Proceed? [y/n]: ",
|
||||
display_lvname(lv),
|
||||
display_lvname(origin_from_cow(lv))) == 'n')
|
||||
goto no_remove;
|
||||
}
|
||||
|
||||
if ((snap_percent == LVM_PERCENT_MERGE_FAILED) &&
|
||||
(force == PROMPT) &&
|
||||
yes_no_prompt("Removing snapshot %s that failed to merge "
|
||||
"may leave origin %s inconsistent. Proceed? [y/n]: ",
|
||||
display_lvname(lv),
|
||||
display_lvname(origin_from_cow(lv))) == 'n')
|
||||
goto no_remove;
|
||||
}
|
||||
} else if (!level && lv_is_virtual_origin(origin = origin_from_cow(lv)))
|
||||
/* If this is a sparse device, remove its origin too. */
|
||||
|
@ -198,7 +198,9 @@ static int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
|
||||
log_error("Physical volume '%s' is already in volume group "
|
||||
"'%s'", pv_name, pv->vg_name);
|
||||
return 0;
|
||||
} else if (!new_pv) {
|
||||
}
|
||||
|
||||
if (!new_pv) {
|
||||
if ((used = is_used_pv(pv)) < 0)
|
||||
return_0;
|
||||
|
||||
@ -730,7 +732,9 @@ static int vg_extend_single_pv(struct volume_group *vg, char *pv_name,
|
||||
log_error("%s not identified as an existing "
|
||||
"physical volume", pv_name);
|
||||
return 0;
|
||||
} else if (!pv && pp) {
|
||||
}
|
||||
|
||||
if (!pv && pp) {
|
||||
if (!(pv = pvcreate_vol(vg->cmd, pv_name, pp, 0)))
|
||||
return_0;
|
||||
new_pv = 1;
|
||||
@ -5725,10 +5729,10 @@ static int _access_vg_lock_type(struct cmd_context *cmd, struct volume_group *vg
|
||||
log_error("Cannot access VG %s due to failed lock.", vg->name);
|
||||
*failure |= FAILED_LOCK_MODE;
|
||||
return 0;
|
||||
} else {
|
||||
log_warn("Reading VG %s without a lock.", vg->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_warn("Reading VG %s without a lock.", vg->name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (test_mode()) {
|
||||
|
@ -1532,8 +1532,8 @@ const char *get_pvmove_pvname_from_lv(const struct logical_volume *lv)
|
||||
|
||||
if (pvmove_lv)
|
||||
return get_pvmove_pvname_from_lv_mirr(pvmove_lv);
|
||||
else
|
||||
return NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct logical_volume *find_pvmove_lv(struct volume_group *vg,
|
||||
@ -2170,7 +2170,9 @@ int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return _add_mirrors_that_preserve_segments(lv, MIRROR_BY_SEG,
|
||||
mirrors, region_size,
|
||||
pvs, alloc);
|
||||
} else if (flags & MIRROR_BY_SEGMENTED_LV) {
|
||||
}
|
||||
|
||||
if (flags & MIRROR_BY_SEGMENTED_LV) {
|
||||
if (stripes > 1) {
|
||||
log_error("Striped-mirroring is not supported on "
|
||||
"segment-by-segment mirroring.");
|
||||
@ -2180,7 +2182,9 @@ int lv_add_mirrors(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
return _add_mirrors_that_preserve_segments(lv, MIRROR_BY_SEGMENTED_LV,
|
||||
mirrors, region_size,
|
||||
pvs, alloc);
|
||||
} else if (flags & MIRROR_BY_LV) {
|
||||
}
|
||||
|
||||
if (flags & MIRROR_BY_LV) {
|
||||
if (!mirrors)
|
||||
return add_mirror_log(cmd, lv, log_count,
|
||||
region_size, pvs, alloc);
|
||||
|
@ -358,10 +358,11 @@ static uint32_t _overlap_pe(const struct pv_segment *pvseg,
|
||||
|
||||
start = max(pvseg->pe, per->start);
|
||||
end = min(pvseg->pe + pvseg->len, per->start + per->count);
|
||||
|
||||
if (end < start)
|
||||
return 0;
|
||||
else
|
||||
return end - start;
|
||||
|
||||
return end - start;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -608,8 +609,8 @@ static int pv_resize(struct physical_volume *pv,
|
||||
|
||||
if (new_pe_count > old_pe_count)
|
||||
return _extend_pv(pv, vg, old_pe_count, new_pe_count);
|
||||
else
|
||||
return _reduce_pv(pv, vg, old_pe_count, new_pe_count);
|
||||
|
||||
return _reduce_pv(pv, vg, old_pe_count, new_pe_count);
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
@ -1251,10 +1251,13 @@ uint32_t lv_raid_data_copies(const struct segment_type *segtype, uint32_t area_c
|
||||
if (segtype_is_any_raid10(segtype))
|
||||
/* FIXME: change for variable number of data copies */
|
||||
return 2;
|
||||
else if (segtype_is_mirrored(segtype))
|
||||
|
||||
if (segtype_is_mirrored(segtype))
|
||||
return area_count;
|
||||
else if (segtype_is_striped_raid(segtype))
|
||||
|
||||
if (segtype_is_striped_raid(segtype))
|
||||
return segtype->parity_devs + 1;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -4807,8 +4810,8 @@ static int _raid0_meta_change_wrapper(struct logical_volume *lv,
|
||||
|
||||
if (alloc_metadata_devs)
|
||||
return _raid0_add_or_remove_metadata_lvs(lv, 1, allocate_pvs, NULL);
|
||||
else
|
||||
return _raid0_add_or_remove_metadata_lvs(lv, 1, allocate_pvs, &removal_lvs);
|
||||
|
||||
return _raid0_add_or_remove_metadata_lvs(lv, 1, allocate_pvs, &removal_lvs);
|
||||
}
|
||||
|
||||
static int _raid0_to_striped_wrapper(struct logical_volume *lv,
|
||||
@ -6040,8 +6043,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
|
||||
log_error("Convert %s LV %s to 2 images first.",
|
||||
lvseg_name(seg_from), display_lvname(seg_from->lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else if (segtype_is_striped(*segtype) ||
|
||||
if (segtype_is_striped(*segtype) ||
|
||||
segtype_is_any_raid0(*segtype) ||
|
||||
segtype_is_raid10(*segtype))
|
||||
seg_flag = SEG_RAID5_N;
|
||||
@ -6056,8 +6060,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
|
||||
log_error("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
|
||||
lvseg_name(seg_from), display_lvname(seg_from->lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else if (seg_is_raid4(seg_from) &&
|
||||
if (seg_is_raid4(seg_from) &&
|
||||
segtype_is_any_raid5(*segtype) &&
|
||||
!segtype_is_raid5_n(*segtype))
|
||||
seg_flag = SEG_RAID5_N;
|
||||
@ -6081,8 +6086,9 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
|
||||
log_error("Convert %s LV %s to minimum 4 stripes first (i.e. --stripes 3).",
|
||||
lvseg_name(seg_from), display_lvname(seg_from->lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else if (seg_is_raid4(seg_from) && !segtype_is_raid6_n_6(*segtype))
|
||||
if (seg_is_raid4(seg_from) && !segtype_is_raid6_n_6(*segtype))
|
||||
seg_flag = SEG_RAID6_N_6;
|
||||
else
|
||||
seg_flag = _raid_seg_flag_5_to_6(seg_from);
|
||||
@ -6118,12 +6124,12 @@ static int _set_convenient_raid145610_segtype_to(const struct lv_segment *seg_fr
|
||||
log_error("Convert %s LV %s to raid4/raid5 first.",
|
||||
lvseg_name(seg_from), display_lvname(seg_from->lv));
|
||||
return 0;
|
||||
}
|
||||
|
||||
} else if (seg_from->area_count != 2) {
|
||||
if (seg_from->area_count != 2) {
|
||||
log_error("Convert %s LV %s to 2 stripes first (i.e. --stripes 1).",
|
||||
lvseg_name(seg_from), display_lvname(seg_from->lv));
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
/* raid10 -> ... */
|
||||
@ -6352,7 +6358,9 @@ int lv_raid_convert(struct logical_volume *lv,
|
||||
log_error("%s must be active to perform this operation.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
} else if (vg_is_clustered(lv->vg) &&
|
||||
}
|
||||
|
||||
if (vg_is_clustered(lv->vg) &&
|
||||
!lv_is_active_exclusive_locally(lv_lock_holder(lv))) {
|
||||
/* In clustered VGs, the LV must be active on this node exclusively. */
|
||||
log_error("%s must be active exclusive locally to "
|
||||
@ -6710,17 +6718,23 @@ static int _lv_raid_rebuild_or_replace(struct logical_volume *lv,
|
||||
log_print_unless_silent("%s does not contain devices specified to %s.",
|
||||
display_lvname(lv), action_str);
|
||||
return 1;
|
||||
} else if (match_count == raid_seg->area_count) {
|
||||
}
|
||||
|
||||
if (match_count == raid_seg->area_count) {
|
||||
log_error("Unable to %s all PVs from %s at once.",
|
||||
action_str, display_lvname(lv));
|
||||
return 0;
|
||||
} else if (raid_seg->segtype->parity_devs &&
|
||||
(match_count > raid_seg->segtype->parity_devs)) {
|
||||
}
|
||||
|
||||
if (raid_seg->segtype->parity_devs &&
|
||||
(match_count > raid_seg->segtype->parity_devs)) {
|
||||
log_error("Unable to %s more than %u PVs from (%s) %s.",
|
||||
action_str, raid_seg->segtype->parity_devs,
|
||||
lvseg_name(raid_seg), display_lvname(lv));
|
||||
return 0;
|
||||
} else if (seg_is_raid10(raid_seg)) {
|
||||
}
|
||||
|
||||
if (seg_is_raid10(raid_seg)) {
|
||||
uint32_t i, rebuilds_per_group = 0;
|
||||
/* FIXME: We only support 2-way mirrors (i.e. 2 data copies) in RAID10 currently */
|
||||
uint32_t copies = 2;
|
||||
@ -7039,8 +7053,10 @@ static int _partial_raid_lv_is_redundant(const struct logical_volume *lv)
|
||||
log_verbose("All components of raid LV %s have failed.",
|
||||
display_lvname(lv));
|
||||
return 0; /* Insufficient redundancy to activate */
|
||||
} else if (raid_seg->segtype->parity_devs &&
|
||||
(failed_components > raid_seg->segtype->parity_devs)) {
|
||||
}
|
||||
|
||||
if (raid_seg->segtype->parity_devs &&
|
||||
(failed_components > raid_seg->segtype->parity_devs)) {
|
||||
log_verbose("More than %u components from %s %s have failed.",
|
||||
raid_seg->segtype->parity_devs,
|
||||
lvseg_name(raid_seg),
|
||||
|
@ -627,7 +627,9 @@ static int _replicator_dev_add_target_line(struct dev_manager *dm,
|
||||
if (!(rdev_dlid = build_dm_uuid(mem, seg->lv->rdevice->lv, NULL)))
|
||||
return_0;
|
||||
return dm_tree_node_add_target_area(node, NULL, rdev_dlid, 0);
|
||||
} else if (seg->lv->rdevice->rsite->site_index) {
|
||||
}
|
||||
|
||||
if (seg->lv->rdevice->rsite->site_index) {
|
||||
log_error("Active site with site_index != 0 (%s, %d)",
|
||||
seg->lv->rdevice->rsite->name,
|
||||
seg->lv->rdevice->rsite->site_index);
|
||||
|
@ -732,7 +732,9 @@ static int _check_time_items(struct time_info *info)
|
||||
if (label_date) {
|
||||
log_error("Ambiguous date specification found at \"%s\".", ti->s);
|
||||
return 0;
|
||||
} else if (_is_time_label_date(ti->prop->id))
|
||||
}
|
||||
|
||||
if (_is_time_label_date(ti->prop->id))
|
||||
label_date = 1;
|
||||
}
|
||||
|
||||
@ -749,7 +751,9 @@ static int _check_time_items(struct time_info *info)
|
||||
if (label_time) {
|
||||
log_error("Ambiguous time specification found at \"%s\".", ti->s);
|
||||
return 0;
|
||||
} else if (_is_time_label_time(ti->prop->id))
|
||||
}
|
||||
|
||||
if (_is_time_label_time(ti->prop->id))
|
||||
label_time = 1;
|
||||
}
|
||||
}
|
||||
@ -1251,9 +1255,9 @@ static int _binary_disp(struct dm_report *rh, struct dm_pool *mem __attribute__(
|
||||
if (cmd->report_binary_values_as_numeric)
|
||||
/* "0"/"1" */
|
||||
return _field_set_value(field, bin_value ? _str_one : _str_zero, bin_value ? &_one64 : &_zero64);
|
||||
else
|
||||
/* blank/"word" */
|
||||
return _field_set_value(field, bin_value ? word : "", bin_value ? &_one64 : &_zero64);
|
||||
|
||||
/* blank/"word" */
|
||||
return _field_set_value(field, bin_value ? word : "", bin_value ? &_one64 : &_zero64);
|
||||
}
|
||||
|
||||
static int _binary_undef_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -1263,8 +1267,8 @@ static int _binary_undef_disp(struct dm_report *rh, struct dm_pool *mem __attrib
|
||||
|
||||
if (cmd->report_binary_values_as_numeric)
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(num_undef_64), &GET_TYPE_RESERVED_VALUE(num_undef_64));
|
||||
else
|
||||
return _field_set_value(field, _str_unknown, &GET_TYPE_RESERVED_VALUE(num_undef_64));
|
||||
|
||||
return _field_set_value(field, _str_unknown, &GET_TYPE_RESERVED_VALUE(num_undef_64));
|
||||
}
|
||||
|
||||
static int _string_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -1772,8 +1776,8 @@ static int _do_loglv_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &mirror_log_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, mirror_log_lv, private);
|
||||
|
||||
return _lvname_disp(rh, mem, field, mirror_log_lv, private);
|
||||
}
|
||||
|
||||
static int _loglv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -1829,8 +1833,8 @@ static int _do_datalv_disp(struct dm_report *rh, struct dm_pool *mem __attribute
|
||||
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &data_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, data_lv, private);
|
||||
|
||||
return _lvname_disp(rh, mem, field, data_lv, private);
|
||||
}
|
||||
|
||||
static int _datalv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -1860,8 +1864,8 @@ static int _do_metadatalv_disp(struct dm_report *rh, struct dm_pool *mem __attri
|
||||
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &metadata_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, metadata_lv, private);
|
||||
|
||||
return _lvname_disp(rh, mem, field, metadata_lv, private);
|
||||
}
|
||||
|
||||
static int _metadatalv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -1891,8 +1895,8 @@ static int _do_poollv_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &pool_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, pool_lv, private);
|
||||
|
||||
return _lvname_disp(rh, mem, field, pool_lv, private);
|
||||
}
|
||||
|
||||
static int _poollv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -1948,8 +1952,8 @@ static int _do_origin_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &origin_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, origin_lv, private);
|
||||
|
||||
return _lvname_disp(rh, mem, field, origin_lv, private);
|
||||
}
|
||||
|
||||
static int _origin_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
@ -2241,8 +2245,8 @@ static int _do_convertlv_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
|
||||
if (uuid)
|
||||
return _uuid_disp(rh, mem, field, &convert_lv->lvid.id[1], private);
|
||||
else
|
||||
return _lvname_disp(rh, mem, field, convert_lv, private);
|
||||
|
||||
return _lvname_disp(rh, mem, field, convert_lv, private);
|
||||
}
|
||||
|
||||
static int _convertlv_disp(struct dm_report *rh, struct dm_pool *mem __attribute__((unused)),
|
||||
@ -2361,9 +2365,9 @@ static int _lvwhenfull_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
if (lv->status & LV_ERROR_WHEN_FULL)
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(lv_when_full_error),
|
||||
GET_FIELD_RESERVED_VALUE(lv_when_full_error));
|
||||
else
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(lv_when_full_queue),
|
||||
GET_FIELD_RESERVED_VALUE(lv_when_full_queue));
|
||||
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(lv_when_full_queue),
|
||||
GET_FIELD_RESERVED_VALUE(lv_when_full_queue));
|
||||
}
|
||||
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(lv_when_full_undef),
|
||||
@ -3584,8 +3588,8 @@ static int _lvactiveremotely_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
*/
|
||||
if (lv_is_active_locally(lv))
|
||||
return _binary_undef_disp(rh, mem, field, private);
|
||||
else
|
||||
active_remotely = lv_is_active_but_not_locally(lv);
|
||||
|
||||
active_remotely = lv_is_active_but_not_locally(lv);
|
||||
} else
|
||||
active_remotely = 0;
|
||||
|
||||
@ -3725,7 +3729,7 @@ static int _lvhealthstatus_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
if (lvdm->seg_status.type != SEG_STATUS_CACHE)
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(health_undef),
|
||||
GET_FIELD_RESERVED_VALUE(health_undef));
|
||||
else if (lvdm->seg_status.cache->fail)
|
||||
if (lvdm->seg_status.cache->fail)
|
||||
health = "failed";
|
||||
else if (lvdm->seg_status.cache->read_only)
|
||||
health = "metadata_read_only";
|
||||
@ -3733,7 +3737,7 @@ static int _lvhealthstatus_disp(struct dm_report *rh, struct dm_pool *mem,
|
||||
if (lvdm->seg_status.type != SEG_STATUS_THIN_POOL)
|
||||
return _field_set_value(field, GET_FIRST_RESERVED_NAME(health_undef),
|
||||
GET_FIELD_RESERVED_VALUE(health_undef));
|
||||
else if (lvdm->seg_status.thin_pool->fail)
|
||||
if (lvdm->seg_status.thin_pool->fail)
|
||||
health = "failed";
|
||||
else if (lvdm->seg_status.thin_pool->out_of_data_space)
|
||||
health = "out_of_data";
|
||||
|
@ -208,8 +208,9 @@ static int _get_proc_number(const char *file, const char *name,
|
||||
if (require_module_loaded) {
|
||||
log_error("%s: No entry for %s found", file, name);
|
||||
return 0;
|
||||
} else
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -368,11 +369,11 @@ int dm_is_dm_major(uint32_t major)
|
||||
return 0;
|
||||
return dm_bit(_dm_bitset, major) ? 1 : 0;
|
||||
}
|
||||
else {
|
||||
if (!_dm_device_major)
|
||||
return 0;
|
||||
return (major == _dm_device_major) ? 1 : 0;
|
||||
}
|
||||
|
||||
if (!_dm_device_major)
|
||||
return 0;
|
||||
|
||||
return (major == _dm_device_major) ? 1 : 0;
|
||||
}
|
||||
|
||||
static void _close_control_fd(void)
|
||||
@ -1704,7 +1705,9 @@ static int _do_dm_ioctl_unmangle_string(char *str, const char *str_name,
|
||||
log_debug_activation("_do_dm_ioctl_unmangle_string: failed to "
|
||||
"unmangle %s \"%s\"", str_name, str);
|
||||
return 0;
|
||||
} else if (r)
|
||||
}
|
||||
|
||||
if (r)
|
||||
memcpy(str, buf, strlen(buf) + 1);
|
||||
|
||||
return 1;
|
||||
|
@ -1137,13 +1137,12 @@ static int _rename_dev_node(const char *old_name, const char *new_name,
|
||||
errno == ENOENT)
|
||||
/* assume udev already deleted this */
|
||||
return 1;
|
||||
else {
|
||||
log_warn("The node %s should have been renamed to %s "
|
||||
"by udev but old node is still present. "
|
||||
"Falling back to direct old node removal.",
|
||||
oldpath, newpath);
|
||||
return _rm_dev_node(old_name, 0);
|
||||
}
|
||||
|
||||
log_warn("The node %s should have been renamed to %s "
|
||||
"by udev but old node is still present. "
|
||||
"Falling back to direct old node removal.",
|
||||
oldpath, newpath);
|
||||
return _rm_dev_node(old_name, 0);
|
||||
}
|
||||
|
||||
if (unlink(newpath) < 0) {
|
||||
|
@ -1013,16 +1013,18 @@ static int _field_match(struct dm_report *rh, const char *field, size_t flen,
|
||||
rh->report_types |= implicit ? _implicit_report_fields[f].type
|
||||
: rh->fields[f].type;
|
||||
return 1;
|
||||
} else
|
||||
return _add_field(rh, f, implicit, 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
return _add_field(rh, f, implicit, 0) ? 1 : 0;
|
||||
}
|
||||
|
||||
if ((type = _all_match(rh, field, flen |