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

Fix raid shared lib segtype registration (2.02.87).

This commit is contained in:
Alasdair Kergon 2011-08-24 13:41:46 +00:00
parent 3ba4a19510
commit f9b92564a7
6 changed files with 89 additions and 83 deletions

View File

@ -1,9 +1,11 @@
Version 2.02.89 - Version 2.02.89 -
================================== ==================================
Add configure --with-thin for (unimplemented) segtypes "thin" and "thin_pool".
Fix raid shared lib segtype registration (2.02.87).
Version 2.02.88 - 19th August 2011 Version 2.02.88 - 19th August 2011
================================== ==================================
Remove incorrect 'Breaking' error message from allocation code (2.02.87). Remove incorrect 'Breaking' error message from allocation code. (2.02.87)
Add lvconvert --merge support for raid1 devices split with --trackchanges. Add lvconvert --merge support for raid1 devices split with --trackchanges.
Support lvconvert of -m1 raid1 devices to a higher number. Support lvconvert of -m1 raid1 devices to a higher number.
Add --trackchanges support to lvconvert --splitmirrors option for raid1. Add --trackchanges support to lvconvert --splitmirrors option for raid1.

View File

@ -994,24 +994,17 @@ static int _init_segtypes(struct cmd_context *cmd)
{ {
int i; int i;
struct segment_type *segtype; struct segment_type *segtype;
struct segtype_library seglib = { .cmd = cmd }; struct segtype_library seglib = { .cmd = cmd, .lib = NULL };
struct segment_type *(*init_segtype_array[])(struct cmd_context *cmd) = { struct segment_type *(*init_segtype_array[])(struct cmd_context *cmd) = {
init_striped_segtype, init_striped_segtype,
init_zero_segtype, init_zero_segtype,
init_error_segtype, init_error_segtype,
init_free_segtype, init_free_segtype,
#ifdef RAID_INTERNAL #ifdef SNAPSHOT_INTERNAL
init_raid1_segtype, init_snapshot_segtype,
init_raid4_segtype, #endif
init_raid5_segtype, #ifdef MIRRORED_INTERNAL
init_raid5_la_segtype, init_mirrored_segtype,
init_raid5_ra_segtype,
init_raid5_ls_segtype,
init_raid5_rs_segtype,
init_raid6_segtype,
init_raid6_zr_segtype,
init_raid6_nr_segtype,
init_raid6_nc_segtype,
#endif #endif
NULL NULL
}; };
@ -1027,22 +1020,13 @@ static int _init_segtypes(struct cmd_context *cmd)
dm_list_add(&cmd->segtypes, &segtype->list); dm_list_add(&cmd->segtypes, &segtype->list);
} }
#ifdef SNAPSHOT_INTERNAL
if (!(segtype = init_snapshot_segtype(cmd)))
return 0;
segtype->library = NULL;
dm_list_add(&cmd->segtypes, &segtype->list);
#endif
#ifdef MIRRORED_INTERNAL
if (!(segtype = init_mirrored_segtype(cmd)))
return 0;
segtype->library = NULL;
dm_list_add(&cmd->segtypes, &segtype->list);
#endif
#ifdef REPLICATOR_INTERNAL #ifdef REPLICATOR_INTERNAL
if (!init_replicator_segtype(&seglib)) if (!init_replicator_segtype(cmd, &seglib))
return 0;
#endif
#ifdef RAID_INTERNAL
if (!init_raid_segtypes(cmd, &seglib))
return 0; return 0;
#endif #endif

View File

@ -130,21 +130,11 @@ struct segment_type *init_free_segtype(struct cmd_context *cmd);
struct segment_type *init_unknown_segtype(struct cmd_context *cmd, struct segment_type *init_unknown_segtype(struct cmd_context *cmd,
const char *name); const char *name);
#ifdef RAID_INTERNAL #ifdef RAID_INTERNAL
struct segment_type *init_raid1_segtype(struct cmd_context *cmd); int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
struct segment_type *init_raid4_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_la_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_ra_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_ls_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_rs_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_zr_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_nr_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_nc_segtype(struct cmd_context *cmd);
#endif #endif
#ifdef REPLICATOR_INTERNAL #ifdef REPLICATOR_INTERNAL
int init_replicator_segtype(struct segtype_library *seglib); int init_replicator_segtype(struct cmd_context *cmd, struct segtype_library *seglib);
#endif #endif
#ifdef SNAPSHOT_INTERNAL #ifdef SNAPSHOT_INTERNAL

View File

@ -1 +1 @@
init_segtype init_multiple_segtypes

View File

