Lines Matching refs:lp

30 static int _lvcreate_name_params(struct lvcreate_params *lp,
38 lp->lv_name = arg_str_value(cmd, name_ARG, NULL);
40 if (lp->snapshot && !arg_count(cmd, virtualsize_ARG)) {
47 lp->origin = argv[0];
49 if (!(lp->vg_name = extract_vgname(cmd, lp->origin))) {
56 if ((ptr = strrchr(lp->origin, (int) '/')))
57 lp->origin = ptr + 1;
65 if (!(lp->vg_name = extract_vgname(cmd, lp->lv_name))) {
82 if (lp->lv_name && strchr(lp->lv_name, '/')) {
83 if (!(lp->vg_name =
84 extract_vgname(cmd, lp->lv_name)))
87 if (strcmp(lp->vg_name, vg_name)) {
91 lp->vg_name, vg_name);
96 lp->vg_name = vg_name;
101 if (!validate_name(lp->vg_name)) {
103 lp->vg_name);
107 if (lp->lv_name) {
108 if ((ptr = strrchr(lp->lv_name, '/')))
109 lp->lv_name = ptr + 1;
111 if (!apply_lvname_restrictions(lp->lv_name))
114 if (!validate_name(lp->lv_name)) {
116 lp->lv_name);
131 struct lvcreate_params *lp,
137 !(lp->extents = extents_from_size(vg->cmd, lcp->size,
141 if (lp->voriginsize &&
142 !(lp->voriginextents = extents_from_size(vg->cmd, lp->voriginsize,
151 if (!(lp->pvh = create_pv_list(vg->cmd->mem, vg,
155 lp->pvh = &vg->pvs;
159 lp->extents = lp->extents * vg->extent_count / 100;
162 lp->extents = lp->extents * vg->free_count / 100;
166 lp->extents = lp->extents * vg->extent_count / 100;
168 pv_extent_count = pv_list_extents_free(lp->pvh);
169 lp->extents = lp->extents * pv_extent_count / 100;
182 static int _read_size_params(struct lvcreate_params *lp,
196 lp->extents = arg_uint_value(cmd, extents_ARG, 0);
216 lp->voriginsize = arg_uint64_value(cmd, virtualsize_ARG,
218 if (!lp->voriginsize) {
232 struct lvcreate_params *lp)
234 if (lp->stripes == 1 && lp->stripe_size) {
236 lp->stripe_size = 0;
239 if (lp->stripes > 1 && !lp->stripe_size) {
240 lp->stripe_size = find_config_tree_int(cmd,
244 display_size(cmd, (uint64_t) lp->stripe_size));
247 if (lp->stripes < 1 || lp->stripes > MAX_STRIPES) {
249 lp->stripes, 1, MAX_STRIPES);
254 if (lp->stripes > 1 && (lp->stripe_size < STRIPE_SIZE_MIN ||
255 lp->stripe_size & (lp->stripe_size - 1))) {
257 display_size(cmd, (uint64_t) lp->stripe_size));
268 static int _read_stripe_params(struct lvcreate_params *lp,
276 /* Check to make sure we won't overflow lp->stripe_size */
282 lp->stripe_size = arg_uint_value(cmd, stripesize_ARG, 0);
286 if (!_validate_stripe_params(cmd, lp))
297 const struct lvcreate_params *lp)
301 if (lp->region_size & (lp->region_size - 1)) {
303 lp->region_size);
307 if (lp->region_size % (pagesize >> SECTOR_SHIFT)) {
310 lp->region_size, pagesize >> SECTOR_SHIFT);
314 if (!lp->region_size) {
322 static int _read_mirror_params(struct lvcreate_params *lp,
329 lp->corelog = 1;
332 lp->corelog ? "core" : DEFAULT_MIRRORLOG);
335 if (lp->corelog) {
340 lp->corelog = 0;
342 lp->corelog = 1;
350 lp->nosync = arg_is_set(cmd, nosync_ARG);
357 lp->region_size = arg_uint_value(cmd, regionsize_ARG, 0);
367 lp->region_size = region_size;
370 if (!_validate_mirror_params(cmd, lp))
376 static int _lvcreate_params(struct lvcreate_params *lp,
384 memset(lp, 0, sizeof(*lp));
390 lp->segtype = (const struct segment_type *)
394 lp->stripes = arg_uint_value(cmd, stripes_ARG, 1);
395 if (arg_count(cmd, stripes_ARG) && lp->stripes == 1)
398 if (arg_count(cmd, snapshot_ARG) || seg_is_snapshot(lp) ||
400 lp->snapshot = 1;
402 lp->mirrors = 1;
405 if (seg_is_mirrored(lp))
406 lp->mirrors = 2;
409 lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0) + 1;
410 if (lp->mirrors == 1)
418 if (lp->snapshot) {
427 lp->chunk_size = arg_uint_value(cmd, chunksize_ARG, 8);
428 if (lp->chunk_size < 8 || lp->chunk_size > 1024 ||
429 (lp->chunk_size & (lp->chunk_size - 1))) {
434 log_verbose("Setting chunksize to %d sectors.", lp->chunk_size);
436 if (!(lp->segtype = get_segtype_from_string(cmd, "snapshot")))
445 if (lp->mirrors > 1) {
446 if (lp->snapshot) {
452 if (lp->stripes > 1) {
458 if (!(lp->segtype = get_segtype_from_string(cmd, "striped")))
472 if (activation() && lp->segtype->ops->target_present &&
473 !lp->segtype->ops->target_present(cmd, NULL, NULL)) {
475 "detected in your kernel", lp->segtype->name);
479 if (!_lvcreate_name_params(lp, cmd, &argc, &argv) ||
480 !_read_size_params(lp, lcp, cmd) ||
481 !_read_stripe_params(lp, cmd) ||
482 !_read_mirror_params(lp, cmd))
488 lp->zero = strcmp(arg_str_value(cmd, zero_ARG,
489 (lp->segtype->flags & SEG_CANNOT_BE_ZEROED) ? "n" : "y"), "n");
496 lp->alloc = contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT;
498 lp->alloc = arg_uint_value(cmd, alloc_ARG, lp->alloc);
500 if (contiguous && (lp->alloc != ALLOC_CONTIGUOUS)) {
508 lp->read_ahead = arg_uint_value(cmd, readahead_ARG, DM_READ_AHEAD_NONE);
510 if (lp->read_ahead != DM_READ_AHEAD_AUTO &&
511 lp->read_ahead != DM_READ_AHEAD_NONE &&
512 lp->read_ahead % pagesize) {
513 if (lp->read_ahead < pagesize)
514 lp->read_ahead = pagesize;
516 lp->read_ahead = (lp->read_ahead / pagesize) * pagesize;
518 "of %uK page size.", lp->read_ahead, pagesize >> 1);
524 lp->permission = arg_uint_value(cmd, permission_ARG,
528 if (!(lp->permission & LVM_WRITE))
529 lp->zero = 0;
531 lp->minor = arg_int_value(cmd, minor_ARG, -1);
532 lp->major = arg_int_value(cmd, major_ARG, -1);
537 if (lp->minor == -1) {
542 if (lp->major == -1) {
548 if ((lp->minor != -1) || (lp->major != -1)) {
559 lp->tag = arg_str_value(cmd, addtag_ARG, NULL);
570 struct lvcreate_params lp;
574 memset(&lp, 0, sizeof(lp));
576 if (!_lvcreate_params(&lp, &lcp, cmd, argc, argv))
579 log_verbose("Finding volume group \"%s\"", lp.vg_name);
580 vg = vg_read_for_update(cmd, lp.vg_name, NULL, 0);
587 if (!_update_extents_params(vg, &lp, &lcp)) {
592 if (!lv_create_single(vg, &lp)) {
597 unlock_and_release_vg(cmd, vg, lp.vg_name);