1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

activate: add lv_layer function

Add function to return layer name for LV.
This commit is contained in:
Zdenek Kabelac 2013-02-01 11:09:34 +01:00
parent 4f439707fd
commit ca7abbce8a
4 changed files with 16 additions and 10 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 - 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 Report partial and in-sync RAID attribute based on kernel status
Fix blkdeactivate to handle nested mountpoints and mangled mount paths. Fix blkdeactivate to handle nested mountpoints and mangled mount paths.
Set locales with LC_ALL instead of lower priority LANG variable. Set locales with LC_ALL instead of lower priority LANG variable.

View File

@ -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 lvinfo *info, int with_open_count, int with_read_ahead)
{ {
struct dm_info dminfo; struct dm_info dminfo;
const char *layer;
if (!activation()) if (!activation())
return 0; return 0;
@ -621,15 +620,10 @@ 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 */ fs_unlock(); /* For non clustered - wait if there are non-delete ops */
} }
if (use_layer && lv_is_thin_pool(lv)) if (!dev_manager_info(lv->vg->cmd->mem, lv,
layer = "tpool"; (use_layer) ? lv_layer(lv) : NULL,
else if (use_layer && lv_is_origin(lv)) with_open_count, with_read_ahead,
layer = "real"; &dminfo, &info->read_ahead))
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; return_0;
info->exists = dminfo.exists; info->exists = dminfo.exists;

View File

@ -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; 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) int lv_kernel_minor(const struct logical_volume *lv)
{ {
struct lvinfo info; struct lvinfo info;

View File

@ -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); char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv);
int lv_set_creation(struct logical_volume *lv, int lv_set_creation(struct logical_volume *lv,
const char *hostname, uint64_t timestamp); const char *hostname, uint64_t timestamp);
const char *lv_layer(const struct logical_volume *lv);
#endif /* _LVM_LV_H */ #endif /* _LVM_LV_H */