mirror of
git://sourceware.org/git/lvm2.git
synced 2025-03-10 16:58:47 +03:00
Making adjustments to go along with the changes to the kernel.
A patch to the kernel, adding the 'luid' field to dm_ulog_request, will allow us to properly identify log instances. We will now be able to definitively identify which logs are to be removed/ suspended/resumed. This replaces the old faulty behavior of assuming the logs were the same if they had the same UUID and incrementing/decrementing a reference count.
This commit is contained in:
parent
1df7ef9a05
commit
5c8922b724
@ -101,6 +101,7 @@ struct clog_cpg {
|
|||||||
uint32_t lowest_id;
|
uint32_t lowest_id;
|
||||||
cpg_handle_t handle;
|
cpg_handle_t handle;
|
||||||
struct cpg_name name;
|
struct cpg_name name;
|
||||||
|
uint64_t luid;
|
||||||
|
|
||||||
/* Are we the first, or have we received checkpoint? */
|
/* Are we the first, or have we received checkpoint? */
|
||||||
int state;
|
int state;
|
||||||
@ -147,6 +148,12 @@ int cluster_send(struct clog_request *rq)
|
|||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Once the request heads for the cluster, the luid looses
|
||||||
|
* all its meaning.
|
||||||
|
*/
|
||||||
|
rq->u_rq.luid = 0;
|
||||||
|
|
||||||
iov.iov_base = rq;
|
iov.iov_base = rq;
|
||||||
iov.iov_len = sizeof(struct clog_request) + rq->u_rq.data_size;
|
iov.iov_len = sizeof(struct clog_request) + rq->u_rq.data_size;
|
||||||
|
|
||||||
@ -357,7 +364,8 @@ static struct checkpoint_data *prepare_checkpoint(struct clog_cpg *entry,
|
|||||||
new->requester = cp_requester;
|
new->requester = cp_requester;
|
||||||
strncpy(new->uuid, entry->name.value, entry->name.length);
|
strncpy(new->uuid, entry->name.value, entry->name.length);
|
||||||
|
|
||||||
new->bitmap_size = push_state(entry->name.value, "clean_bits",
|
new->bitmap_size = push_state(entry->name.value, entry->luid,
|
||||||
|
"clean_bits",
|
||||||
&new->clean_bits, cp_requester);
|
&new->clean_bits, cp_requester);
|
||||||
if (new->bitmap_size <= 0) {
|
if (new->bitmap_size <= 0) {
|
||||||
LOG_ERROR("Failed to store clean_bits to checkpoint for node %u",
|
LOG_ERROR("Failed to store clean_bits to checkpoint for node %u",
|
||||||
@ -366,8 +374,9 @@ static struct checkpoint_data *prepare_checkpoint(struct clog_cpg *entry,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
new->bitmap_size = push_state(entry->name.value,
|
new->bitmap_size = push_state(entry->name.value, entry->luid,
|
||||||
"sync_bits", &new->sync_bits, cp_requester);
|
"sync_bits",
|
||||||
|
&new->sync_bits, cp_requester);
|
||||||
if (new->bitmap_size <= 0) {
|
if (new->bitmap_size <= 0) {
|
||||||
LOG_ERROR("Failed to store sync_bits to checkpoint for node %u",
|
LOG_ERROR("Failed to store sync_bits to checkpoint for node %u",
|
||||||
new->requester);
|
new->requester);
|
||||||
@ -376,7 +385,9 @@ static struct checkpoint_data *prepare_checkpoint(struct clog_cpg *entry,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = push_state(entry->name.value, "recovering_region", &new->recovering_region, cp_requester);
|
r = push_state(entry->name.value, entry->luid,
|
||||||
|
"recovering_region",
|
||||||
|
&new->recovering_region, cp_requester);
|
||||||
if (r <= 0) {
|
if (r <= 0) {
|
||||||
LOG_ERROR("Failed to store recovering_region to checkpoint for node %u",
|
LOG_ERROR("Failed to store recovering_region to checkpoint for node %u",
|
||||||
new->requester);
|
new->requester);
|
||||||
@ -703,7 +714,7 @@ init_retry:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (iov.readSize) {
|
if (iov.readSize) {
|
||||||
if (pull_state(entry->name.value,
|
if (pull_state(entry->name.value, entry->luid,
|
||||||
(char *)desc.sectionId.id, bitmap,
|
(char *)desc.sectionId.id, bitmap,
|
||||||
iov.readSize)) {
|
iov.readSize)) {
|
||||||
LOG_ERROR("Error loading state");
|
LOG_ERROR("Error loading state");
|
||||||
@ -1235,7 +1246,7 @@ static void cpg_leave_callback(struct clog_cpg *match,
|
|||||||
cpg_fd_get(match->handle, &fd);
|
cpg_fd_get(match->handle, &fd);
|
||||||
links_unregister(fd);
|
links_unregister(fd);
|
||||||
|
|
||||||
cluster_postsuspend(match->name.value);
|
cluster_postsuspend(match->name.value, match->luid);
|
||||||
|
|
||||||
list_for_each_entry_safe(rq, n, &match->working_list, list) {
|
list_for_each_entry_safe(rq, n, &match->working_list, list) {
|
||||||
list_del_init(&rq->list);
|
list_del_init(&rq->list);
|
||||||
@ -1437,7 +1448,7 @@ unlink_retry:
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int create_cluster_cpg(char *str)
|
int create_cluster_cpg(char *uuid, uint64_t luid)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
int size;
|
int size;
|
||||||
@ -1445,8 +1456,8 @@ int create_cluster_cpg(char *str)
|
|||||||
struct clog_cpg *tmp, *tmp2;
|
struct clog_cpg *tmp, *tmp2;
|
||||||
|
|
||||||
list_for_each_entry_safe(tmp, tmp2, &clog_cpg_list, list)
|
list_for_each_entry_safe(tmp, tmp2, &clog_cpg_list, list)
|
||||||
if (!strncmp(tmp->name.value, str, CPG_MAX_NAME_LENGTH)) {
|
if (!strncmp(tmp->name.value, uuid, CPG_MAX_NAME_LENGTH)) {
|
||||||
LOG_ERROR("Log entry already exists: %s", str);
|
LOG_ERROR("Log entry already exists: %s", uuid);
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1461,10 +1472,11 @@ int create_cluster_cpg(char *str)
|
|||||||
INIT_LIST_HEAD(&new->startup_list);
|
INIT_LIST_HEAD(&new->startup_list);
|
||||||
INIT_LIST_HEAD(&new->working_list);
|
INIT_LIST_HEAD(&new->working_list);
|
||||||
|
|
||||||
size = ((strlen(str) + 1) > CPG_MAX_NAME_LENGTH) ?
|
size = ((strlen(uuid) + 1) > CPG_MAX_NAME_LENGTH) ?
|
||||||
CPG_MAX_NAME_LENGTH : (strlen(str) + 1);
|
CPG_MAX_NAME_LENGTH : (strlen(uuid) + 1);
|
||||||
strncpy(new->name.value, str, size);
|
strncpy(new->name.value, uuid, size);
|
||||||
new->name.length = size;
|
new->name.length = size;
|
||||||
|
new->luid = luid;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ensure there are no stale checkpoints around before we join
|
* Ensure there are no stale checkpoints around before we join
|
||||||
@ -1560,12 +1572,12 @@ static int _destroy_cluster_cpg(struct clog_cpg *del)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int destroy_cluster_cpg(char *str)
|
int destroy_cluster_cpg(char *uuid)
|
||||||
{
|
{
|
||||||
struct clog_cpg *del, *tmp;
|
struct clog_cpg *del, *tmp;
|
||||||
|
|
||||||
list_for_each_entry_safe(del, tmp, &clog_cpg_list, list)
|
list_for_each_entry_safe(del, tmp, &clog_cpg_list, list)
|
||||||
if (!strncmp(del->name.value, str, CPG_MAX_NAME_LENGTH))
|
if (!strncmp(del->name.value, uuid, CPG_MAX_NAME_LENGTH))
|
||||||
_destroy_cluster_cpg(del);
|
_destroy_cluster_cpg(del);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -38,8 +38,8 @@ int init_cluster(void);
|
|||||||
void cleanup_cluster(void);
|
void cleanup_cluster(void);
|
||||||
void cluster_debug(void);
|
void cluster_debug(void);
|
||||||
|
|
||||||
int create_cluster_cpg(char *str);
|
int create_cluster_cpg(char *uuid, uint64_t luid);
|
||||||
int destroy_cluster_cpg(char *str);
|
int destroy_cluster_cpg(char *uuid);
|
||||||
|
|
||||||
int cluster_send(struct clog_request *rq);
|
int cluster_send(struct clog_request *rq);
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ struct log_c {
|
|||||||
struct list_head list;
|
struct list_head list;
|
||||||
|
|
||||||
char uuid[DM_UUID_LEN];
|
char uuid[DM_UUID_LEN];
|
||||||
uint32_t ref_count;
|
uint64_t luid;
|
||||||
|
|
||||||
time_t delay; /* limits how fast a resume can happen after suspend */
|
time_t delay; /* limits how fast a resume can happen after suspend */
|
||||||
int touched;
|
int touched;
|
||||||
@ -146,11 +146,10 @@ static uint64_t count_bits32(uint32_t *addr, uint32_t count)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* get_log
|
* get_log
|
||||||
* @rq
|
|
||||||
*
|
*
|
||||||
* Returns: log if found, NULL otherwise
|
* Returns: log if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
static struct log_c *get_log(const char *uuid)
|
static struct log_c *get_log(const char *uuid, uint64_t luid)
|
||||||
{
|
{
|
||||||
struct list_head *l;
|
struct list_head *l;
|
||||||
struct log_c *lc;
|
struct log_c *lc;
|
||||||
@ -158,7 +157,8 @@ static struct log_c *get_log(const char *uuid)
|
|||||||
/* FIXME: Need prefetch to do this right */
|
/* FIXME: Need prefetch to do this right */
|
||||||
__list_for_each(l, &log_list) {
|
__list_for_each(l, &log_list) {
|
||||||
lc = list_entry(l, struct log_c, list);
|
lc = list_entry(l, struct log_c, list);
|
||||||
if (!strcmp(lc->uuid, uuid))
|
if (!strcmp(lc->uuid, uuid) &&
|
||||||
|
(!luid || (luid == lc->luid)))
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,14 +167,13 @@ static struct log_c *get_log(const char *uuid)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* get_pending_log
|
* get_pending_log
|
||||||
* @rq
|
|
||||||
*
|
*
|
||||||
* Pending logs are logs that have been 'clog_ctr'ed, but
|
* Pending logs are logs that have been 'clog_ctr'ed, but
|
||||||
* have not joined the CPG (via clog_resume).
|
* have not joined the CPG (via clog_resume).
|
||||||
*
|
*
|
||||||
* Returns: log if found, NULL otherwise
|
* Returns: log if found, NULL otherwise
|
||||||
*/
|
*/
|
||||||
static struct log_c *get_pending_log(const char *uuid)
|
static struct log_c *get_pending_log(const char *uuid, uint64_t luid)
|
||||||
{
|
{
|
||||||
struct list_head *l;
|
struct list_head *l;
|
||||||
struct log_c *lc;
|
struct log_c *lc;
|
||||||
@ -182,7 +181,8 @@ static struct log_c *get_pending_log(const char *uuid)
|
|||||||
/* FIXME: Need prefetch to do this right */
|
/* FIXME: Need prefetch to do this right */
|
||||||
__list_for_each(l, &log_pending_list) {
|
__list_for_each(l, &log_pending_list) {
|
||||||
lc = list_entry(l, struct log_c, list);
|
lc = list_entry(l, struct log_c, list);
|
||||||
if (!strcmp(lc->uuid, uuid))
|
if (!strcmp(lc->uuid, uuid) &&
|
||||||
|
(!luid || (luid == lc->luid)))
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,7 +358,8 @@ static int find_disk_path(char *major_minor_str, char *path_rtn, int *unlink_pat
|
|||||||
return r ? -errno : 0;
|
return r ? -errno : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _clog_ctr(char *uuid, int argc, char **argv, uint64_t device_size)
|
static int _clog_ctr(char *uuid, uint64_t luid,
|
||||||
|
int argc, char **argv, uint64_t device_size)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int r = 0;
|
int r = 0;
|
||||||
@ -447,16 +448,15 @@ static int _clog_ctr(char *uuid, int argc, char **argv, uint64_t device_size)
|
|||||||
lc->skip_bit_warning = region_count;
|
lc->skip_bit_warning = region_count;
|
||||||
lc->disk_fd = -1;
|
lc->disk_fd = -1;
|
||||||
lc->log_dev_failed = 0;
|
lc->log_dev_failed = 0;
|
||||||
lc->ref_count = 1;
|
|
||||||
strncpy(lc->uuid, uuid, DM_UUID_LEN);
|
strncpy(lc->uuid, uuid, DM_UUID_LEN);
|
||||||
|
lc->luid = luid;
|
||||||
|
|
||||||
if ((dup = get_log(lc->uuid)) ||
|
if ((dup = get_log(lc->uuid, lc->luid)) ||
|
||||||
(dup = get_pending_log(lc->uuid))) {
|
(dup = get_pending_log(lc->uuid, lc->luid))) {
|
||||||
LOG_DBG("[%s] Inc reference count on cluster log",
|
LOG_ERROR("[%s/%llu] Log already exists, unable to create.",
|
||||||
SHORT_UUID(lc->uuid));
|
SHORT_UUID(lc->uuid), lc->luid);
|
||||||
free(lc);
|
free(lc);
|
||||||
dup->ref_count++;
|
return -EINVAL;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&lc->mark_list);
|
INIT_LIST_HEAD(&lc->mark_list);
|
||||||
@ -590,7 +590,7 @@ static int clog_ctr(struct dm_ulog_request *rq)
|
|||||||
}
|
}
|
||||||
|
|
||||||
argc--; /* We pass in the device_size separate */
|
argc--; /* We pass in the device_size separate */
|
||||||
r = _clog_ctr(rq->uuid, argc - 1, argv + 1, device_size);
|
r = _clog_ctr(rq->uuid, rq->luid, argc - 1, argv + 1, device_size);
|
||||||
|
|
||||||
/* We join the CPG when we resume */
|
/* We join the CPG when we resume */
|
||||||
|
|
||||||
@ -617,32 +617,21 @@ static int clog_ctr(struct dm_ulog_request *rq)
|
|||||||
*/
|
*/
|
||||||
static int clog_dtr(struct dm_ulog_request *rq)
|
static int clog_dtr(struct dm_ulog_request *rq)
|
||||||
{
|
{
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (lc) {
|
if (lc) {
|
||||||
/*
|
/*
|
||||||
* The log should not be on the official list. There
|
* The log should not be on the official list. There
|
||||||
* should have been a suspend first.
|
* should have been a suspend first.
|
||||||
*/
|
*/
|
||||||
lc->ref_count--;
|
LOG_ERROR("[%s] DTR before SUS: leaving CPG",
|
||||||
if (!lc->ref_count) {
|
SHORT_UUID(rq->uuid));
|
||||||
LOG_ERROR("[%s] DTR before SUS: leaving CPG",
|
destroy_cluster_cpg(rq->uuid);
|
||||||
SHORT_UUID(rq->uuid));
|
} else if (!(lc = get_pending_log(rq->uuid, rq->luid))) {
|
||||||
destroy_cluster_cpg(rq->uuid);
|
|
||||||
}
|
|
||||||
} else if ((lc = get_pending_log(rq->uuid))) {
|
|
||||||
lc->ref_count--;
|
|
||||||
} else {
|
|
||||||
LOG_ERROR("clog_dtr called on log that is not official or pending");
|
LOG_ERROR("clog_dtr called on log that is not official or pending");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lc->ref_count) {
|
|
||||||
LOG_DBG("[%s] Dec reference count on cluster log",
|
|
||||||
SHORT_UUID(lc->uuid));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOG_DBG("[%s] Cluster log removed", SHORT_UUID(lc->uuid));
|
LOG_DBG("[%s] Cluster log removed", SHORT_UUID(lc->uuid));
|
||||||
|
|
||||||
list_del_init(&lc->list);
|
list_del_init(&lc->list);
|
||||||
@ -664,7 +653,7 @@ static int clog_dtr(struct dm_ulog_request *rq)
|
|||||||
*/
|
*/
|
||||||
static int clog_presuspend(struct dm_ulog_request *rq)
|
static int clog_presuspend(struct dm_ulog_request *rq)
|
||||||
{
|
{
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -684,7 +673,7 @@ static int clog_presuspend(struct dm_ulog_request *rq)
|
|||||||
*/
|
*/
|
||||||
static int clog_postsuspend(struct dm_ulog_request *rq)
|
static int clog_postsuspend(struct dm_ulog_request *rq)
|
||||||
{
|
{
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -705,9 +694,9 @@ static int clog_postsuspend(struct dm_ulog_request *rq)
|
|||||||
* @rq
|
* @rq
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int cluster_postsuspend(char *uuid)
|
int cluster_postsuspend(char *uuid, uint64_t luid)
|
||||||
{
|
{
|
||||||
struct log_c *lc = get_log(uuid);
|
struct log_c *lc = get_log(uuid, luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -732,7 +721,7 @@ static int clog_resume(struct dm_ulog_request *rq)
|
|||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int commit_log = 0;
|
int commit_log = 0;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
size_t size = lc->bitset_uint32_count * sizeof(uint32_t);
|
size_t size = lc->bitset_uint32_count * sizeof(uint32_t);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
@ -770,7 +759,8 @@ static int clog_resume(struct dm_ulog_request *rq)
|
|||||||
lc->resume_override = 1000;
|
lc->resume_override = 1000;
|
||||||
goto out;
|
goto out;
|
||||||
default:
|
default:
|
||||||
LOG_ERROR("Error:: multiple loading of bits (%d)", lc->resume_override);
|
LOG_ERROR("Error:: multiple loading of bits (%d)",
|
||||||
|
lc->resume_override);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -791,8 +781,8 @@ static int clog_resume(struct dm_ulog_request *rq)
|
|||||||
SHORT_UUID(lc->uuid));
|
SHORT_UUID(lc->uuid));
|
||||||
break;
|
break;
|
||||||
case -EINVAL:
|
case -EINVAL:
|
||||||
LOG_PRINT("[%s] (Re)initializing mirror log - resync issued.",
|
LOG_DBG("[%s] (Re)initializing mirror log - resync issued.",
|
||||||
SHORT_UUID(lc->uuid));
|
SHORT_UUID(lc->uuid));
|
||||||
lc->disk_nr_regions = 0;
|
lc->disk_nr_regions = 0;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -858,11 +848,11 @@ int local_resume(struct dm_ulog_request *rq)
|
|||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
time_t t;
|
time_t t;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc) {
|
if (!lc) {
|
||||||
/* Is the log in the pending list? */
|
/* Is the log in the pending list? */
|
||||||
lc = get_pending_log(rq->uuid);
|
lc = get_pending_log(rq->uuid, rq->luid);
|
||||||
if (!lc) {
|
if (!lc) {
|
||||||
LOG_ERROR("clog_resume called on log that is not official or pending");
|
LOG_ERROR("clog_resume called on log that is not official or pending");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -897,7 +887,7 @@ int local_resume(struct dm_ulog_request *rq)
|
|||||||
sleep(3 - t);
|
sleep(3 - t);
|
||||||
|
|
||||||
/* Join the CPG */
|
/* Join the CPG */
|
||||||
r = create_cluster_cpg(rq->uuid);
|
r = create_cluster_cpg(rq->uuid, rq->luid);
|
||||||
if (r) {
|
if (r) {
|
||||||
LOG_ERROR("clog_resume: Failed to create cluster CPG");
|
LOG_ERROR("clog_resume: Failed to create cluster CPG");
|
||||||
return r;
|
return r;
|
||||||
@ -924,9 +914,9 @@ int local_resume(struct dm_ulog_request *rq)
|
|||||||
static int clog_get_region_size(struct dm_ulog_request *rq)
|
static int clog_get_region_size(struct dm_ulog_request *rq)
|
||||||
{
|
{
|
||||||
uint64_t *rtn = (uint64_t *)rq->data;
|
uint64_t *rtn = (uint64_t *)rq->data;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc && !(lc = get_pending_log(rq->uuid)))
|
if (!lc && !(lc = get_pending_log(rq->uuid, rq->luid)))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
*rtn = lc->region_size;
|
*rtn = lc->region_size;
|
||||||
@ -945,7 +935,7 @@ static int clog_is_clean(struct dm_ulog_request *rq)
|
|||||||
{
|
{
|
||||||
int64_t *rtn = (int64_t *)rq->data;
|
int64_t *rtn = (int64_t *)rq->data;
|
||||||
uint64_t region = *((uint64_t *)(rq->data));
|
uint64_t region = *((uint64_t *)(rq->data));
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -970,7 +960,7 @@ static int clog_in_sync(struct dm_ulog_request *rq)
|
|||||||
{
|
{
|
||||||
int64_t *rtn = (int64_t *)rq->data;
|
int64_t *rtn = (int64_t *)rq->data;
|
||||||
uint64_t region = *((uint64_t *)(rq->data));
|
uint64_t region = *((uint64_t *)(rq->data));
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -999,7 +989,7 @@ static int clog_in_sync(struct dm_ulog_request *rq)
|
|||||||
static int clog_flush(struct dm_ulog_request *rq, int server)
|
static int clog_flush(struct dm_ulog_request *rq, int server)
|
||||||
{
|
{
|
||||||
int r = 0;
|
int r = 0;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1087,7 +1077,7 @@ static int clog_mark_region(struct dm_ulog_request *rq, uint32_t originator)
|
|||||||
int r;
|
int r;
|
||||||
int count;
|
int count;
|
||||||
uint64_t *region;
|
uint64_t *region;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1154,7 +1144,7 @@ static int clog_clear_region(struct dm_ulog_request *rq, uint32_t originator)
|
|||||||
int r;
|
int r;
|
||||||
int count;
|
int count;
|
||||||
uint64_t *region;
|
uint64_t *region;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1189,7 +1179,7 @@ static int clog_get_resync_work(struct dm_ulog_request *rq, uint32_t originator)
|
|||||||
int64_t i;
|
int64_t i;
|
||||||
uint64_t r;
|
uint64_t r;
|
||||||
} *pkg = (void *)rq->data;
|
} *pkg = (void *)rq->data;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1282,7 +1272,7 @@ static int clog_set_region_sync(struct dm_ulog_request *rq, uint32_t originator)
|
|||||||
uint64_t region;
|
uint64_t region;
|
||||||
int64_t in_sync;
|
int64_t in_sync;
|
||||||
} *pkg = (void *)rq->data;
|
} *pkg = (void *)rq->data;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1361,7 +1351,7 @@ static int clog_set_region_sync(struct dm_ulog_request *rq, uint32_t originator)
|
|||||||
static int clog_get_sync_count(struct dm_ulog_request *rq, uint32_t originator)
|
static int clog_get_sync_count(struct dm_ulog_request *rq, uint32_t originator)
|
||||||
{
|
{
|
||||||
uint64_t *sync_count = (uint64_t *)rq->data;
|
uint64_t *sync_count = (uint64_t *)rq->data;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* FIXME: Mirror requires us to be able to ask for
|
* FIXME: Mirror requires us to be able to ask for
|
||||||
@ -1370,7 +1360,7 @@ static int clog_get_sync_count(struct dm_ulog_request *rq, uint32_t originator)
|
|||||||
* the stored value may not be accurate.
|
* the stored value may not be accurate.
|
||||||
*/
|
*/
|
||||||
if (!lc)
|
if (!lc)
|
||||||
lc = get_pending_log(rq->uuid);
|
lc = get_pending_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1429,10 +1419,10 @@ static int disk_status_info(struct log_c *lc, struct dm_ulog_request *rq)
|
|||||||
static int clog_status_info(struct dm_ulog_request *rq)
|
static int clog_status_info(struct dm_ulog_request *rq)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
lc = get_pending_log(rq->uuid);
|
lc = get_pending_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1484,10 +1474,10 @@ static int disk_status_table(struct log_c *lc, struct dm_ulog_request *rq)
|
|||||||
static int clog_status_table(struct dm_ulog_request *rq)
|
static int clog_status_table(struct dm_ulog_request *rq)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
lc = get_pending_log(rq->uuid);
|
lc = get_pending_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1512,7 +1502,7 @@ static int clog_is_remote_recovering(struct dm_ulog_request *rq)
|
|||||||
int64_t is_recovering;
|
int64_t is_recovering;
|
||||||
uint64_t in_sync_hint;
|
uint64_t in_sync_hint;
|
||||||
} *pkg = (void *)rq->data;
|
} *pkg = (void *)rq->data;
|
||||||
struct log_c *lc = get_log(rq->uuid);
|
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||||
|
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1693,7 +1683,8 @@ static void print_bits(char *buf, int size, int print)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* int store_bits(const char *uuid, const char *which, char **buf)*/
|
/* int store_bits(const char *uuid, const char *which, char **buf)*/
|
||||||
int push_state(const char *uuid, const char *which, char **buf, uint32_t debug_who)
|
int push_state(const char *uuid, uint64_t luid,
|
||||||
|
const char *which, char **buf, uint32_t debug_who)
|
||||||
{
|
{
|
||||||
int bitset_size;
|
int bitset_size;
|
||||||
struct log_c *lc;
|
struct log_c *lc;
|
||||||
@ -1701,7 +1692,7 @@ int push_state(const char *uuid, const char *which, char **buf, uint32_t debug_w
|
|||||||
if (*buf)
|
if (*buf)
|
||||||
LOG_ERROR("store_bits: *buf != NULL");
|
LOG_ERROR("store_bits: *buf != NULL");
|
||||||
|
|
||||||
lc = get_log(uuid);
|
lc = get_log(uuid, luid);
|
||||||
if (!lc) {
|
if (!lc) {
|
||||||
LOG_ERROR("store_bits: No log found for %s", uuid);
|
LOG_ERROR("store_bits: No log found for %s", uuid);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1747,7 +1738,8 @@ int push_state(const char *uuid, const char *which, char **buf, uint32_t debug_w
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*int load_bits(const char *uuid, const char *which, char *buf, int size)*/
|
/*int load_bits(const char *uuid, const char *which, char *buf, int size)*/
|
||||||
int pull_state(const char *uuid, const char *which, char *buf, int size)
|
int pull_state(const char *uuid, uint64_t luid,
|
||||||
|
const char *which, char *buf, int size)
|
||||||
{
|
{
|
||||||
int bitset_size;
|
int bitset_size;
|
||||||
struct log_c *lc;
|
struct log_c *lc;
|
||||||
@ -1755,7 +1747,7 @@ int pull_state(const char *uuid, const char *which, char *buf, int size)
|
|||||||
if (!buf)
|
if (!buf)
|
||||||
LOG_ERROR("pull_state: buf == NULL");
|
LOG_ERROR("pull_state: buf == NULL");
|
||||||
|
|
||||||
lc = get_log(uuid);
|
lc = get_log(uuid, luid);
|
||||||
if (!lc) {
|
if (!lc) {
|
||||||
LOG_ERROR("pull_state: No log found for %s", uuid);
|
LOG_ERROR("pull_state: No log found for %s", uuid);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -1799,7 +1791,7 @@ int log_get_state(struct dm_ulog_request *rq)
|
|||||||
{
|
{
|
||||||
struct log_c *lc;
|
struct log_c *lc;
|
||||||
|
|
||||||
lc = get_log(rq->uuid);
|
lc = get_log(rq->uuid, rq->luid);
|
||||||
if (!lc)
|
if (!lc)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -8,12 +8,13 @@
|
|||||||
#define LOG_SUSPENDED 2
|
#define LOG_SUSPENDED 2
|
||||||
|
|
||||||
int local_resume(struct dm_ulog_request *rq);
|
int local_resume(struct dm_ulog_request *rq);
|
||||||
int cluster_postsuspend(char *);
|
int cluster_postsuspend(char *, uint64_t);
|
||||||
|
|
||||||
int do_request(struct clog_request *rq, int server);
|
int do_request(struct clog_request *rq, int server);
|
||||||
int push_state(const char *uuid, const char *which,
|
int push_state(const char *uuid, uint64_t luid,
|
||||||
char **buf, uint32_t debug_who);
|
const char *which, char **buf, uint32_t debug_who);
|
||||||
int pull_state(const char *uuid, const char *which, char *buf, int size);
|
int pull_state(const char *uuid, uint64_t luid,
|
||||||
|
const char *which, char *buf, int size);
|
||||||
|
|
||||||
int log_get_state(struct dm_ulog_request *rq);
|
int log_get_state(struct dm_ulog_request *rq);
|
||||||
int log_status(void);
|
int log_status(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user