@ -331,7 +331,7 @@ static struct segtype_handler _raid_ops = {
.destroy = _raid_destroy, .destroy = _raid_destroy,
}; };
static struct segment_type *init_raid_segtype(struct cmd_context *cmd, static struct segment_type *_init_raid_segtype(struct cmd_context *cmd,
const char *raid_type) const char *raid_type)
{ {
struct segment_type *segtype = dm_zalloc(sizeof(*segtype)); struct segment_type *segtype = dm_zalloc(sizeof(*segtype));
@ -362,25 +362,11 @@ static struct segment_type *init_raid_segtype(struct cmd_context *cmd,
return segtype; return segtype;
} }
#ifndef RAID_INTERNAL /* Shared */ static struct segment_type *_init_raid1_segtype(struct cmd_context *cmd)
struct segment_type *init_raid1_segtype(struct cmd_context *cmd);
struct segment_type *init_raid4_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_la_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_ra_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_ls_segtype(struct cmd_context *cmd);
struct segment_type *init_raid5_rs_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_zr_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_nr_segtype(struct cmd_context *cmd);
struct segment_type *init_raid6_nc_segtype(struct cmd_context *cmd);
#endif
struct segment_type *init_raid1_segtype(struct cmd_context *cmd)
{ {
struct segment_type *segtype; struct segment_type *segtype;
segtype = init_raid_segtype(cmd, "raid1"); segtype = _init_raid_segtype(cmd, "raid1");
if (!segtype) if (!segtype)
return NULL; return NULL;
@ -389,43 +375,87 @@ struct segment_type *init_raid1_segtype(struct cmd_context *cmd)
return segtype; return segtype;
} }
struct segment_type *init_raid4_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid4_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid4"); return _init_raid_segtype(cmd, "raid4");
} }
struct segment_type *init_raid5_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid5_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid5"); return _init_raid_segtype(cmd, "raid5");
} }
struct segment_type *init_raid5_la_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid5_la_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid5_la"); return _init_raid_segtype(cmd, "raid5_la");
} }
struct segment_type *init_raid5_ra_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid5_ra_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid5_ra"); return _init_raid_segtype(cmd, "raid5_ra");
} }
struct segment_type *init_raid5_ls_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid5_ls_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid5_ls"); return _init_raid_segtype(cmd, "raid5_ls");
} }
struct segment_type *init_raid5_rs_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid5_rs_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid5_rs"); return _init_raid_segtype(cmd, "raid5_rs");
} }
struct segment_type *init_raid6_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid6_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid6"); return _init_raid_segtype(cmd, "raid6");
} }
struct segment_type *init_raid6_zr_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid6_zr_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid6_zr"); return _init_raid_segtype(cmd, "raid6_zr");
} }
struct segment_type *init_raid6_nr_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid6_nr_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid6_nr"); return _init_raid_segtype(cmd, "raid6_nr");
} }
struct segment_type *init_raid6_nc_segtype(struct cmd_context *cmd)
static struct segment_type *_init_raid6_nc_segtype(struct cmd_context *cmd)
{ {
return init_raid_segtype(cmd, "raid6_nc"); return _init_raid_segtype(cmd, "raid6_nc");
}
#ifdef RAID_INTERNAL /* Shared */
int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib)
#else
int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
int init_multiple_segtypes(struct cmd_context *cmd, struct segtype_library *seglib)
#endif
{
struct segment_type *segtype;
unsigned i = 0;
struct segment_type *(*raid_segtype_fn[])(struct cmd_context *) = {
_init_raid1_segtype,
_init_raid4_segtype,
_init_raid5_segtype,
_init_raid5_la_segtype,
_init_raid5_ra_segtype,
_init_raid5_ls_segtype,
_init_raid5_rs_segtype,
_init_raid6_segtype,
_init_raid6_zr_segtype,
_init_raid6_nr_segtype,
_init_raid6_nc_segtype,
NULL,
};
do {
if ((segtype = raid_segtype_fn[i](cmd)) &&
!lvm_register_segtype(seglib, segtype))
return 0;
} while (raid_segtype_fn[++i]);
return 1;
} }

View File

@ -754,10 +754,10 @@ static struct segtype_handler _replicator_dev_ops = {
}; };
#ifdef REPLICATOR_INTERNAL #ifdef REPLICATOR_INTERNAL
int init_replicator_segtype(struct segtype_library *seglib) int init_replicator_segtype(struct cmd_context *cmd, struct segtype_library *seglib)
#else /* Shared */ #else /* Shared */
int init_multiple_segtype(struct segtype_library *seglib); int init_multiple_segtype(struct cmd_context *cmd, struct segtype_library *seglib);
int init_multiple_segtype(struct segtype_library *seglib) int init_multiple_segtype(struct cmd_context *cmd, struct segtype_library *seglib)
#endif #endif
{ {
struct segment_type *segtype; struct segment_type *segtype;