mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Thin add lv_thin_pool_transaction_id
Easy function to get transaction_id status value.
This commit is contained in:
parent
4173a22832
commit
bdba904d7c
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.89 -
|
Version 2.02.89 -
|
||||||
==================================
|
==================================
|
||||||
|
Add lv_thin_pool_transaction_id to read the transaction_id value.
|
||||||
Use suspend|resume_origin_only when up-converting RAID, as mirrors do.
|
Use suspend|resume_origin_only when up-converting RAID, as mirrors do.
|
||||||
Fix the way RAID meta LVs are added to the dependency tree.
|
Fix the way RAID meta LVs are added to the dependency tree.
|
||||||
Change exclusive LV activation logic to try local node before remote nodes.
|
Change exclusive LV activation logic to try local node before remote nodes.
|
||||||
|
@ -762,6 +762,35 @@ int lv_thin_percent(const struct logical_volume *lv,
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns 1 if transaction_id set, else 0 on failure.
|
||||||
|
*/
|
||||||
|
int lv_thin_pool_transaction_id(const struct logical_volume *lv,
|
||||||
|
uint64_t *transaction_id)
|
||||||
|
{
|
||||||
|
int r;
|
||||||
|
struct dev_manager *dm;
|
||||||
|
struct dm_status_thin_pool *status;
|
||||||
|
|
||||||
|
if (!activation())
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
log_debug("Checking thin percent for LV %s/%s",
|
||||||
|
lv->vg->name, lv->name);
|
||||||
|
|
||||||
|
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
if (!(r = dev_manager_thin_pool_status(dm, lv, &status)))
|
||||||
|
stack;
|
||||||
|
else
|
||||||
|
*transaction_id = status->transaction_id;
|
||||||
|
|
||||||
|
dev_manager_destroy(dm);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv)
|
static int _lv_active(struct cmd_context *cmd, struct logical_volume *lv)
|
||||||
{
|
{
|
||||||
struct lvinfo info;
|
struct lvinfo info;
|
||||||
|
@ -105,6 +105,8 @@ int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
|
|||||||
percent_t *percent);
|
percent_t *percent);
|
||||||
int lv_thin_percent(const struct logical_volume *lv, int mapped,
|
int lv_thin_percent(const struct logical_volume *lv, int mapped,
|
||||||
percent_t *percent);
|
percent_t *percent);
|
||||||
|
int lv_thin_pool_transaction_id(const struct logical_volume *lv,
|
||||||
|
uint64_t *transaction_id);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return number of LVs in the VG that are active.
|
* Return number of LVs in the VG that are active.
|
||||||
|
@ -882,6 +882,48 @@ static int _belong_to_vg(const char *vgname, const char *name)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
int dev_manager_thin_pool_status(struct dev_manager *dm,
|
||||||
|
const struct logical_volume *lv,
|
||||||
|
struct dm_status_thin_pool **status)
|
||||||
|
{
|
||||||
|
const char *dlid;
|
||||||
|
struct dm_task *dmt;
|
||||||
|
struct dm_info info;
|
||||||
|
uint64_t start, length;
|
||||||
|
char *type = NULL;
|
||||||
|
char *params = NULL;
|
||||||
|
int r = 0;
|
||||||
|
|
||||||
|
/* Build dlid for the thin pool layer */
|
||||||
|
if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, _thin_layer)))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
log_debug("Getting thin pool device status for %s.", lv->name);
|
||||||
|
|
||||||
|
if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0)))
|
||||||
|
return_0;
|
||||||
|
|
||||||
|
if (!dm_task_no_open_count(dmt))
|
||||||
|
log_error("Failed to disable open_count.");
|
||||||
|
|
||||||
|
if (!dm_task_run(dmt))
|
||||||
|
goto_out;
|
||||||
|
|
||||||
|
if (!dm_task_get_info(dmt, &info) || !info.exists)
|
||||||
|
goto_out;
|
||||||
|
|
||||||
|
dm_get_next_target(dmt, NULL, &start, &length, &type, ¶ms);
|
||||||
|
|
||||||
|
if (!dm_get_status_thin_pool(dm->mem, params, status))
|
||||||
|
goto_out;
|
||||||
|
|
||||||
|
r = 1;
|
||||||
|
out:
|
||||||
|
dm_task_destroy(dmt);
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
||||||
const struct logical_volume *lv,
|
const struct logical_volume *lv,
|
||||||
int metadata, percent_t *percent)
|
int metadata, percent_t *percent)
|
||||||
|
@ -54,6 +54,9 @@ int dev_manager_snapshot_percent(struct dev_manager *dm,
|
|||||||
int dev_manager_mirror_percent(struct dev_manager *dm,
|
int dev_manager_mirror_percent(struct dev_manager *dm,
|
||||||
const struct logical_volume *lv, int wait,
|
const struct logical_volume *lv, int wait,
|
||||||
percent_t *percent, uint32_t *event_nr);
|
percent_t *percent, uint32_t *event_nr);
|
||||||
|
int dev_manager_thin_pool_status(struct dev_manager *dm,
|
||||||
|
const struct logical_volume *lv,
|
||||||
|
struct dm_status_thin_pool **status);
|
||||||
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
||||||
const struct logical_volume *lv,
|
const struct logical_volume *lv,
|
||||||
int metadata, percent_t *percent);
|
int metadata, percent_t *percent);
|
||||||
|
Loading…
Reference in New Issue
Block a user