Reduce double backtracing.
if (!seg->integrity_data_sectors) {
log_error("_integrity_add_target_line zero size");
- return_0;
+ return 0;
}
if (!dm_tree_node_add_integrity_target(node, seg->integrity_data_sectors,
if (lbs_4k && lbs_512) {
log_error("Integrity requires consistent logical block size for LV devices.");
- goto_bad;
+ goto bad;
}
if (settings->block_size &&
(settings->block_size != 512 && settings->block_size != 1024 &&
settings->block_size != 2048 && settings->block_size != 4096)) {
log_error("Invalid integrity block size, possible values are 512, 1024, 2048, 4096");
- goto_bad;
+ goto bad;
}
if (lbs_4k && settings->block_size && (settings->block_size < 4096)) {
log_error("Integrity block size %u not allowed with device logical block size 4096.",
settings->block_size);
- goto_bad;
+ goto bad;
}
if (!strcmp(cmd->name, "lvcreate")) {
if (dm_snprintf(pathname, sizeof(pathname), "%s%s/%s", cmd->dev_dir,
lv->vg->name, lv->name) < 0) {
log_error("Path name too long to get LV block size %s", display_lvname(lv));
- goto_bad;
+ goto bad;
}
if (!(fs_dev = dev_cache_get(cmd, pathname, NULL))) {
log_error("Device for LV not found to check block size %s", display_lvname(lv));
- goto_bad;
+ goto bad;
}
/*
if (settings->block_size > fs_block_size) {
log_error("Integrity block size %u cannot be larger than file system block size %u.",
settings->block_size, fs_block_size);
- goto_bad;
+ goto bad;
}
log_print("Using integrity block size %u for file system block size %u.",
settings->block_size, fs_block_size);
if (!seg_is_striped(first_seg(lv_image))) {
log_error("raid image must be linear to add integrity");
- goto_bad;
+ goto bad;
}
/*
if (!get_pv_list_for_lv(cmd->mem, lv_image, &allocatable_pvs)) {
log_error("Failed to build list of PVs for %s.", display_lvname(lv_image));
- goto_bad;
+ goto bad;
}
dm_list_iterate_items(pvl, &allocatable_pvs) {
if (!activate_lv(cmd, meta_lv)) {
log_error("Failed to activate LV %s to zero", display_lvname(meta_lv));
- goto_bad;
+ goto bad;
}
if (!wipe_lv(meta_lv, wipe)) {
log_error("Failed to zero LV for integrity metadata %s", display_lvname(meta_lv));
if (deactivate_lv(cmd, meta_lv))
log_error("Failed to deactivate LV %s after zero", display_lvname(meta_lv));
- goto_bad;
+ goto bad;
}
if (!deactivate_lv(cmd, meta_lv)) {
log_error("Failed to deactivate LV %s after zero", display_lvname(meta_lv));
- goto_bad;
+ goto bad;
}
}
/* vg_write(), suspend_lv(), vg_commit(), resume_lv() */
if (!lv_update_and_reload(lv)) {
log_error("LV update and reload failed");
- goto_bad;
+ goto bad;
}
revert_meta_lvs = 0;
if (!activate_lv(cmd, lv)) {
log_error("Failed to activate integrity LV to initialize.");
- goto_bad;
+ goto bad;
}
}
if (!(newareas = dm_pool_zalloc(seg->lv->vg->vgmem, areas_sz))) {
log_error("Failed to allocate widened LV segment for %s.",
display_lvname(seg->lv));
- return_0;
+ return 0;
}
if (seg->area_count)
if (!(lv_imeta = seg_image->integrity_meta_dev)) {
log_error("1");
- return_0;
+ return 0;
}
if (!(lv_iorig = seg_lv(seg_image, 0))) {
log_error("2");
- return_0;
+ return 0;
}
/* new size in sectors */
}
if (!(vhash.historical_lvname = dm_hash_create(dm_list_size(&vg->historical_lvs)))) {
- log_error("Failed to allocate historical LV name hash");
r = 0;
- goto out;
+ goto_out;
}
if (!(vhash.historical_lvid = dm_hash_create(dm_list_size(&vg->historical_lvs)))) {
- log_error("Failed to allocate historical LV uuid hash");
r = 0;
- goto out;
+ goto_out;
}
dm_list_iterate_items(glvl, &vg->historical_lvs) {
}
if (!mda->ops->vg_write) {
- log_error("Format does not support writing volume"
- "group metadata areas");
+ log_error("Format does not support writing volume group metadata areas.");
revert = 1;
break;
}
return_NULL;
}
- if (dm_list_empty(r))
+ if (dm_list_empty(r)) {
log_error("No specified PVs have space available.");
+ return NULL;
+ }
- return dm_list_empty(r) ? NULL : r;
+ return r;
}
struct dm_list *clone_pv_list(struct dm_pool *mem, struct dm_list *pvsl)
dm_list_init(r);
dm_list_iterate_items(pvl, pvsl) {
- if (!(new_pvl = dm_pool_zalloc(mem, sizeof(*new_pvl)))) {
+ if (!(new_pvl = dm_pool_alloc(mem, sizeof(*new_pvl)))) {
log_error("Unable to allocate physical volume list.");
return NULL;
}
if (!lv_raid_dev_count(lv, kernel_devs)) {
log_error("Failed to get device count.");
- return_0;
+ return 0;
}
if (!lv_raid_dev_health(lv, &rh)) {
log_error("Failed to get device health.");
- return_0;
+ return 0;
}
d = (unsigned) strlen(rh);
if (!(lvl_array = dm_pool_alloc(lv->vg->vgmem,
sizeof(*lvl_array) * count * 2))) {
log_error("Memory allocation failed.");
- return_0;
+ return 0;
}
if (!(parallel_areas = build_parallel_areas_from_lv(lv, 0, 1)))
if (!vg_write(vg)) {
log_error("Write of VG %s failed.", vg->name);
- return_0;
+ return 0;
}
if (!(r = (origin_only ? suspend_lv_origin(vg->cmd, lock_lv) :
if (lv_raid_has_integrity(lv) && !strcmp(msg, "repair")) {
log_error("Use syncaction check to detect and correct integrity checksum mismatches.");
- return_ECMD_FAILED;
+ return ECMD_FAILED;
}
/* If LV is inactive here, ensure it's not active elsewhere. */
continue;
if (!(tmp_str = grouped_arg_str_value(group->arg_values, replace_ARG, NULL))) {
log_error("Failed to get '--replace' argument");
- return_ECMD_FAILED;
+ return ECMD_FAILED;
}
if (!(replace_pvs[i++] = dm_pool_strdup(cmd->mem, tmp_str)))
return_ECMD_FAILED;
if (!(vglv = dm_pool_alloc(cmd->mem, vglv_sz)) ||
dm_snprintf(vglv, vglv_sz, "%s/%s", vgname, lvname2_orig) < 0) {
log_error("vg/lv string alloc failed.");
- return_ECMD_FAILED;
+ return ECMD_FAILED;
}
/* vglv is now vgname/lvname2 and replaces lvname2_orig */
if (!get_pv_list_for_lv(cmd->mem, lv, &pvs_list)) {
log_error("Failed to build list of PVs for %s.", display_lvname(lv));
- goto_bad;
+ goto bad;
}
dm_list_iterate_items(pvl, &pvs_list) {
if (lbs_4k && lbs_512) {
log_error("Writecache requires consistent logical block size for LV devices.");
- goto_bad;
+ goto bad;
}
if (lbs_4k && block_size_setting && (block_size_setting < 4096)) {
log_error("Writecache block size %u not allowed with device logical block size 4096.",
block_size_setting);
- goto_bad;
+ goto bad;
}
if (dm_snprintf(pathname, sizeof(pathname), "%s/%s/%s", cmd->dev_dir,
lv->vg->name, lv->name) < 0) {
log_error("Path name too long to get LV block size %s", display_lvname(lv));
- goto_bad;
+ goto bad;
}
if (!sync_local_dev_names(cmd))
goto skip_fs;
}
log_error("Device for LV not found to check block size %s", pathname);
- goto_bad;
+ goto bad;
}
/*
else {
log_error("Writecache block size %u cannot be larger than file system block size %u.",
block_size_setting, fs_block_size);
- goto_bad;
+ goto bad;
}
}
*/
if (!(dev = dev_cache_get(cmd, devname, NULL))) {
log_error("No device found for %s.", devname);
- goto_bad;
+ goto bad;
}
/*
if (!(du = get_du_for_pvid(cmd, pvid))) {
log_error("PVID not found in devices file.");
- goto_bad;
+ goto bad;
}
dm_list_del(&du->list);
if ((du2 = get_du_for_pvid(cmd, pvid))) {
log_error("Multiple devices file entries for PVID %s (%s %s), remove by device name.",
pvid, du->devname, du2->devname);
- goto_bad;
+ goto bad;
}
if (du->devname && (du->devname[0] != '.')) {
log_print("Override defaults with --settings \"mda_offset=<bytes> mda_size=<bytes>\"");
} else {
log_error("No mda location.");
- return_0;
+ return 0;
}
search:
if (!setup_devices(cmd)) {
log_error("Failed to set up devices.");
- return_0;
+ return 0;
}
/*
*/
if (!(info = lvmcache_info_from_pvid(devl->dev->pvid, NULL, 0))) {
log_error(INTERNAL_ERROR "No info for pvid");
- return_ECMD_FAILED;
+ return ECMD_FAILED;
}
vgname = lvmcache_vgname_from_info(info);
*/
if (must_use_all && !dm_list_empty(&pp->arg_fail)) {
log_error("Command requires all devices to be found.");
- return_0;
+ return 0;
}
/*