1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Add --nosync to lvcreate with LV flag NOTSYNCED.

This commit is contained in:
Alasdair Kergon 2006-05-11 20:03:40 +00:00
parent 5240aad22b
commit b69ba36c2d
7 changed files with 31 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.06 -
=================================
Add --nosync to lvcreate with LV flag NOTSYNCED.
Use mirror's uuid for a core log.
Add mirror log fault-handling policy.
Improve mirror warning messages and tidy dmeventd syslog output.

View File

@ -53,6 +53,7 @@ static struct flag _lv_flags[] = {
{VISIBLE_LV, "VISIBLE"},
{PVMOVE, "PVMOVE"},
{LOCKED, "LOCKED"},
{MIRROR_NOTSYNCED, "NOTSYNCED"},
{MIRROR_IMAGE, NULL},
{MIRROR_LOG, NULL},
{MIRRORED, NULL},

View File

@ -58,8 +58,9 @@
#define VIRTUAL 0x00010000U /* LV - internal use only */
#define MIRROR_LOG 0x00020000U /* LV */
#define MIRROR_IMAGE 0x00040000U /* LV */
#define ACTIVATE_EXCL 0x00080000U /* LV - internal use only */
#define PRECOMMITTED 0x00100000U /* VG - internal use only */
#define MIRROR_NOTSYNCED 0x00080000U /* LV */
#define ACTIVATE_EXCL 0x00100000U /* LV - internal use only */
#define PRECOMMITTED 0x00200000U /* VG - internal use only */
#define LVM_READ 0x00000100U /* LV VG */
#define LVM_WRITE 0x00000200U /* LV VG */

View File

@ -115,7 +115,7 @@ xx(lvcreate,
"\t{-l|--extents LogicalExtentsNumber |\n"
"\t -L|--size LogicalVolumeSize[kKmMgGtT]}\n"
"\t[-M|--persistent {y|n}] [--major major] [--minor minor]\n"
"\t[-m|--mirrors Mirrors [--corelog]]\n"
"\t[-m|--mirrors Mirrors [--nosync] [--corelog]]\n"
"\t[-n|--name LogicalVolumeName]\n"
"\t[-p|--permission {r|rw}]\n"
"\t[-r|--readahead ReadAheadSectors]\n"
@ -149,8 +149,9 @@ xx(lvcreate,
addtag_ARG, alloc_ARG, autobackup_ARG, chunksize_ARG, contiguous_ARG,
corelog_ARG, extents_ARG, major_ARG, minor_ARG, mirrors_ARG, name_ARG,
permission_ARG, persistent_ARG, readahead_ARG, regionsize_ARG, size_ARG,
snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, type_ARG, zero_ARG)
nosync_ARG, permission_ARG, persistent_ARG, readahead_ARG, regionsize_ARG,
size_ARG, snapshot_ARG, stripes_ARG, stripesize_ARG, test_ARG, type_ARG,
zero_ARG)
xx(lvdisplay,
"Display information about a logical volume",

View File

@ -308,6 +308,8 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
if (sync_percent >= 100.0)
init_mirror_in_sync(1);
else
init_mirror_in_sync(0);
if (!(log_lv = create_mirror_log(cmd, lv->vg, ah,
lp->alloc, lv->name,
@ -328,6 +330,8 @@ static int lvconvert_mirrors(struct cmd_context * cmd, struct logical_volume * l
if (sync_percent >= 100.0)
init_mirror_in_sync(1);
else
init_mirror_in_sync(0);
if (!remove_mirror_images(seg, lp->mirrors,
lp->pv_count ?

View File

@ -25,6 +25,7 @@ struct lvcreate_params {
int major;
int minor;
int corelog;
int nosync;
char *origin;
const char *vg_name;
@ -293,6 +294,7 @@ static int _read_mirror_params(struct lvcreate_params *lp,
}
lp->corelog = arg_count(cmd, corelog_ARG) ? 1 : 0;
lp->nosync = arg_count(cmd, nosync_ARG) ? 1 : 0;
return 1;
}
@ -385,6 +387,11 @@ static int _lvcreate_params(struct lvcreate_params *lp, struct cmd_context *cmd,
log_error("--corelog is only available with mirrors");
return 0;
}
if (arg_count(cmd, nosync_ARG)) {
log_error("--nosync is only available with mirrors");
return 0;
}
}
if (activation() && lp->segtype->ops->target_present &&
@ -653,8 +660,16 @@ static int _lvcreate(struct cmd_context *cmd, struct lvcreate_params *lp)
lp->extents,
lp->region_size);
init_mirror_in_sync(lp->nosync);
if (lp->nosync) {
log_print("WARNING: New mirror won't be synchronised. "
"Don't read what you didn't write!");
status |= MIRROR_NOTSYNCED;
}
if (!(log_lv = create_mirror_log(cmd, vg, ah, lp->alloc,
lv_name, 0))) {
lv_name, lp->nosync))) {
log_error("Failed to create mirror log.");
return 0;
}

View File

@ -713,6 +713,8 @@ static int _get_settings(struct cmd_context *cmd)
!_merge_synonym(cmd, allocation_ARG, resizeable_ARG))
return EINVALID_CMD_LINE;
init_mirror_in_sync(0);
/* Zero indicates success */
return 0;
}