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

Only resume devices in dm_tree_preload_children if size changes.

This commit is contained in:
Alasdair Kergon 2008-09-18 18:34:53 +00:00
parent a0e00ccf3f
commit bb875bb9e4
4 changed files with 30 additions and 7 deletions

View File

@ -1,7 +1,8 @@
Version 1.02.28 -
================================
Version 1.02.28 - 18th September 2008
=====================================
Only resume devices in dm_tree_preload_children if size changes.
Extend deptree buffers so the largest possible device numbers fit.
Added generation of the versioned libdevmapper-event.so for LVM's test
Generate versioned libdevmapper-event.so.
Underline longer report help text headings.
Version 1.02.27 - 25th June 2008

View File

@ -1501,6 +1501,11 @@ static int _create_and_load_v4(struct dm_task *dmt)
return r;
}
uint64_t dm_task_get_existing_table_size(struct dm_task *dmt)
{
return dmt->existing_table_size;
}
static int _reload_with_suppression_v4(struct dm_task *dmt)
{
struct dm_task *task;
@ -1534,6 +1539,12 @@ static int _reload_with_suppression_v4(struct dm_task *dmt)
return r;
}
/* Store existing table size */
t2 = task->head;
while (t2 && t2->next)
t2 = t2->next;
dmt->existing_table_size = t2 ? t2->start + t2->length : 0;
if ((task->dmi.v4->flags & DM_READONLY_FLAG) ? 1 : 0 != dmt->read_only)
goto no_match;

View File

@ -58,6 +58,7 @@ struct dm_task {
int no_open_count;
int skip_lockfs;
int suppress_identical_reload;
uint64_t existing_table_size;
char *uuid;
};
@ -69,5 +70,6 @@ struct cmd_data {
};
int dm_check_version(void);
uint64_t dm_task_get_existing_table_size(struct dm_task *dmt);
#endif

View File

@ -99,6 +99,7 @@ struct load_properties {
uint32_t read_ahead_flags;
unsigned segment_count;
unsigned size_changed;
struct list segs;
const char *new_name;
@ -603,6 +604,7 @@ struct dm_tree_node *dm_tree_add_new_dev(struct dm_tree *dtree,
dnode->props.major = major;
dnode->props.minor = minor;
dnode->props.new_name = NULL;
dnode->props.size_changed = 0;
} else if (strcmp(name, dnode->name)) {
/* Do we need to rename node? */
if (!(dnode->props.new_name = dm_pool_strdup(dtree->mem, name))) {
@ -1494,6 +1496,13 @@ static int _load_node(struct dm_tree_node *dnode)
if (r && !dnode->info.inactive_table)
log_verbose("Suppressed %s identical table reload.",
dnode->name);
if ((dnode->props.size_changed =
(dm_task_get_existing_table_size(dmt) == seg_start) ? 0 : 1))
log_debug("Table size changed from %" PRIu64 " to %"
PRIu64 " for %s",
dm_task_get_existing_table_size(dmt),
seg_start, dnode->name);
}
dnode->props.segment_count = 0;
@ -1505,8 +1514,8 @@ out:
}
int dm_tree_preload_children(struct dm_tree_node *dnode,
const char *uuid_prefix,
size_t uuid_prefix_len)
const char *uuid_prefix,
size_t uuid_prefix_len)
{
void *handle = NULL;
struct dm_tree_node *child;
@ -1541,8 +1550,8 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
}
}
/* Resume device immediately if it has parents */
if (!dm_tree_node_num_children(child, 1))
/* Resume device immediately if it has parents and its size changed */
if (!dm_tree_node_num_children(child, 1) || !dnode->props.size_changed)
continue;
if (!child->info.inactive_table && !child->info.suspended)