From e8905d98164615f5217fc5ef14ea642c403c1876 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Wed, 25 Jan 2012 13:10:26 +0000 Subject: [PATCH] Rename origin_only to more generic use_layer flag Since now we have more layered devices i.e. thin volumes - support selection of layer via flag. --- WHATS_NEW | 1 + lib/activate/activate.c | 25 ++++++++++++++----------- lib/activate/activate.h | 7 +++---- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index 4176b7a1e..b75d530a5 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.89 - ================================== + Rename origin_only parameter to more generic flag use_layer for lv_info(). Thin pools have segment fields thin_count, zero, transaction_id. Each new created LV volume has creation lv_time and lv_host. Print data_percent and metadata_percent for verbose lvs. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 87e34ecf8..59fafcb76 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -151,13 +151,12 @@ int lvm_dm_prefix_check(const char *sysfs_dir, int major, int minor, const char { return 0; } -int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, unsigned origin_only, +int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer, struct lvinfo *info, int with_open_count, int with_read_ahead) { return 0; } -int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, - unsigned origin_only, +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) { return 0; @@ -532,10 +531,11 @@ int target_present(struct cmd_context *cmd, const char *target_name, /* * Returns 1 if info structure populated, else 0 on failure. */ -int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, unsigned origin_only, +int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer, struct lvinfo *info, int with_open_count, int with_read_ahead) { struct dm_info dminfo; + const char *layer; if (!activation()) return 0; @@ -552,7 +552,14 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, unsigned o fs_unlock(); /* For non clustered - wait if there are non-delete ops */ } - if (!dev_manager_info(lv->vg->cmd->mem, lv, (lv_is_origin(lv) && origin_only) ? "real" : NULL, with_open_count, + if (use_layer && lv_is_thin_pool(lv)) + layer = "tpool"; + else if (use_layer && lv_is_origin(lv)) + layer = "real"; + else + layer = NULL; + + if (!dev_manager_info(lv->vg->cmd->mem, lv, layer, with_open_count, with_read_ahead, &dminfo, &info->read_ahead)) return_0; @@ -568,8 +575,7 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, unsigned o return 1; } -int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, - unsigned origin_only, +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 r; @@ -578,10 +584,7 @@ int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, if (!(lv = lv_from_lvid(cmd, lvid_s, 0))) return 0; - if (!lv_is_origin(lv)) - origin_only = 0; - - r = lv_info(cmd, lv, origin_only, info, with_open_count, with_read_ahead); + r = lv_info(cmd, lv, use_layer, info, with_open_count, with_read_ahead); release_vg(lv->vg); return r; diff --git a/lib/activate/activate.h b/lib/activate/activate.h index f6c6f54f1..b866fd552 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -79,10 +79,9 @@ int lv_mknodes(struct cmd_context *cmd, const struct logical_volume *lv); /* * Returns 1 if info structure has been populated, else 0. */ -int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, - unsigned origin_only, struct lvinfo *info, - int with_open_count, int with_read_ahead); -int lv_info_by_lvid(struct cmd_context *cmd, const char *lvid_s, unsigned origin_only, +int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_layer, + struct lvinfo *info, int with_open_count, int with_read_ahead); +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, -- 2.43.5