All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 1/2] lvm2app: Add thin and thin pool lv creation
Date: Mon, 25 Feb 2013 20:45:47 +0100	[thread overview]
Message-ID: <512BBF6B.3060004@redhat.com> (raw)
In-Reply-To: <1360689876-13552-2-git-send-email-mohan@in.ibm.com>

Dne 12.2.2013 18:24, M. Mohan Kumar napsal(a):
> From: "M. Mohan Kumar" <mohan@in.ibm.com>
>
> Add thin and thin pool lv creation support to lvm library
>
> Signed-off-by: M. Mohan Kumar <mohan@in.ibm.com>
> ---
>   lib/metadata/lv_manip.c          |   2 +-
>   lib/metadata/metadata-exported.h |   1 +
>   liblvm/lvm2app.h                 |  57 +++++++++++++++++++
>   liblvm/lvm_lv.c                  | 116 +++++++++++++++++++++++++++++++++++++++
>   4 files changed, 175 insertions(+), 1 deletion(-)
>
> diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
> index c1437eb..4dd5ebf 100644
> --- a/lib/metadata/lv_manip.c
> +++ b/lib/metadata/lv_manip.c
> @@ -4518,7 +4518,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
>   		first_seg(lv)->chunk_size = lp->chunk_size;
>   		first_seg(lv)->discards = lp->discards;
>   		/* FIXME: use lowwatermark  via lvm.conf global for all thinpools ? */
> -		first_seg(lv)->low_water_mark = 0;
> +		first_seg(lv)->low_water_mark = lp->low_water_mark;

low_water_mark is not supported yet in the lvm2 stack,
and there is not yet clear definition how is it going to be used.

For now dmeventd is based on 10sec polling interval.

However there needs to be made clean definition for various error path,
and we have to also support 'clean' shutdown for those paths according
to defined policy.


> +	  threshold specified in percentage, convert that into
> +	  number of blocks
> +	*/
> +	lp.low_water_mark = size / chunk_size * threshold / 100;
> +	if (!lp.segtype)
> +		return_NULL;
> +	if (!lv_create_single(vg, &lp))
> +		return_NULL;
> +	if (!(lvl = find_lv_in_vg(vg, pool)))
> +		return NULL;
> +	return (lv_t) lvl->lv;
> +}
> +
> +/* Set defaults for thin LV specific parameters */
> +static void _lv_set_thin_params(struct lvcreate_params *lp,
> +				vg_t vg, const char *pool,
> +				const char *lvname,
> +				uint64_t extents)
> +{
> +	_lv_set_default_params(lp, vg, lvname, extents);
> +
> +	lp->thin = 1;
> +	lp->pool = pool;
> +	lp->segtype = get_segtype_from_string(vg->cmd, "thin");
> +
> +	lp->voriginsize = extents * vg->extent_size;
> +	lp->voriginextents = extents_from_size(vg->cmd, lp->voriginsize,
> +						   vg->extent_size);
> +
> +	lp->stripes = 1;
> +}
> +
> +lv_t lvm_lv_thin(const vg_t vg, const char *pool,
> +		 const char *lvname, uint64_t size)
> +{
> +	struct lvcreate_params lp = { 0 };

I think the lvm2app needs some extension here and rather
make the 'lvcreate_params' structure a visible object with some methods,
and use just one universal function call to create all types
of LVs - so we can better match the internal lvm2 processing.
i.e. there is going to be support for creation of thin
lvs with external origins - so adding  lvm API call for every
possible use case of thin pool is IMHO less clean then maintenance
of 'lvcreate_params' object separately from lvm_lv_create() call.

Similar abstraction needs to be made for i.e. lvconvert command,
which has an internal  lvconvert_params.

Zdenek



  reply	other threads:[~2013-02-25 19:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-12 17:24 [PATCH V3 0/2] Add thin lv and thin pool creation support M. Mohan Kumar
2013-02-12 17:24 ` [PATCH 1/2] lvm2app: Add thin and thin pool lv creation M. Mohan Kumar
2013-02-25 19:45   ` Zdenek Kabelac [this message]
2013-02-28 11:22     ` M. Mohan Kumar
2013-02-28 15:35       ` Zdenek Kabelac
2013-02-28 20:33         ` Tony Asleson
2013-02-28 21:57           ` Zdenek Kabelac
2013-04-25 23:14             ` Tony Asleson
2013-04-26  0:11               ` Andy Grover
2013-02-12 17:24 ` [PATCH 2/2] master - thin: Add low water mark parameter to pool creation M. Mohan Kumar

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=512BBF6B.3060004@redhat.com \
    --to=zkabelac@redhat.com \
    --cc=lvm-devel@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.