public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: zkabelac@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2/tools lvcreate.c
Date: Fri, 02 Mar 2012 20:18:00 -0000 [thread overview]
Message-ID: <20120302201827.1578.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: zkabelac@sourceware.org 2012-03-02 20:18:25
Modified files:
tools : lvcreate.c
Log message:
Merge metadata size checking
Move the code for poolmetadatasize operation into one place.
Report override for minimum and maximum size.
Drop _read_thin_params function its error reporting is handled elsewhere.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/tools/lvcreate.c.diff?cvsroot=lvm2&r1=1.259&r2=1.260
--- LVM2/tools/lvcreate.c 2012/03/02 17:25:21 1.259
+++ LVM2/tools/lvcreate.c 2012/03/02 20:18:25 1.260
@@ -293,15 +293,29 @@
break;
}
- if (lp->create_thin_pool && !arg_count(vg->cmd, poolmetadatasize_ARG))
- /* Defaults to nr_pool_blocks * 64b */
- lp->poolmetadatasize = (uint64_t) lp->extents * vg->extent_size /
- (uint64_t) (lp->chunk_size * (SECTOR_SIZE / UINT64_C(64)));
-
- if (lp->poolmetadatasize &&
- !(lp->poolmetadataextents = extents_from_size(vg->cmd, lp->poolmetadatasize,
- vg->extent_size)))
- return_0;
+ if (lp->create_thin_pool) {
+ if (!arg_count(vg->cmd, poolmetadatasize_ARG))
+ /* Defaults to nr_pool_blocks * 64b */
+ lp->poolmetadatasize = (uint64_t) lp->extents * vg->extent_size /
+ (uint64_t) (lp->chunk_size * (SECTOR_SIZE / UINT64_C(64)));
+
+ if (lp->poolmetadatasize > (2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE)) {
+ if (arg_count(vg->cmd, poolmetadatasize_ARG))
+ log_warn("WARNING: Maximum supported pool metadata size is 16GB.");
+ lp->poolmetadatasize = 2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE;
+ } else if (lp->poolmetadatasize < (2 * DEFAULT_THIN_POOL_MIN_METADATA_SIZE)) {
+ if (arg_count(vg->cmd, poolmetadatasize_ARG))
+ log_warn("WARNING: Minimum supported pool metadata size is 2M.");
+ lp->poolmetadatasize = 2 * DEFAULT_THIN_POOL_MIN_METADATA_SIZE;
+ }
+
+ log_verbose("Setting pool metadata size to %" PRIu64 " sectors.",
+ lp->poolmetadatasize);
+
+ if (!(lp->poolmetadataextents =
+ extents_from_size(vg->cmd, lp->poolmetadatasize, vg->extent_size)))
+ return_0;
+ }
return 1;
}
@@ -511,33 +525,6 @@
return 1;
}
-static int _read_thin_params(struct lvcreate_params *lp,
- struct cmd_context *cmd)
-{
- if (!seg_is_thin(lp)) {
- if (lp->poolmetadatasize) {
- log_error("Pool metadata size option is only for pool creation.");
- return 0;
- }
- return 1;
- }
-
- if (lp->create_thin_pool) {
- if (lp->poolmetadatasize > (2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE)) {
- log_warn("WARNING: Maximum supported pool metadata size is 16GB.");
- lp->poolmetadatasize = 2 * DEFAULT_THIN_POOL_MAX_METADATA_SIZE;
- } else if (lp->poolmetadatasize < (2 * DEFAULT_THIN_POOL_MIN_METADATA_SIZE))
- lp->poolmetadatasize = 2 * DEFAULT_THIN_POOL_MIN_METADATA_SIZE;
- log_verbose("Setting pool metadata size to %" PRIu64 " sectors.",
- lp->poolmetadatasize);
- } else if (lp->poolmetadatasize) {
- log_error("Pool metadata size options is only for pool creation.");
- return 0;
- }
-
- return 1;
-}
-
static int _read_activation_params(struct lvcreate_params *lp, struct cmd_context *cmd)
{
unsigned pagesize;
@@ -737,8 +724,7 @@
!_read_size_params(lp, lcp, cmd) ||
!get_stripe_params(cmd, &lp->stripes, &lp->stripe_size) ||
!_read_mirror_params(lp, cmd) ||
- !_read_raid_params(lp, cmd) ||
- !_read_thin_params(lp, cmd))
+ !_read_raid_params(lp, cmd))
return_0;
if (lp->snapshot && lp->thin && arg_count(cmd, chunksize_ARG))
next reply other threads:[~2012-03-02 20:18 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-02 20:18 zkabelac [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-02-01 1:54 agk
2011-11-10 12:40 zkabelac
2011-11-10 12:39 zkabelac
2011-09-27 12:37 agk
2011-09-07 9:25 zkabelac
2011-09-06 15:35 agk
2011-03-25 21:56 jbrassow
2010-10-25 12:05 zkabelac
2010-05-11 21:40 jbrassow
2009-07-26 2:32 wysochanski
2009-07-26 2:32 wysochanski
2009-07-26 2:32 wysochanski
2009-07-26 2:31 wysochanski
2009-07-26 2:31 wysochanski
2009-07-26 2:30 wysochanski
2009-06-06 22:06 mbroz
2009-05-27 13:07 agk
2009-04-26 8:12 prajnoha
2008-07-17 15:19 wysochanski
2008-01-16 15:26 agk
2007-10-01 15:01 wysochanski
2007-09-24 13:29 wysochanski
2006-10-16 16:47 agk
2005-11-12 22:00 agk
2005-10-28 14:38 agk
2005-09-30 22:20 agk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120302201827.1578.qmail@sourceware.org \
--to=zkabelac@sourceware.org \
--cc=lvm-devel@redhat.com \
--cc=lvm2-cvs@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).