1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-29 15:22:30 +03:00

raid: Introduce DEFAULT_RAID_MAX_IMAGES

Prepare to allow for the number of images in a raid set to be
larger than the limit for old-style dm raid1.
This commit is contained in:
Heinz Mauelshagen 2015-09-28 21:38:40 +01:00 committed by Alasdair G Kergon
parent d94ff20927
commit be393f6722
2 changed files with 14 additions and 3 deletions
lib/config
tools

View File

@ -63,6 +63,8 @@
#define DEFAULT_MIRROR_LOG_FAULT_POLICY "allocate"
#define DEFAULT_MIRROR_IMAGE_FAULT_POLICY "remove"
#define DEFAULT_MIRROR_MAX_IMAGES 8 /* limited by kernel DM_KCOPYD_MAX_REGIONS */
#define DEFAULT_RAID_MAX_IMAGES 8
#define DEFAULT_RAID_FAULT_POLICY "warn"
#define DEFAULT_DMEVENTD_RAID_LIB "libdevmapper-event-lvm2raid.so"

View File

@ -500,14 +500,23 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
struct lvcreate_params *lp)
{
int pagesize = lvm_getpagesize();
unsigned max_images;
const char *segtype_name;
/* Common mirror and raid params */
if (arg_count(cmd, mirrors_ARG)) {
lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
if (segtype_is_raid1(lp->segtype)) {
segtype_name = SEG_TYPE_NAME_RAID1;
max_images = DEFAULT_RAID_MAX_IMAGES;
} else {
segtype_name = SEG_TYPE_NAME_MIRROR;
max_images = DEFAULT_MIRROR_MAX_IMAGES;
}
if (lp->mirrors > DEFAULT_MIRROR_MAX_IMAGES) {
log_error("Only up to " DM_TO_STRING(DEFAULT_MIRROR_MAX_IMAGES)
" images in mirror supported currently.");
if (lp->mirrors > max_images) {
log_error("Only up to %u images in %s supported currently.",
max_images, segtype_name);
return 0;
}