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 ./WHATS_NEW lib/metadata/lv_manip.c lib/m ... Date: Wed, 08 Feb 2012 13:05:00 -0000 [thread overview] Message-ID: <20120208130540.1581.qmail@sourceware.org> (raw) CVSROOT: /cvs/lvm2 Module name: LVM2 Changes by: zkabelac@sourceware.org 2012-02-08 13:05:39 Modified files: . : WHATS_NEW lib/metadata : lv_manip.c metadata.h thin_manip.c Log message: Thin add pool_below_threshold Test both data and metadata percent usage. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2272&r2=1.2273 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/lv_manip.c.diff?cvsroot=lvm2&r1=1.357&r2=1.358 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/metadata.h.diff?cvsroot=lvm2&r1=1.265&r2=1.266 http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/lib/metadata/thin_manip.c.diff?cvsroot=lvm2&r1=1.32&r2=1.33 --- LVM2/WHATS_NEW 2012/02/08 13:02:07 1.2272 +++ LVM2/WHATS_NEW 2012/02/08 13:05:38 1.2273 @@ -1,5 +1,6 @@ Version 2.02.91 - =================================== + Add pool_below_threshold() function to check thin pool percent status. Fix test for snap percent for failing merge when removing LV. Switch int to void return for str_list_del(). Fix error path handling in _build_desc(). --- LVM2/lib/metadata/lv_manip.c 2012/02/08 13:02:07 1.357 +++ LVM2/lib/metadata/lv_manip.c 2012/02/08 13:05:39 1.358 @@ -4054,7 +4054,6 @@ struct logical_volume *lv, *org = NULL; struct logical_volume *pool_lv; struct lv_list *lvl; - percent_t percent; int origin_active = 0; struct lvinfo info; @@ -4375,26 +4374,20 @@ if (seg_is_thin(lp)) { /* For snapshot, suspend active thin origin first */ if (org && lv_is_active(org)) { - /* Check if the pool is bellow threshold (Works only for active thin) */ - if (!lv_thin_pool_percent(first_seg(org)->pool_lv, 0, &percent)) { - stack; - goto revert_new_lv; - } - percent /= PERCENT_1; - if (percent >= (find_config_tree_int(cmd, "activation/thin_pool_autoextend_threshold", - DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD))) { - log_error("Failed to create snapshot, pool is filled over " - "the autoextend threshold (%d%%).", percent); + if (!pool_below_threshold(first_seg(first_seg(org)->pool_lv))) { + log_error("Cannot create thin snapshot. Pool %s/%s is filled " + "over the autoextend threshold.", + org->vg->name, first_seg(org)->pool_lv->name); goto revert_new_lv; } if (!suspend_lv_origin(cmd, org)) { - log_error("Failed to suspend thin snapshot origin %s.", - org->name); + log_error("Failed to suspend thin snapshot origin %s/%s.", + org->vg->name, org->name); goto revert_new_lv; } if (!resume_lv_origin(cmd, org)) { /* deptree updates thin-pool */ - log_error("Failed to resume thin snapshot origin %s.", - org->name); + log_error("Failed to resume thin snapshot origin %s/%s.", + org->vg->name, org->name); goto revert_new_lv; } /* At this point remove pool messages, snapshot is active */ --- LVM2/lib/metadata/metadata.h 2012/01/25 08:55:19 1.265 +++ LVM2/lib/metadata/metadata.h 2012/02/08 13:05:39 1.266 @@ -464,6 +464,7 @@ int auto_increment); int pool_has_message(const struct lv_segment *seg, const struct logical_volume *lv, uint32_t device_id); +int pool_below_threshold(const struct lv_segment *pool_seg); int extend_pool(struct logical_volume *lv, const struct segment_type *segtype, struct alloc_handle *ah, uint32_t stripes, uint32_t stripe_size); --- LVM2/lib/metadata/thin_manip.c 2012/01/25 09:17:15 1.32 +++ LVM2/lib/metadata/thin_manip.c 2012/02/08 13:05:39 1.33 @@ -19,6 +19,7 @@ #include "segtype.h" #include "lv_alloc.h" #include "archiver.h" +#include "defaults.h" int attach_pool_metadata_lv(struct lv_segment *pool_seg, struct logical_volume *metadata_lv) { @@ -215,6 +216,35 @@ return 0; } +int pool_below_threshold(const struct lv_segment *pool_seg) +{ + percent_t percent; + int threshold = PERCENT_1 * + find_config_tree_int(pool_seg->lv->vg->cmd, + "activation/thin_pool_autoextend_threshold", + DEFAULT_THIN_POOL_AUTOEXTEND_THRESHOLD); + + /* Data */ + if (!lv_thin_pool_percent(pool_seg->lv, 0, &percent)) { + stack; + return 0; + } + + if (percent >= threshold) + return 0; + + /* Metadata */ + if (!lv_thin_pool_percent(pool_seg->lv, 1, &percent)) { + stack; + return 0; + } + + if (percent >= threshold) + return 0; + + return 1; +} + struct lv_segment *find_pool_seg(const struct lv_segment *seg) { struct lv_segment *pool_seg;
next reply other threads:[~2012-02-08 13:05 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-02-08 13:05 zkabelac [this message] -- strict thread matches above, loose matches on Subject: below -- 2012-02-23 17:36 jbrassow 2012-02-23 3:57 jbrassow 2012-02-15 15:18 zkabelac 2012-02-01 2:10 agk 2011-10-22 16:42 zkabelac 2011-09-06 18:49 agk 2011-08-18 19:41 jbrassow 2011-08-11 3:29 jbrassow 2011-06-23 14:01 jbrassow 2011-04-09 19:05 zkabelac 2011-01-24 14:19 agk 2011-01-11 17:05 jbrassow 2010-10-14 20:03 jbrassow 2010-04-23 19:27 snitzer 2010-04-09 1:00 agk 2010-03-25 21:19 agk 2010-03-25 2:31 agk 2010-01-08 22:32 jbrassow 2009-05-13 21:29 mbroz 2009-05-13 21:28 mbroz 2009-04-21 14:32 mbroz 2009-04-07 10:20 mbroz 2008-03-28 19:08 wysochanski 2008-01-26 0:25 agk 2008-01-18 22:01 agk 2007-12-20 18:55 agk 2007-08-28 16:14 wysochanski 2007-08-03 21:22 wysochanski 2006-12-13 3:40 agk 2006-10-23 15:54 agk 2006-10-08 12:01 agk 2006-09-11 21:14 agk 2005-11-10 14:45 agk 2005-10-18 13:43 agk 2004-05-05 18:49 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=20120208130540.1581.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: linkBe 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).