master - activate: add lv_layer function
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ca7abbce8a705c1e690bcc2b0c08c4b510843046 Commit: ca7abbce8a705c1e690bcc2b0c08c4b510843046 Parent: 4f439707fd4a8837f930c14076bc662ca5c19844 Author: Zdenek Kabelac <[email protected]> AuthorDate: Fri Feb 1 11:09:34 2013 +0100 Committer: Zdenek Kabelac <[email protected]> CommitterDate: Mon Feb 4 19:01:10 2013 +0100
activate: add lv_layer function
Add function to return layer name for LV.
--- WHATS_NEW | 1 + lib/activate/activate.c | 14 ++++---------- lib/metadata/lv.c | 10 ++++++++++ lib/metadata/lv.h | 1 + 4 files changed, 16 insertions(+), 10 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.99 - =================================== + Add internal function lv_layer() to obtain layer name for LV. Report partial and in-sync RAID attribute based on kernel status Fix blkdeactivate to handle nested mountpoints and mangled mount paths. Set locales with LC_ALL instead of lower priority LANG variable.
lib/activate/activate.c +4 -10
@@ -604,7 +604,6 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_la struct lvinfo *info, int with_open_count, int with_read_ahead) { struct dm_info dminfo; -const char *layer;if (!activation ())return 0 ;
@@ -621,15 +620,10 @@ int lv_info(struct cmd_context *cmd, const struct logical_volume *lv, int use_lafs_unlock ();/* For non clustered - wait if there are non-delete ops */ } -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)) +if (!dev_manager_info (lv->vg->cmd->mem, lv, + (use_layer) ?lv_layer (lv) :NULL , + with_open_count, with_read_ahead, + &dminfo, &info->read_ahead)) return_0; info->exists = dminfo.exists;
lib/metadata/lv.c +10 -0
@@ -225,6 +225,16 @@ char *lv_metadata_lv_dup(struct dm_pool *mem, const struct logical_volume *lv) dm_pool_strdup(mem, first_seg(lv)->metadata_lv->name) : NULL; } +const char *lv_layer (const struct logical_volume *lv) +{ +if (lv_is_thin_pool (lv)) +return "tpool" ; +else if (lv_is_origin (lv)) +return "real" ; + +return NULL ; +} +int lv_kernel_minor (const struct logical_volume *lv) {struct lvinfo info;
lib/metadata/lv.h +1 -0
@@ -82,4 +82,5 @@ char *lv_time_dup(struct dm_pool *mem, const struct logical_volume *lv);char *lv_host_dup (struct dm_pool *mem,const struct logical_volume *lv);int lv_set_creation (struct logical_volume *lv,const char *hostname,uint64_t timestamp); +const char *lv_layer (const struct logical_volume *lv);#endif /* _LVM_LV_H */