1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pre-release review cleanups

This commit is contained in:
Alasdair Kergon 2008-01-17 17:17:09 +00:00
parent cea51b32fc
commit 0c06de632a
8 changed files with 37 additions and 50 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.30 - 17th January 2008
===================================
Set default readahead to twice maximium stripe size.
Reinstate VG extent size and stripe size defaults (halved). (2.02.29)
Add lists of stacked LV segments using each LV to the internal metadata.
Change vgsplit -l (for unimplemented --list) into --maxlogicalvolumes.

View File

@ -706,10 +706,9 @@ int monitor_dev_for_events(struct cmd_context *cmd,
*/
if (lv_is_origin(lv)) {
list_iterate_safe(snh, snht, &lv->snapshot_segs)
if (!monitor_dev_for_events(
cmd, list_struct_base(snh,
struct lv_segment, origin_list)->cow, monitor))
r=0;
if (!monitor_dev_for_events(cmd, list_struct_base(snh,
struct lv_segment, origin_list)->cow, monitor))
r = 0;
return r;
}

View File

@ -31,7 +31,8 @@ struct lv_names {
const char *new;
};
int add_seg_to_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *seg)
int add_seg_to_segs_using_this_lv(struct logical_volume *lv,
struct lv_segment *seg)
{
struct seg_list *sl;
@ -54,7 +55,8 @@ int add_seg_to_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *
return 1;
}
int remove_seg_from_segs_using_this_lv(struct logical_volume *lv, struct lv_segment *seg)
int remove_seg_from_segs_using_this_lv(struct logical_volume *lv,
struct lv_segment *seg)
{
struct seg_list *sl;
@ -1429,7 +1431,7 @@ int lv_add_mirror_areas(struct alloc_handle *ah,
if (!seg_is_mirrored(seg) &&
(!(seg = _convert_seg_to_mirror(seg, region_size, NULL))))
return_0;
return_0;
old_area_count = seg->area_count;
new_area_count = old_area_count + ah->area_count;
@ -1530,20 +1532,16 @@ int lv_add_log_segment(struct alloc_handle *ah, struct logical_volume *log_lv)
return 0;
}
if (!set_lv_segment_area_pv(seg, 0, ah->log_area.pv, ah->log_area.pe)) {
stack;
return 0;
}
if (!set_lv_segment_area_pv(seg, 0, ah->log_area.pv, ah->log_area.pe))
return_0;
list_add(&log_lv->segments, &seg->list);
log_lv->le_count += ah->log_area.len;
log_lv->size += (uint64_t) log_lv->le_count *log_lv->vg->extent_size;
log_lv->size += (uint64_t) log_lv->le_count * log_lv->vg->extent_size;
if (log_lv->vg->fid->fmt->ops->lv_setup &&
!log_lv->vg->fid->fmt->ops->lv_setup(log_lv->vg->fid, log_lv)) {
stack;
return 0;
}
!log_lv->vg->fid->fmt->ops->lv_setup(log_lv->vg->fid, log_lv))
return_0;
return 1;
}
@ -1668,7 +1666,7 @@ static int _rename_sub_lv(struct cmd_context *cmd,
}
suffix = lv->name + len;
/*
/*
* Compose a new name for sub lv:
* e.g. new name is "lvol1_mlog"
* if the sub LV is "lvol0_mlog" and
@ -2025,9 +2023,9 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
if (yes_no_prompt("Do you really want to remove active "
"logical volume \"%s\"? [y/n]: ",
lv->name) == 'n') {
log_print("Logical volume \"%s\" not removed",
log_print("Logical volume \"%s\" not removed",
lv->name);
return 0;
return 0;
}
}
}
@ -2264,7 +2262,7 @@ int remove_layers_for_segments_all(struct cmd_context *cmd,
if (!remove_layers_for_segments(cmd, lv1, layer_lv,
status_mask, lvs_changed))
return 0;
return_0;
}
if (!lv_empty(layer_lv))
@ -2627,7 +2625,7 @@ int set_lv(struct cmd_context *cmd, struct logical_volume *lv,
}
if (dm_snprintf(name, PATH_MAX, "%s%s/%s", cmd->dev_dir,
lv->vg->name, lv->name) < 0) {
lv->vg->name, lv->name) < 0) {
log_error("Name too long - device not cleared (%s)", lv->name);
return 0;
}
@ -2640,7 +2638,7 @@ int set_lv(struct cmd_context *cmd, struct logical_volume *lv,
}
if (!dev_open_quiet(dev))
return 0;
return_0;
dev_set(dev, UINT64_C(0),
sectors ? (size_t) sectors << SECTOR_SHIFT : (size_t) 4096,
@ -2650,5 +2648,3 @@ int set_lv(struct cmd_context *cmd, struct logical_volume *lv,
return 1;
}

View File

@ -94,7 +94,7 @@ struct pv_segment;
/* Mirror conversion type flags */
#define MIRROR_BY_SEG 0x00000001U /* segment-by-segment mirror */
#define MIRROR_BY_LV 0x00000002U /* mirror by mimage LVs */
#define MIRROR_BY_LV 0x00000002U /* mirror using whole mimage LVs */
/* Ordered list - see lv_manip.c */
typedef enum {

View File

@ -233,7 +233,7 @@ static int validate_new_vg_name(struct cmd_context *cmd, const char *vg_name)
char vg_path[PATH_MAX];
if (!validate_name(vg_name))
return 0;
return_0;
snprintf(vg_path, PATH_MAX, "%s%s", cmd->dev_dir, vg_name);
if (path_exists(vg_path)) {
@ -244,7 +244,6 @@ static int validate_new_vg_name(struct cmd_context *cmd, const char *vg_name)
return 1;
}
int validate_vg_rename_params(struct cmd_context *cmd,
const char *vg_name_old,
const char *vg_name_new)
@ -1084,7 +1083,6 @@ int vg_remove(struct volume_group *vg)
return 1;
}
/*
* Determine whether two vgs are compatible for merging.
*/
@ -1094,11 +1092,12 @@ int vgs_are_compatible(struct cmd_context *cmd,
{
struct lv_list *lvl1, *lvl2;
struct pv_list *pvl;
char *name1, *name2;
if (lvs_in_vg_activated(vg_from)) {
log_error("Logical volumes in \"%s\" must be inactive",
vg_from->name);
goto error;
return 0;
}
/* Check compatibility */
@ -1106,7 +1105,7 @@ int vgs_are_compatible(struct cmd_context *cmd,
log_error("Extent sizes differ: %d (%s) and %d (%s)",
vg_to->extent_size, vg_to->name,
vg_from->extent_size, vg_from->name);
goto error;
return 0;
}
if (vg_to->max_pv &&
@ -1114,7 +1113,7 @@ int vgs_are_compatible(struct cmd_context *cmd,
log_error("Maximum number of physical volumes (%d) exceeded "
" for \"%s\" and \"%s\"", vg_to->max_pv, vg_to->name,
vg_from->name);
goto error;
return 0;
}
if (vg_to->max_lv &&
@ -1122,22 +1121,22 @@ int vgs_are_compatible(struct cmd_context *cmd,
log_error("Maximum number of logical volumes (%d) exceeded "
" for \"%s\" and \"%s\"", vg_to->max_lv, vg_to->name,
vg_from->name);
goto error;
return 0;
}
/* Check no conflicts with LV names */
list_iterate_items(lvl1, &vg_to->lvs) {
char *name1 = lvl1->lv->name;
name1 = lvl1->lv->name;
list_iterate_items(lvl2, &vg_from->lvs) {
char *name2 = lvl2->lv->name;
name2 = lvl2->lv->name;
if (!strcmp(name1, name2)) {
log_error("Duplicate logical volume "
"name \"%s\" "
"in \"%s\" and \"%s\"",
name1, vg_to->name, vg_from->name);
goto error;
return 0;
}
}
}
@ -1148,7 +1147,7 @@ int vgs_are_compatible(struct cmd_context *cmd,
log_error("Physical volume %s might be constructed "
"from same volume group %s.",
pv_dev_name(pvl->pv), vg_from->name);
goto error;
return 0;
}
}
@ -1157,18 +1156,13 @@ int vgs_are_compatible(struct cmd_context *cmd,
log_error("Physical volume %s might be constructed "
"from same volume group %s.",
pv_dev_name(pvl->pv), vg_to->name);
goto error;
return 0;
}
}
return 1;
error:
return 0;
}
int vg_validate(struct volume_group *vg)
{
struct pv_list *pvl, *pvl2;

View File

@ -1485,10 +1485,9 @@ int lv_remove_mirrors(struct cmd_context *cmd __attribute((unused)),
/* MIRROR_BY_LV */
if (seg_type(seg, 0) == AREA_LV &&
seg_lv(seg, 0)->status & MIRROR_IMAGE) {
seg_lv(seg, 0)->status & MIRROR_IMAGE)
return remove_mirror_images(lv, new_mirrors + 1,
pvs, log_count ? 1U : 0);
}
/* MIRROR_BY_SEG */
if (log_count) {

View File

@ -283,8 +283,10 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
mirr_state = *target_state;
/* Mirror segment could have only 1 area temporarily,
* if the segment is under conversion. */
/*
* Mirror segment could have only 1 area temporarily
* if the segment is under conversion.
*/
if (seg->area_count == 1)
mirror_status = MIRR_DISABLED;

View File

@ -20,10 +20,6 @@
#include <sys/stat.h>
#include <sys/wait.h>
/* From linux/drivers/md/dm-log.c */
#define MIRROR_MAGIC 0x4D695272
#define MIRROR_DISK_VERSION 2
/* Command line args */
unsigned arg_count(const struct cmd_context *cmd, int a)
{