Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
List overview
Download
lvm2-commits
September 2014
----- 2024 -----
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
lvm2-commits@lists.fedorahosted.org
6 participants
151 discussions
Start a n
N
ew thread
master - cleanup: use supplied cmd pointer
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec4ffeb51ca15d5b…
Commit: ec4ffeb51ca15d5bd79acf77dfe38630328f1db0 Parent: 30777fa46fb21001f3e5a9ba610d50c57c6dfe27 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Tue Sep 23 16:49:46 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:48 2014 +0200 cleanup: use supplied cmd pointer --- lib/activate/activate.c | 3 +-- tools/lvconvert.c | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 4e1ec5f..8843ec9 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -645,7 +645,7 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la fs_unlock(); /* For non clustered - wait if there are non-delete ops */ } - if (!dev_manager_info(lv->vg->cmd->mem, lv, + if (!dev_manager_info(cmd->mem, lv, (use_layer) ? lv_layer(lv) : NULL, with_open_count, with_read_ahead, &dminfo, (info) ? &info->read_ahead : NULL)) @@ -794,7 +794,6 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv, log_debug_activation("Checking mirror percent for LV %s/%s", lv->vg->name, lv->name); - if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1))) return_0; diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 1b71866..9681f3a 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2135,7 +2135,8 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd, return 0; } - if (lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) + /* FIXME: test when snapshot is remotely active */ + if (lv_info(cmd, lv, 0, &info, 1, 0) && info.exists && info.live_table && (!lv_snapshot_percent(lv, &snap_percent) || snap_percent == DM_PERCENT_INVALID)) {
1
0
0
0
master - cleanup: fix typo and use vg mempool
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=30777fa46fb21001…
Commit: 30777fa46fb21001f3e5a9ba610d50c57c6dfe27 Parent: 914be0696daf3603b6db055b2afe146190e9a7f7 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Sep 21 01:16:06 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 cleanup: fix typo and use vg mempool Since we are updating VG - we can use its own mempool. --- lib/metadata/snapshot_manip.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c index a52b00c..e6a420f 100644 --- a/lib/metadata/snapshot_manip.c +++ b/lib/metadata/snapshot_manip.c @@ -283,9 +283,9 @@ int vg_remove_snapshot(struct logical_volume *cow) clear_snapshot_merge(origin); /* * preload origin IFF "snapshot-merge" target is active - * - IMPORTANT: avoids preload if onactivate merge is pending + * - IMPORTANT: avoids preload if inactivate merge is pending */ - if (lv_has_target_type(origin->vg->cmd->mem, origin, NULL, + if (lv_has_target_type(origin->vg->vgmem, origin, NULL, "snapshot-merge")) { /* * preload origin to:
1
0
0
0
master - cleanup: replace error with print message
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=914be0696daf3603…
Commit: 914be0696daf3603b6db055b2afe146190e9a7f7 Parent: bc0a3e23553f8d622a7218ded55ac1fdaa75286c Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sat Sep 20 22:05:29 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 cleanup: replace error with print message These are not error messages. They are informing a user about missconfigured options which do not change resulting error status. --- lib/activate/activate.c | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 2a94ea6..4e1ec5f 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -125,24 +125,23 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic if (cv->type == DM_CFG_EMPTY_ARRAY) goto out; if (cv->type != DM_CFG_STRING) { - log_error("Ignoring invalid string in config file %s", - config_path); + log_print_unless_silent("Ignoring invalid string in config file %s.", + config_path); continue; } str = cv->v.str; if (!*str) { - log_error("Ignoring empty string in config file %s", - config_path); + log_print_unless_silent("Ignoring empty string in config file %s.", + config_path); continue; } - /* Tag? */ if (*str == '@') { str++; if (!*str) { - log_error("Ignoring empty tag in config file " - "%s", config_path); + log_print_unless_silent("Ignoring empty tag in config file %s", + config_path); continue; } /* If any host tag matches any LV or VG tag, activate */
1
0
0
0
master - cleanup: simplier _lv_passes_volumes_filter
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc0a3e23553f8d62…
Commit: bc0a3e23553f8d622a7218ded55ac1fdaa75286c Parent: a1213401393ac6e6a9a9e168379574469eb715c8 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Sep 21 01:08:43 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 cleanup: simplier _lv_passes_volumes_filter Don't recreate string and just check components directly. --- lib/activate/activate.c | 23 +++++++---------------- 1 files changed, 7 insertions(+), 16 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 3f9d1a2..2a94ea6 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -114,7 +114,7 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic const struct dm_config_value *cv; const char *str; static char config_path[PATH_MAX]; - static char path[PATH_MAX]; + size_t len = strlen(lv->vg->name); config_def_get_path(config_path, sizeof(config_path), cfg_id); log_verbose("%s configuration setting defined: " @@ -161,21 +161,12 @@ static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logic else continue; } - if (!strchr(str, '/')) { - /* vgname supplied */ - if (!strcmp(str, lv->vg->name)) - return 1; - else - continue; - } - /* vgname/lvname */ - if (dm_snprintf(path, sizeof(path), "%s/%s", lv->vg->name, - lv->name) < 0) { - log_error("dm_snprintf error from %s/%s", lv->vg->name, - lv->name); - continue; - } - if (!strcmp(path, str)) + + /* If supplied name is vgname[/lvname] */ + if ((strncmp(str, lv->vg->name, len) == 0) && + (!str[len] || + ((str[len] == '/') && + !strcmp(str + len + 1, lv->name)))) return 1; }
1
0
0
0
master - cleanup: use find_lv_in_vg_by_lvid
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a1213401393ac6e6…
Commit: a1213401393ac6e6a9a9e168379574469eb715c8 Parent: a8aee7dba2b76409d1630edc4f76021b50b08792 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Sep 21 11:46:34 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 cleanup: use find_lv_in_vg_by_lvid Replace another loop with existion function. TODO: consider using hash maps for lvname & lvid lookups. --- lib/metadata/metadata.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 04d63eb..353db25 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -4818,11 +4818,11 @@ const struct logical_volume *lv_ondisk(const struct logical_volume *lv) vg = lv->vg->vg_ondisk; - dm_list_iterate_items(lvl, &vg->lvs) - if (!strncmp(lvl->lv->lvid.s, lv->lvid.s, sizeof(lv->lvid))) - return lvl->lv; + if (!(lvl = find_lv_in_vg_by_lvid(vg, &lv->lvid))) { + log_error(INTERNAL_ERROR "LV %s (UUID %s) not found in ondisk metadata.", + display_lvname(lv), lv->lvid.s); + return NULL; + } - log_error(INTERNAL_ERROR "LV %s/%s (UUID %s) not found in ondisk metadata.", - lv->vg->name, lv->name, lv->lvid.s); - return NULL; + return lvl->lv; }
1
0
0
0
master - activate: update lv_check_not_in_use: API
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a8aee7dba2b76409…
Commit: a8aee7dba2b76409d1630edc4f76021b50b08792 Parent: c96665e6a88780e31a84f9fb287c2e30c7552b0c Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Wed Sep 24 10:05:26 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 activate: update lv_check_not_in_use: API Use of lv_info() internally in lv_check_not_in_use(), so it always could use with_open_count properly. Skip sysfs() testing in open_count == 0 case. Accept just 'lv' pointer like other functions. The function has 'built-in' lv_is_active_locally check, which however is not what we need to check in many place. For now at least remotely active snapshot merge is detected and for this case merge on next activation is scheduled. --- lib/activate/activate.c | 25 +++++++++++-------------- lib/activate/activate.h | 3 +-- lib/metadata/lv_manip.c | 6 ++---- tools/lvchange.c | 4 ++-- tools/lvconvert.c | 23 +++++++++++++---------- tools/vgchange.c | 4 +--- 6 files changed, 30 insertions(+), 35 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 82ce6d8..3f9d1a2 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -248,8 +248,7 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, { return 0; } -int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv, - struct lvinfo *info) +int lv_check_not_in_use(const struct logical_volume *lv) { return 0; } @@ -695,23 +694,23 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, #define OPEN_COUNT_CHECK_RETRIES 25 #define OPEN_COUNT_CHECK_USLEEP_DELAY 200000 -int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv, - struct lvinfo *info) +int lv_check_not_in_use(const struct logical_volume *lv) { + struct lvinfo info; unsigned int open_count_check_retries; - if (!info->exists || !info->open_count) + if (!lv_info(lv->vg->cmd, lv, 0, &info, 1, 0) || !info.exists || !info.open_count) return 1; /* If sysfs is not used, use open_count information only. */ if (dm_sysfs_dir()) { - if (dm_device_has_holders(info->major, info->minor)) { + if (dm_device_has_holders(info.major, info.minor)) { log_error("Logical volume %s/%s is used by another device.", lv->vg->name, lv->name); return 0; } - if (dm_device_has_mounted_fs(info->major, info->minor)) { + if (dm_device_has_mounted_fs(info.major, info.minor)) { log_error("Logical volume %s/%s contains a filesystem in use.", lv->vg->name, lv->name); return 0; @@ -719,7 +718,7 @@ int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv } open_count_check_retries = retry_deactivation() ? OPEN_COUNT_CHECK_RETRIES : 1; - while (info->open_count > 0 && open_count_check_retries--) { + while (info.open_count > 0 && open_count_check_retries--) { if (!open_count_check_retries) { log_error("Logical volume %s/%s in use.", lv->vg->name, lv->name); @@ -729,7 +728,7 @@ int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv usleep(OPEN_COUNT_CHECK_USLEEP_DELAY); log_debug_activation("Retrying open_count check for %s/%s.", lv->vg->name, lv->name); - if (!lv_info(cmd, lv, 0, info, 1, 0)) { + if (!lv_info(lv->vg->cmd, lv, 0, &info, 1, 0)) { stack; /* device dissappeared? */ break; } @@ -2104,12 +2103,10 @@ int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, static int _lv_has_open_snapshots(const struct logical_volume *lv) { struct lv_segment *snap_seg; - struct lvinfo info; int r = 0; dm_list_iterate_items_gen(snap_seg, &lv->snapshot_segs, origin_list) - if (!lv_info(lv->vg->cmd, snap_seg->cow, 0, &info, 1, 0) || - !lv_check_not_in_use(lv->vg->cmd, snap_seg->cow, &info)) + if (!lv_check_not_in_use(snap_seg->cow)) r++; if (r) @@ -2140,7 +2137,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logi log_debug_activation("Deactivating %s/%s.", lv->vg->name, lv->name); - if (!lv_info(cmd, lv, 0, &info, 1, 0)) + if (!lv_info(cmd, lv, 0, &info, 0, 0)) goto_out; if (!info.exists) { @@ -2150,7 +2147,7 @@ int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logi if (lv_is_visible(lv) || lv_is_virtual_origin(lv) || lv_is_merging_thin_snapshot(lv)) { - if (!lv_check_not_in_use(cmd, lv, &info)) + if (!lv_check_not_in_use(lv)) goto_out; if (lv_is_origin(lv) && _lv_has_open_snapshots(lv)) diff --git a/lib/activate/activate.h b/lib/activate/activate.h index 17648fc..4f32bca 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -95,8 +95,7 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, struct lvinfo *info, int with_open_count, int with_read_ahead); -int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv, - struct lvinfo *info); +int lv_check_not_in_use(const struct logical_volume *lv); /* * Returns 1 if activate_lv has been set: 1 = activate; 0 = don't. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 81cc997..70e8013 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -5363,7 +5363,6 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, force_t force, int suppress_remove_message) { struct volume_group *vg; - struct lvinfo info; struct logical_volume *format1_origin = NULL; int format1_reload_required = 0; int visible; @@ -5422,9 +5421,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, /* FIXME Ensure not referred to by another existing LVs */ ask_discard = find_config_tree_bool(cmd, devices_issue_discards_CFG, NULL); - if (!lv_is_cache_pool(lv) && - lv_info(cmd, lv, 0, &info, 1, 0)) { - if (!lv_check_not_in_use(cmd, lv, &info)) + if (!lv_is_cache_pool(lv) && lv_is_active_locally(lv)) { + if (!lv_check_not_in_use(lv)) return_0; if ((force == PROMPT) && diff --git a/tools/lvchange.c b/tools/lvchange.c index e520157..7497bde 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -304,8 +304,8 @@ static int lvchange_resync(struct cmd_context *cmd, struct logical_volume *lv) return 0; } - if (lv_info(cmd, lv, 0, &info, 1, 0)) { - if (!lv_check_not_in_use(cmd, lv, &info)) { + if (lv_is_active_locally(lv)) { + if (!lv_check_not_in_use(lv)) { log_error("Can't resync open logical volume \"%s\"", lv->name); return 0; diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 9f9ec5d..1b71866 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -1929,7 +1929,6 @@ static int _lvconvert_raid(struct logical_volume *lv, struct lvconvert_params *l static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volume *cow, struct lvconvert_params *lp) { - struct lvinfo info; struct volume_group *vg = cow->vg; if (!lv_is_cow(cow)) { @@ -1970,8 +1969,8 @@ static int _lvconvert_splitsnapshot(struct cmd_context *cmd, struct logical_volu return ECMD_FAILED; } - if (lv_info(cmd, cow, 0, &info, 1, 0)) { - if (!lv_check_not_in_use(cmd, cow, &info)) + if (lv_is_active_locally(cow)) { + if (!lv_check_not_in_use(cow)) return_ECMD_FAILED; if ((lp->force == PROMPT) && @@ -2165,13 +2164,17 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd, * constructor and DM should prevent appropriate devices from * being open. */ - if (lv_info(cmd, origin, 0, &info, 1, 0) && - !lv_check_not_in_use(cmd, origin, &info)) { - log_print_unless_silent("Can't merge over open origin volume."); - merge_on_activate = 1; - } else if (lv_info(cmd, lv, 0, &info, 1, 0) && - !lv_check_not_in_use(cmd, lv, &info)) { - log_print_unless_silent("Can't merge when snapshot is open."); + if (lv_is_active_locally(origin)) { + if (!lv_check_not_in_use(origin)) { + log_print_unless_silent("Can't merge over open origin volume."); + merge_on_activate = 1; + } else if (!lv_check_not_in_use(lv)) { + log_print_unless_silent("Can't merge when snapshot is open."); + merge_on_activate = 1; + } + } else if (vg_is_clustered(origin->vg) && lv_is_active(origin)) { + /* When it's active somewhere else */ + log_print_unless_silent("Can't check whether remotely active snapshot is open."); merge_on_activate = 1; } diff --git a/tools/vgchange.c b/tools/vgchange.c index 350d8a3..1a597a6 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -197,7 +197,6 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg, { int lv_open, active, monitored = 0, r = 1; const struct lv_list *lvl; - struct lvinfo info; int do_activate = is_change_activating(activate); /* @@ -210,8 +209,7 @@ int vgchange_activate(struct cmd_context *cmd, struct volume_group *vg, if (!do_activate && (lv_open = lvs_in_vg_opened(vg))) { dm_list_iterate_items(lvl, &vg->lvs) if (lv_is_visible(lvl->lv) && - lv_info(cmd, lvl->lv, 0, &info, 1, 0) && - !lv_check_not_in_use(cmd, lvl->lv, &info)) { + !lv_check_not_in_use(lvl->lv)) { log_error("Can't deactivate volume group \"%s\" with %d open " "logical volume(s)", vg->name, lv_open); return 0;
1
0
0
0
master - lvconvert: reoder old snapshot merge
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c96665e6a88780e3…
Commit: c96665e6a88780e31a84f9fb287c2e30c7552b0c Parent: 84cdf85bd2d682f11deeff51e39f3bfb98753829 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Tue Sep 23 20:23:09 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 lvconvert: reoder old snapshot merge Move check for snapshot-merge support before archiving. Split code on 2 paths - with merge_on_activate using vg_write & vg_commit and lv_update_reload call for instant merging. Move printing after backup. --- tools/lvconvert.c | 68 +++++++++++++++++----------------------------------- 1 files changed, 22 insertions(+), 46 deletions(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 0978172..9f9ec5d 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2100,7 +2100,6 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd, struct logical_volume *lv, struct lvconvert_params *lp) { - int r = 0; int merge_on_activate = 0; struct logical_volume *origin = origin_from_cow(lv); struct lv_segment *snap_seg = find_snapshot(lv); @@ -2146,6 +2145,13 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd, return 0; } + if (snap_seg->segtype->ops->target_present && + !snap_seg->segtype->ops->target_present(cmd, snap_seg, NULL)) { + log_error("Can't initialize snapshot merge. " + "Missing support in kernel?"); + return 0; + } + if (!archive(lv->vg)) return_0; @@ -2171,58 +2177,28 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd, init_snapshot_merge(snap_seg, origin); - if (snap_seg->segtype->ops->target_present && - !snap_seg->segtype->ops->target_present(snap_seg->lv->vg->cmd, - snap_seg, NULL)) { - log_error("Can't initialize snapshot merge. " - "Missing support in kernel?"); - return 0; - } - - /* store vg on disk(s) */ - if (!vg_write(lv->vg)) - return_0; - if (merge_on_activate) { - /* commit vg but skip starting the merge */ - if (!vg_commit(lv->vg)) + /* Store and commit vg but skip starting the merge */ + if (!vg_write(lv->vg) || !vg_commit(lv->vg)) + return_0; + backup(lv->vg); + } else { + /* Perform merge */ + if (!lv_update_and_reload(origin)) return_0; - r = 1; - log_print_unless_silent("Merging of snapshot %s will occur on " - "next activation of %s.", - display_lvname(lv), display_lvname(origin)); - goto out; - } - - /* Perform merge */ - if (!suspend_lv(cmd, origin)) { - log_error("Failed to suspend origin %s.", origin->name); - vg_revert(lv->vg); - goto out; - } - - if (!vg_commit(lv->vg)) { - if (!resume_lv(cmd, origin)) - stack; - goto_out; - } - if (!resume_lv(cmd, origin)) { - log_error("Failed to reactivate origin %s.", origin->name); - goto out; + lp->need_polling = 1; + lp->lv_to_poll = origin; } - lp->need_polling = 1; - lp->lv_to_poll = origin; - - r = 1; -out: - backup(lv->vg); - - if (r) + if (merge_on_activate) + log_print_unless_silent("Merging of snapshot %s will occur on " + "next activation of %s.", + display_lvname(lv), display_lvname(origin)); + else log_print_unless_silent("Merging of volume %s started.", lv->name); - return r; + return 1; } static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd,
1
0
0
0
master - cleanup: constify activation usage of lv pointer
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=84cdf85bd2d682f1…
Commit: 84cdf85bd2d682f11deeff51e39f3bfb98753829 Parent: af18e7cfbfee96ff8f5ec2ab795c830b4a6c7da4 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Sep 22 15:50:07 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 cleanup: constify activation usage of lv pointer Let's enforce cheking of write access to LV by compiler. Activation part does never need to write anything to LV so keep LV pointer const. --- lib/activate/activate.c | 86 ++++++++++++++++++++------------------ lib/activate/activate.h | 25 ++++++----- lib/activate/dev_manager.c | 42 +++++++++--------- lib/activate/dev_manager.h | 12 +++--- lib/activate/fs.c | 4 +- lib/activate/fs.h | 2 +- lib/locking/cluster_locking.c | 6 +- lib/locking/external_locking.c | 2 +- lib/locking/file_locking.c | 2 +- lib/locking/locking.c | 4 +- lib/locking/locking.h | 2 +- lib/locking/locking_types.h | 2 +- lib/locking/no_locking.c | 4 +- lib/metadata/lv.h | 2 +- lib/metadata/metadata-exported.h | 14 +++--- lib/metadata/metadata.c | 2 +- lib/metadata/mirror.c | 10 ++-- lib/metadata/raid_manip.c | 5 +- lib/metadata/replicator_manip.c | 6 +- tools/polldaemon.h | 2 +- 20 files changed, 120 insertions(+), 114 deletions(-) diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 7f3a711..82ce6d8 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -108,7 +108,7 @@ int list_lv_modules(struct dm_pool *mem, const struct logical_volume *lv, return 1; } -static int _lv_passes_volumes_filter(struct cmd_context *cmd, struct logical_volume *lv, +static int _lv_passes_volumes_filter(struct cmd_context *cmd, const struct logical_volume *lv, const struct dm_config_node *cn, const int cfg_id) { const struct dm_config_value *cv; @@ -248,7 +248,7 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, { return 0; } -int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv, +int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info) { return 0; @@ -328,35 +328,35 @@ int lv_suspend(struct cmd_context *cmd, const char *lvid_s) } *******/ int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive, - struct logical_volume *ondisk_lv, struct logical_volume *incore_lv) + const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv) { return 1; } -int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, struct logical_volume *lv) +int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, const struct logical_volume *lv) { return 1; } int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, - unsigned exclusive, unsigned revert, struct logical_volume *lv) + unsigned exclusive, unsigned revert, const struct logical_volume *lv) { return 1; } -int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_volume *lv) +int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logical_volume *lv) { return 1; } int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s, - int *activate_lv, struct logical_volume *lv) + int *activate_lv, const struct logical_volume *lv) { return 1; } int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive, int noscan, - int temporary, struct logical_volume *lv) + int temporary, const struct logical_volume *lv) { return 1; } int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s, int exclusive, - int noscan, int temporary, struct logical_volume *lv) + int noscan, int temporary, const struct logical_volume *lv) { return 1; } @@ -405,7 +405,7 @@ int lv_check_transient(struct logical_volume *lv) { return 1; } -int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv, +int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume *lv, const struct lv_activate_opts *laopts, int monitor) { return 1; @@ -426,7 +426,7 @@ int device_is_usable(struct device *dev) { return 0; } -int lv_has_target_type(struct dm_pool *mem, struct logical_volume *lv, +int lv_has_target_type(struct dm_pool *mem, const struct logical_volume *lv, const char *layer, const char *target_type) { return 0; @@ -458,7 +458,7 @@ int activation(void) } static int _passes_activation_filter(struct cmd_context *cmd, - struct logical_volume *lv) + const struct logical_volume *lv) { const struct dm_config_node *cn; @@ -487,7 +487,7 @@ static int _passes_activation_filter(struct cmd_context *cmd, } static int _passes_readonly_filter(struct cmd_context *cmd, - struct logical_volume *lv) + const struct logical_volume *lv) { const struct dm_config_node *cn; @@ -695,7 +695,7 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, #define OPEN_COUNT_CHECK_RETRIES 25 #define OPEN_COUNT_CHECK_USLEEP_DELAY 200000 -int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv, +int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info) { unsigned int open_count_check_retries; @@ -1256,7 +1256,7 @@ static int _lv_active(struct cmd_context *cmd, const struct logical_volume *lv) return info.exists; } -static int _lv_open_count(struct cmd_context *cmd, struct logical_volume *lv) +static int _lv_open_count(struct cmd_context *cmd, const struct logical_volume *lv) { struct lvinfo info; @@ -1268,7 +1268,7 @@ static int _lv_open_count(struct cmd_context *cmd, struct logical_volume *lv) return info.open_count; } -static int _lv_activate_lv(struct logical_volume *lv, struct lv_activate_opts *laopts) +static int _lv_activate_lv(const struct logical_volume *lv, struct lv_activate_opts *laopts) { int r; struct dev_manager *dm; @@ -1283,7 +1283,7 @@ static int _lv_activate_lv(struct logical_volume *lv, struct lv_activate_opts *l return r; } -static int _lv_preload(struct logical_volume *lv, struct lv_activate_opts *laopts, +static int _lv_preload(const struct logical_volume *lv, struct lv_activate_opts *laopts, int *flush_required) { int r = 0; @@ -1305,7 +1305,7 @@ out: return r; } -static int _lv_deactivate(struct logical_volume *lv) +static int _lv_deactivate(const struct logical_volume *lv) { int r; struct dev_manager *dm; @@ -1320,7 +1320,7 @@ static int _lv_deactivate(struct logical_volume *lv) return r; } -static int _lv_suspend_lv(struct logical_volume *lv, struct lv_activate_opts *laopts, +static int _lv_suspend_lv(const struct logical_volume *lv, struct lv_activate_opts *laopts, int lockfs, int flush_required) { int r; @@ -1538,7 +1538,7 @@ char *get_monitor_dso_path(struct cmd_context *cmd, const char *libpath) return path; } -static char *_build_target_uuid(struct cmd_context *cmd, struct logical_volume *lv) +static char *_build_target_uuid(struct cmd_context *cmd, const struct logical_volume *lv) { const char *layer; @@ -1553,7 +1553,7 @@ static char *_build_target_uuid(struct cmd_context *cmd, struct logical_volume * } int target_registered_with_dmeventd(struct cmd_context *cmd, const char *dso, - struct logical_volume *lv, int *pending) + const struct logical_volume *lv, int *pending) { char *uuid; enum dm_event_mask evmask = 0; @@ -1585,7 +1585,7 @@ int target_registered_with_dmeventd(struct cmd_context *cmd, const char *dso, return evmask; } -int target_register_events(struct cmd_context *cmd, const char *dso, struct logical_volume *lv, +int target_register_events(struct cmd_context *cmd, const char *dso, const struct logical_volume *lv, int evmask __attribute__((unused)), int set, int timeout) { char *uuid; @@ -1621,7 +1621,7 @@ int target_register_events(struct cmd_context *cmd, const char *dso, struct logi * Returns 0 if an attempt to (un)monitor the device failed. * Returns 1 otherwise. */ -int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv, +int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume *lv, const struct lv_activate_opts *laopts, int monitor) { #ifdef DMEVENTD @@ -1796,7 +1796,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv, } struct detached_lv_data { - struct logical_volume *lv_pre; + const struct logical_volume *lv_pre; struct lv_activate_opts *laopts; int *flush_required; }; @@ -1817,9 +1817,11 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data) static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s, struct lv_activate_opts *laopts, int error_if_not_suspended, - struct logical_volume *ondisk_lv, struct logical_volume *incore_lv) + const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv) { - struct logical_volume *pvmove_lv = NULL, *ondisk_lv_to_free = NULL, *incore_lv_to_free = NULL; + const struct logical_volume *pvmove_lv = NULL; + const struct logical_volume *ondisk_lv_to_free = NULL; + const struct logical_volume *incore_lv_to_free = NULL; struct lv_list *lvl_pre; struct seg_list *sl; struct lv_segment *snap_seg; @@ -1903,7 +1905,7 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s, detached.laopts = laopts; detached.flush_required = &flush_required; - if (!for_each_sub_lv(ondisk_lv, &_preload_detached_lv, &detached)) + if (!for_each_sub_lv((struct logical_volume *)ondisk_lv, &_preload_detached_lv, &detached)) goto_out; /* @@ -1986,7 +1988,8 @@ out: * * Returns success if the device is not active */ -int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive, struct logical_volume *ondisk_lv, struct logical_volume *incore_lv) +int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive, + const struct logical_volume *ondisk_lv, const struct logical_volume *incore_lv) { struct lv_activate_opts laopts = { .origin_only = origin_only, @@ -2006,9 +2009,9 @@ int lv_suspend(struct cmd_context *cmd, const char *lvid_s) static int _lv_resume(struct cmd_context *cmd, const char *lvid_s, struct lv_activate_opts *laopts, int error_if_not_active, - struct logical_volume *lv) + const struct logical_volume *lv) { - struct logical_volume *lv_to_free = NULL; + const struct logical_volume *lv_to_free = NULL; struct lvinfo info; int r = 0; int messages_only = 0; @@ -2079,7 +2082,7 @@ out: */ int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive, - unsigned revert, struct logical_volume *lv) + unsigned revert, const struct logical_volume *lv) { struct lv_activate_opts laopts = { .origin_only = origin_only, @@ -2090,14 +2093,15 @@ int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s, return _lv_resume(cmd, lvid_s, &laopts, 0, lv); } -int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, struct logical_volume *lv) +int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, + const struct logical_volume *lv) { struct lv_activate_opts laopts = { .origin_only = origin_only, }; return _lv_resume(cmd, lvid_s, &laopts, 1, lv); } -static int _lv_has_open_snapshots(struct logical_volume *lv) +static int _lv_has_open_snapshots(const struct logical_volume *lv) { struct lv_segment *snap_seg; struct lvinfo info; @@ -2115,9 +2119,9 @@ static int _lv_has_open_snapshots(struct logical_volume *lv) return r; } -int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_volume *lv) +int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logical_volume *lv) { - struct logical_volume *lv_to_free = NULL; + const struct logical_volume *lv_to_free = NULL; struct lvinfo info; static const struct lv_activate_opts laopts = { .skip_in_use = 1 }; int r = 0; @@ -2176,9 +2180,9 @@ out: /* Test if LV passes filter */ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s, - int *activate_lv, struct logical_volume *lv) + int *activate_lv, const struct logical_volume *lv) { - struct logical_volume *lv_to_free = NULL; + const struct logical_volume *lv_to_free = NULL; int r = 0; if (!activation()) { @@ -2205,9 +2209,9 @@ out: static int _lv_activate(struct cmd_context *cmd, const char *lvid_s, struct lv_activate_opts *laopts, int filter, - struct logical_volume *lv) + const struct logical_volume *lv) { - struct logical_volume *lv_to_free = NULL; + const struct logical_volume *lv_to_free = NULL; struct lvinfo info; int r = 0; @@ -2297,7 +2301,7 @@ out: /* Activate LV */ int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive, - int noscan, int temporary, struct logical_volume *lv) + int noscan, int temporary, const struct logical_volume *lv) { struct lv_activate_opts laopts = { .exclusive = exclusive, .noscan = noscan, @@ -2311,7 +2315,7 @@ int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive, /* Activate LV only if it passes filter */ int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s, int exclusive, - int noscan, int temporary, struct logical_volume *lv) + int noscan, int temporary, const struct logical_volume *lv) { struct lv_activate_opts laopts = { .exclusive = exclusive, .noscan = noscan, diff --git a/lib/activate/activate.h b/lib/activate/activate.h index b6cf474..17648fc 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -74,15 +74,16 @@ void activation_release(void); void activation_exit(void); /* int lv_suspend(struct cmd_context *cmd, const char *lvid_s); */ -int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive, struct logical_volume *lv_ondisk, struct logical_volume *lv_incore); -int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, struct logical_volume *lv); +int lv_suspend_if_active(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, unsigned exclusive, + const struct logical_volume *lv_ondisk, const struct logical_volume *lv_incore); +int lv_resume(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, const struct logical_volume *lv); int lv_resume_if_active(struct cmd_context *cmd, const char *lvid_s, - unsigned origin_only, unsigned exclusive, unsigned revert, struct logical_volume *lv); + unsigned origin_only, unsigned exclusive, unsigned revert, const struct logical_volume *lv); int lv_activate(struct cmd_context *cmd, const char *lvid_s, int exclusive, - int noscan, int temporary, struct logical_volume *lv); + int noscan, int temporary, const struct logical_volume *lv); int lv_activate_with_filter(struct cmd_context *cmd, const char *lvid_s, int exclusive, - int noscan, int temporary, struct logical_volume *lv); -int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, struct logical_volume *lv); + int noscan, int temporary, const struct logical_volume *lv); +int lv_deactivate(struct cmd_context *cmd, const char *lvid_s, const struct logical_volume *lv); int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv); @@ -94,14 +95,14 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, int use_layer, struct lvinfo *info, int with_open_count, int with_read_ahead); -int lv_check_not_in_use(struct cmd_context *cmd, struct logical_volume *lv, +int lv_check_not_in_use(struct cmd_context *cmd, const struct logical_volume *lv, struct lvinfo *info); /* * Returns 1 if activate_lv has been set: 1 = activate; 0 = don't. */ int lv_activation_filter(struct cmd_context *cmd, const char *lvid_s, - int *activate_lv, struct logical_volume *lv); + int *activate_lv, const struct logical_volume *lv); /* * Checks against the auto_activation_volume_list and * returns 1 if the LV should be activated, 0 otherwise. @@ -147,18 +148,18 @@ int lv_is_active_exclusive(const struct logical_volume *lv); int lv_is_active_exclusive_locally(const struct logical_volume *lv); int lv_is_active_exclusive_remotely(const struct logical_volume *lv); -int lv_has_target_type(struct dm_pool *mem, struct logical_volume *lv, +int lv_has_target_type(struct dm_pool *mem, const struct logical_volume *lv, const char *layer, const char *target_type); -int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv, +int monitor_dev_for_events(struct cmd_context *cmd, const struct logical_volume *lv, const struct lv_activate_opts *laopts, int do_reg); #ifdef DMEVENTD # include "libdevmapper-event.h" char *get_monitor_dso_path(struct cmd_context *cmd, const char *libpath); int target_registered_with_dmeventd(struct cmd_context *cmd, const char *libpath, - struct logical_volume *lv, int *pending); -int target_register_events(struct cmd_context *cmd, const char *dso, struct logical_volume *lv, + const struct logical_volume *lv, int *pending); +int target_register_events(struct cmd_context *cmd, const char *dso, const struct logical_volume *lv, int evmask __attribute__((unused)), int set, int timeout); #endif diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 4ee5a25..0437c69 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -60,11 +60,11 @@ struct dev_manager { }; struct lv_layer { - struct logical_volume *lv; + const struct logical_volume *lv; const char *old_name; }; -int read_only_lv(struct logical_volume *lv, struct lv_activate_opts *laopts) +int read_only_lv(const struct logical_volume *lv, const struct lv_activate_opts *laopts) { return (laopts->read_only || !(lv->status & LVM_WRITE)); } @@ -659,7 +659,7 @@ static int _status(const char *name, const char *uuid, } #endif -int lv_has_target_type(struct dm_pool *mem, struct logical_volume *lv, +int lv_has_target_type(struct dm_pool *mem, const struct logical_volume *lv, const char *layer, const char *target_type) { int r = 0; @@ -888,7 +888,7 @@ static int _percent(struct dev_manager *dm, const char *name, const char *dlid, } /* FIXME Merge with the percent function */ -int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv) +int dev_manager_transient(struct dev_manager *dm, const struct logical_volume *lv) { int r = 0; struct dm_task *dmt; @@ -1534,7 +1534,7 @@ static int _check_udev_fallback(struct cmd_context *cmd) #endif /* UDEV_SYNC_SUPPORT */ -static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *lv, +static uint16_t _get_udev_flags(struct dev_manager *dm, const struct logical_volume *lv, const char *layer, int noscan, int temporary) { uint16_t udev_flags = 0; @@ -1597,7 +1597,7 @@ static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *l } static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, - struct logical_volume *lv, const char *layer) + const struct logical_volume *lv, const char *layer) { char *dlid, *name; struct dm_info info, info2; @@ -1656,7 +1656,7 @@ static int _add_dev_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, */ static int _add_partial_replicator_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, - struct logical_volume *lv) + const struct logical_volume *lv) { struct logical_volume *rlv = first_seg(lv)->replicator; struct replicator_device *rdev; @@ -1881,7 +1881,7 @@ static int _pool_register_callback(struct dev_manager *dm, * Add LV and any known dependencies */ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, - struct logical_volume *lv, int origin_only) + const struct logical_volume *lv, int origin_only) { uint32_t s; struct seg_list *sl; @@ -2025,7 +2025,7 @@ static int _add_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, return 1; } -static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, struct logical_volume *lv, int origin_only) +static struct dm_tree *_create_partial_dtree(struct dev_manager *dm, const struct logical_volume *lv, int origin_only) { struct dm_tree *dtree; @@ -2217,7 +2217,7 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg, static int _add_layer_target_to_dtree(struct dev_manager *dm, struct dm_tree_node *dnode, - struct logical_volume *lv) + const struct logical_volume *lv) { const char *layer_dlid; @@ -2235,8 +2235,8 @@ static int _add_layer_target_to_dtree(struct dev_manager *dm, } static int _add_origin_target_to_dtree(struct dev_manager *dm, - struct dm_tree_node *dnode, - struct logical_volume *lv) + struct dm_tree_node *dnode, + const struct logical_volume *lv) { const char *real_dlid; @@ -2251,7 +2251,7 @@ static int _add_origin_target_to_dtree(struct dev_manager *dm, static int _add_snapshot_merge_target_to_dtree(struct dev_manager *dm, struct dm_tree_node *dnode, - struct logical_volume *lv) + const struct logical_volume *lv) { const char *origin_dlid, *cow_dlid, *merge_dlid; struct lv_segment *merging_snap_seg = find_snapshot(lv); @@ -2280,7 +2280,7 @@ static int _add_snapshot_merge_target_to_dtree(struct dev_manager *dm, static int _add_snapshot_target_to_dtree(struct dev_manager *dm, struct dm_tree_node *dnode, - struct logical_volume *lv, + const struct logical_volume *lv, struct lv_activate_opts *laopts) { const char *origin_dlid; @@ -2334,7 +2334,7 @@ static int _add_target_to_dtree(struct dev_manager *dm, } static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, - struct logical_volume *lv, + const struct logical_volume *lv, struct lv_activate_opts *laopts, const char *layer); @@ -2570,7 +2570,7 @@ static int _set_udev_flags_for_children(struct dev_manager *dm, #endif static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree, - struct logical_volume *lv, struct lv_activate_opts *laopts, + const struct logical_volume *lv, struct lv_activate_opts *laopts, const char *layer) { struct lv_segment *seg; @@ -2866,7 +2866,7 @@ static int _clean_tree(struct dev_manager *dm, struct dm_tree_node *root, char * return 1; } -static int _tree_action(struct dev_manager *dm, struct logical_volume *lv, +static int _tree_action(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts, action_t action) { const size_t DLID_SIZE = ID_LEN + sizeof(UUID_PREFIX) - 1; @@ -2962,7 +2962,7 @@ out_no_root: } /* origin_only may only be set if we are resuming (not activating) an origin LV */ -int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv, +int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts) { laopts->send_messages = 1; @@ -2976,7 +2976,7 @@ int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv, } /* origin_only may only be set if we are resuming (not activating) an origin LV */ -int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, +int dev_manager_preload(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts, int *flush_required) { if (!_tree_action(dm, lv, laopts, PRELOAD)) @@ -2987,7 +2987,7 @@ int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, return 1; } -int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv) +int dev_manager_deactivate(struct dev_manager *dm, const struct logical_volume *lv) { struct lv_activate_opts laopts = { 0 }; @@ -2997,7 +2997,7 @@ int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv) return 1; } -int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv, +int dev_manager_suspend(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts, int lockfs, int flush_required) { dm->flush_required = flush_required; diff --git a/lib/activate/dev_manager.h b/lib/activate/dev_manager.h index 9bdc413..8325bf9 100644 --- a/lib/activate/dev_manager.h +++ b/lib/activate/dev_manager.h @@ -26,7 +26,7 @@ struct dev_manager; struct dm_info; struct device; -int read_only_lv(struct logical_volume *lv, struct lv_activate_opts *laopts); +int read_only_lv(const struct logical_volume *lv, const struct lv_activate_opts *laopts); /* * Constructor and destructor. @@ -76,14 +76,14 @@ int dev_manager_thin_percent(struct dev_manager *dm, int dev_manager_thin_device_id(struct dev_manager *dm, const struct logical_volume *lv, uint32_t *device_id); -int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv, +int dev_manager_suspend(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts, int lockfs, int flush_required); -int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv, +int dev_manager_activate(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts); -int dev_manager_preload(struct dev_manager *dm, struct logical_volume *lv, +int dev_manager_preload(struct dev_manager *dm, const struct logical_volume *lv, struct lv_activate_opts *laopts, int *flush_required); -int dev_manager_deactivate(struct dev_manager *dm, struct logical_volume *lv); -int dev_manager_transient(struct dev_manager *dm, struct logical_volume *lv) __attribute__((nonnull(1, 2))); +int dev_manager_deactivate(struct dev_manager *dm, const struct logical_volume *lv); +int dev_manager_transient(struct dev_manager *dm, const struct logical_volume *lv) __attribute__((nonnull(1, 2))); int dev_manager_mknodes(const struct logical_volume *lv); diff --git a/lib/activate/fs.c b/lib/activate/fs.c index 7483044..66cb15f 100644 --- a/lib/activate/fs.c +++ b/lib/activate/fs.c @@ -468,8 +468,8 @@ int fs_del_lv_byname(const char *dev_dir, const char *vg_name, return _fs_op(FS_DEL, dev_dir, vg_name, lv_name, "", "", check_udev); } -int fs_rename_lv(struct logical_volume *lv, const char *dev, - const char *old_vgname, const char *old_lvname) +int fs_rename_lv(const struct logical_volume *lv, const char *dev, + const char *old_vgname, const char *old_lvname) { if (strcmp(old_vgname, lv->vg->name)) { return diff --git a/lib/activate/fs.h b/lib/activate/fs.h index 9e433c8..fcbc4f1 100644 --- a/lib/activate/fs.h +++ b/lib/activate/fs.h @@ -27,7 +27,7 @@ int fs_add_lv(const struct logical_volume *lv, const char *dev); int fs_del_lv(const struct logical_volume *lv); int fs_del_lv_byname(const char *dev_dir, const char *vg_name, const char *lv_name, int check_udev); -int fs_rename_lv(struct logical_volume *lv, const char *dev, +int fs_rename_lv(const struct logical_volume *lv, const char *dev, const char *old_vgname, const char *old_lvname); /* void fs_unlock(void); moved to activate.h */ uint32_t fs_get_cookie(void); diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c index f2f4c80..800f33d 100644 --- a/lib/locking/cluster_locking.c +++ b/lib/locking/cluster_locking.c @@ -33,7 +33,7 @@ #include <unistd.h> #ifndef CLUSTER_LOCKING_INTERNAL -int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags, struct logical_volume *lv __attribute__((unused))); +int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags, const struct logical_volume *lv __attribute__((unused))); int query_resource(const char *resource, int *mode); void locking_end(void); int locking_init(int type, struct dm_config_tree *cf, uint32_t *flags); @@ -411,9 +411,9 @@ static int _lock_for_cluster(struct cmd_context *cmd, unsigned char clvmd_cmd, /* API entry point for LVM */ #ifdef CLUSTER_LOCKING_INTERNAL static int _lock_resource(struct cmd_context *cmd, const char *resource, - uint32_t flags, struct logical_volume *lv __attribute__((unused))) + uint32_t flags, const struct logical_volume *lv __attribute__((unused))) #else - int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags, struct logical_volume *lv __attribute__((unused))) + int lock_resource(struct cmd_context *cmd, const char *resource, uint32_t flags, const struct logical_volume *lv __attribute__((unused))) #endif { char lockname[PATH_MAX]; diff --git a/lib/locking/external_locking.c b/lib/locking/external_locking.c index bc597ff..430ff08 100644 --- a/lib/locking/external_locking.c +++ b/lib/locking/external_locking.c @@ -30,7 +30,7 @@ static int (*_init_fn) (int type, struct dm_config_tree * cft, static int (*_lock_query_fn) (const char *resource, int *mode) = NULL; static int _lock_resource(struct cmd_context *cmd, const char *resource, - uint32_t flags, struct logical_volume *lv __attribute__((unused))) + uint32_t flags, const struct logical_volume *lv __attribute__((unused))) { if (!_lock_fn) return 0; diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c index e6def3f..5fd0ed3 100644 --- a/lib/locking/file_locking.c +++ b/lib/locking/file_locking.c @@ -42,7 +42,7 @@ static void _reset_file_locking(void) } static int _file_lock_resource(struct cmd_context *cmd, const char *resource, - uint32_t flags, struct logical_volume *lv) + uint32_t flags, const struct logical_volume *lv) { char lockfile[PATH_MAX]; unsigned origin_only = (flags & LCK_ORIGIN_ONLY) ? 1 : 0; diff --git a/lib/locking/locking.c b/lib/locking/locking.c index 544751e..c88a85b 100644 --- a/lib/locking/locking.c +++ b/lib/locking/locking.c @@ -244,7 +244,7 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname) * FIXME This should become VG uuid. */ static int _lock_vol(struct cmd_context *cmd, const char *resource, - uint32_t flags, lv_operation_t lv_op, struct logical_volume *lv) + uint32_t flags, lv_operation_t lv_op, const struct logical_volume *lv) { uint32_t lck_type = flags & LCK_TYPE_MASK; uint32_t lck_scope = flags & LCK_SCOPE_MASK; @@ -295,7 +295,7 @@ out: return ret; } -int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, struct logical_volume *lv) +int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, const struct logical_volume *lv) { char resource[258] __attribute__((aligned(8))); lv_operation_t lv_op; diff --git a/lib/locking/locking.h b/lib/locking/locking.h index 1351cd2..c1affb4 100644 --- a/lib/locking/locking.h +++ b/lib/locking/locking.h @@ -49,7 +49,7 @@ int remote_lock_held(const char *vol, int *exclusive); * Lock/unlock an individual logical volume * char *vol holds lvid */ -int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, struct logical_volume *lv); +int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, const struct logical_volume *lv); /* * Internal locking representation. diff --git a/lib/locking/locking_types.h b/lib/locking/locking_types.h index 5fa5cba..8280e4f 100644 --- a/lib/locking/locking_types.h +++ b/lib/locking/locking_types.h @@ -17,7 +17,7 @@ #include "config.h" typedef int (*lock_resource_fn) (struct cmd_context * cmd, const char *resource, - uint32_t flags, struct logical_volume *lv); + uint32_t flags, const struct logical_volume *lv); typedef int (*query_resource_fn) (const char *resource, int *mode); typedef void (*fin_lock_fn) (void); diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c index ab95933..b1dcb30 100644 --- a/lib/locking/no_locking.c +++ b/lib/locking/no_locking.c @@ -34,7 +34,7 @@ static void _no_reset_locking(void) } static int _no_lock_resource(struct cmd_context *cmd, const char *resource, - uint32_t flags, struct logical_volume *lv) + uint32_t flags, const struct logical_volume *lv) { switch (flags & LCK_SCOPE_MASK) { case LCK_ACTIVATION: @@ -79,7 +79,7 @@ static int _no_query_resource(const char *resource, int *mode) static int _readonly_lock_resource(struct cmd_context *cmd, const char *resource, - uint32_t flags, struct logical_volume *lv) + uint32_t flags, const struct logical_volume *lv) { if ((flags & LCK_TYPE_MASK) == LCK_WRITE && (flags & LCK_SCOPE_MASK) == LCK_VG && diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h index 3a21f94..d43bc01 100644 --- a/lib/metadata/lv.h +++ b/lib/metadata/lv.h @@ -95,7 +95,7 @@ int lv_active_change(struct cmd_context *cmd, struct logical_volume *lv, enum activation_change activate); char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv); const struct logical_volume *lv_lock_holder(const struct logical_volume *lv); -struct logical_volume *lv_ondisk(struct logical_volume *lv); +const struct logical_volume *lv_ondisk(const struct logical_volume *lv); struct profile *lv_config_profile(const struct logical_volume *lv); char *lv_profile_dup(struct dm_pool *mem, const struct logical_volume *lv); int lv_mirror_image_in_sync(const struct logical_volume *lv); diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 4993c22..5787f5a 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -1065,7 +1065,7 @@ int lv_raid_reshape(struct logical_volume *lv, int lv_raid_replace(struct logical_volume *lv, struct dm_list *remove_pvs, struct dm_list *allocate_pvs); int lv_raid_remove_missing(struct logical_volume *lv); -int partial_raid_lv_supports_degraded_activation(struct logical_volume *lv); +int partial_raid_lv_supports_degraded_activation(const struct logical_volume *lv); /* -- metadata/raid_manip.c */ /* ++ metadata/cache_manip.c */ @@ -1087,10 +1087,10 @@ struct cmd_vg *cmd_vg_lookup(struct dm_list *cmd_vgs, int cmd_vg_read(struct cmd_context *cmd, struct dm_list *cmd_vgs); void free_cmd_vgs(struct dm_list *cmd_vgs); -int find_replicator_vgs(struct logical_volume *lv); +int find_replicator_vgs(const struct logical_volume *lv); -int lv_read_replicator_vgs(struct logical_volume *lv); -void lv_release_replicator_vgs(struct logical_volume *lv); +int lv_read_replicator_vgs(const struct logical_volume *lv); +void lv_release_replicator_vgs(const struct logical_volume *lv); struct logical_volume *find_pvmove_lv(struct volume_group *vg, struct device *dev, uint64_t lv_type); @@ -1099,9 +1099,9 @@ struct logical_volume *find_pvmove_lv_from_pvname(struct cmd_context *cmd, const char *name, const char *uuid, uint64_t lv_type); -struct logical_volume *find_pvmove_lv_in_lv(struct logical_volume *lv); -const char *get_pvmove_pvname_from_lv(struct logical_volume *lv); -const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr); +const struct logical_volume *find_pvmove_lv_in_lv(const struct logical_volume *lv); +const char *get_pvmove_pvname_from_lv(const struct logical_volume *lv); +const char *get_pvmove_pvname_from_lv_mirr(const struct logical_volume *lv_mirr); struct dm_list *lvs_using_lv(struct cmd_context *cmd, struct volume_group *vg, struct logical_volume *lv); diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 354dc68..04d63eb 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -4805,7 +4805,7 @@ char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl) return dm_pool_end_object(mem); } -struct logical_volume *lv_ondisk(struct logical_volume *lv) +const struct logical_volume *lv_ondisk(const struct logical_volume *lv) { struct volume_group *vg; struct lv_list *lvl; diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index 1206a1c..d89e5cd 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -1504,7 +1504,7 @@ int remove_mirrors_from_segments(struct logical_volume *lv, return 1; } -const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr) +const char *get_pvmove_pvname_from_lv_mirr(const struct logical_volume *lv_mirr) { struct lv_segment *seg; @@ -1523,9 +1523,9 @@ const char *get_pvmove_pvname_from_lv_mirr(struct logical_volume *lv_mirr) /* * Find first pvmove LV referenced by a segment of an LV. */ -struct logical_volume *find_pvmove_lv_in_lv(struct logical_volume *lv) +const struct logical_volume *find_pvmove_lv_in_lv(const struct logical_volume *lv) { - struct lv_segment *seg; + const struct lv_segment *seg; uint32_t s; dm_list_iterate_items(seg, &lv->segments) { @@ -1540,9 +1540,9 @@ struct logical_volume *find_pvmove_lv_in_lv(struct logical_volume *lv) return NULL; } -const char *get_pvmove_pvname_from_lv(struct logical_volume *lv) +const char *get_pvmove_pvname_from_lv(const struct logical_volume *lv) { - struct logical_volume *pvmove_lv; + const struct logical_volume *pvmove_lv; pvmove_lv = find_pvmove_lv_in_lv(lv); diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index f494f11..c07de90 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -1822,7 +1822,7 @@ int lv_raid_remove_missing(struct logical_volume *lv) } /* Return 1 if a partial raid LV can be activated redundantly */ -static int _partial_raid_lv_is_redundant(struct logical_volume *lv) +static int _partial_raid_lv_is_redundant(const struct logical_volume *lv) { struct lv_segment *raid_seg = first_seg(lv); uint32_t copies; @@ -1911,9 +1911,10 @@ static int _lv_may_be_activated_in_degraded_mode(struct logical_volume *lv, void return 1; } -int partial_raid_lv_supports_degraded_activation(struct logical_volume *lv) +int partial_raid_lv_supports_degraded_activation(const struct logical_volume *clv) { int not_capable = 0; + struct logical_volume * lv = (struct logical_volume *)clv; /* drop const */ if (!_lv_may_be_activated_in_degraded_mode(lv, ¬_capable) || not_capable) return_0; diff --git a/lib/metadata/replicator_manip.c b/lib/metadata/replicator_manip.c index f264c7c..54dc759 100644 --- a/lib/metadata/replicator_manip.c +++ b/lib/metadata/replicator_manip.c @@ -600,7 +600,7 @@ void free_cmd_vgs(struct dm_list *cmd_vgs) * Find all needed remote VGs for processing given LV. * Missing VGs are added to VG's cmd_vg list and flag cmd_missing_vgs is set. */ -int find_replicator_vgs(struct logical_volume *lv) +int find_replicator_vgs(const struct logical_volume *lv) { struct replicator_site *rsite; int ret = 1; @@ -632,7 +632,7 @@ int find_replicator_vgs(struct logical_volume *lv) * Read all remote VGs from lv's replicator sites. * Function is used in activation context and needs all VGs already locked. */ -int lv_read_replicator_vgs(struct logical_volume *lv) +int lv_read_replicator_vgs(const struct logical_volume *lv) { struct replicator_device *rdev; struct replicator_site *rsite; @@ -670,7 +670,7 @@ bad: * Release all VG resources taken by lv's replicator sites. * Function is used in activation context and needs all VGs already locked. */ -void lv_release_replicator_vgs(struct logical_volume *lv) +void lv_release_replicator_vgs(const struct logical_volume *lv) { struct replicator_site *rsite; diff --git a/tools/polldaemon.h b/tools/polldaemon.h index 78ea783..89c3aae 100644 --- a/tools/polldaemon.h +++ b/tools/polldaemon.h @@ -28,7 +28,7 @@ typedef enum { struct daemon_parms; struct poll_functions { - const char *(*get_copy_name_from_lv) (struct logical_volume *lv); + const char *(*get_copy_name_from_lv) (const struct logical_volume *lv); struct volume_group *(*get_copy_vg) (struct cmd_context *cmd, const char *name, const char *uuid);
1
0
0
0
master - cleanup: move printing after backup
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=af18e7cfbfee96ff…
Commit: af18e7cfbfee96ff8f5ec2ab795c830b4a6c7da4 Parent: 9f82a7d11469400fcf5ca01b4444b3ba25ba06b8 Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Mon Sep 22 14:06:52 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 cleanup: move printing after backup Print successful result after making backup. In this place we are sure to not keep memlock. --- tools/lvconvert.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 57975d1..0978172 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -2216,10 +2216,12 @@ static int _lvconvert_merge_old_snapshot(struct cmd_context *cmd, lp->lv_to_poll = origin; r = 1; - log_print_unless_silent("Merging of volume %s started.", lv->name); out: backup(lv->vg); + if (r) + log_print_unless_silent("Merging of volume %s started.", lv->name); + return r; } @@ -2296,13 +2298,14 @@ static int _lvconvert_merge_thin_snapshot(struct cmd_context *cmd, if (!vg_write(lv->vg) || !vg_commit(lv->vg)) return_0; - log_print_unless_silent("Merging of thin snapshot %s will occur on " - "next activation of %s.", - display_lvname(lv), display_lvname(origin)); r = 1; out: backup(lv->vg); + if (r) + log_print_unless_silent("Merging of thin snapshot %s will occur on " + "next activation of %s.", + display_lvname(lv), display_lvname(origin)); return r; } @@ -3017,18 +3020,18 @@ mda_write: goto out; } - log_print_unless_silent("Converted %s to %s pool.", - display_lvname(pool_lv), - (segtype_is_cache_pool(lp->segtype)) ? - "cache" : "thin"); - r = 1; - lp->pool_data_lv = pool_lv; out: backup(vg); + if (r) + log_print_unless_silent("Converted %s to %s pool.", + display_lvname(pool_lv), + (segtype_is_cache_pool(lp->segtype)) ? + "cache" : "thin"); + return r; #if 0 revert_new_lv:
1
0
0
0
master - validation: move check for spare correctness
by Zdenek Kabelac
24 Sep '14
24 Sep '14
Gitweb:
http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9f82a7d11469400f…
Commit: 9f82a7d11469400fcf5ca01b4444b3ba25ba06b8 Parent: 93fbef1a45948c1f97fe484b4dd65179afa5051d Author: Zdenek Kabelac <zkabelac(a)redhat.com> AuthorDate: Sun Sep 21 11:34:50 2014 +0200 Committer: Zdenek Kabelac <zkabelac(a)redhat.com> CommitterDate: Wed Sep 24 10:54:47 2014 +0200 validation: move check for spare correctness Check lv feature when we check LVs --- lib/metadata/metadata.c | 26 +++++++++++++------------- 1 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 464b8bc..354dc68 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -2492,6 +2492,19 @@ int vg_validate(struct volume_group *vg) r = 0; } + if (lv_is_pool_metadata_spare(lvl->lv)) { + if (++spare_count > 1) { + log_error(INTERNAL_ERROR "LV %s is %u. pool metadata spare (>1).", + lvl->lv->name, spare_count); + r = 0; + } + if (vg->pool_metadata_spare_lv != lvl->lv) { + log_error(INTERNAL_ERROR "LV %s is not vg pool metadata spare.", + lvl->lv->name); + r = 0; + } + } + if (lv_is_cow(lvl->lv)) num_snapshots++; @@ -2590,19 +2603,6 @@ int vg_validate(struct volume_group *vg) r = 0; } - if (lv_is_pool_metadata_spare(lvl->lv)) { - if (++spare_count > 1) { - log_error(INTERNAL_ERROR "LV %s is %u. pool metadata spare (>1).", - lvl->lv->name, spare_count); - r = 0; - } - if (vg->pool_metadata_spare_lv != lvl->lv) { - log_error(INTERNAL_ERROR "LV %s is not vg pool metadata spare.", - lvl->lv->name); - r = 0; - } - } - if (!check_lv_segments(lvl->lv, 1)) { log_error(INTERNAL_ERROR "LV segments corrupted in %s.", lvl->lv->name);
1
0
0
0
← Newer
1
2
3
4
5
6
7
...
16
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Results per page:
10
25
50
100
200