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

more readahead node fixes/debug messages

This commit is contained in:
Alasdair Kergon 2007-12-14 19:49:27 +00:00
parent bafa2f39cf
commit fc795d8701
3 changed files with 24 additions and 9 deletions

View File

@ -1,6 +1,7 @@
Version 1.02.24 -
===================================
Fix deptree to pass new name to _resume_node after a rename.
Suppress other node operations if node is deleted.
Add node operation stack debug messages.
Report error when empty device name passed to readahead functions.
Fix minimum readahead debug message.

View File

@ -300,6 +300,8 @@ static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
return 0;
}
log_debug("Created %s", path);
#ifdef HAVE_SELINUX
if (!dm_set_selinux_context(path, S_IFBLK))
return 0;
@ -341,6 +343,8 @@ static int _rename_dev_node(const char *old_name, const char *new_name)
return 0;
}
log_debug("Renamed %s to %s", oldpath, newpath);
return 1;
}
@ -359,6 +363,8 @@ static int _rm_dev_node(const char *dev_name)
return 0;
}
log_debug("Removed %s", path);
return 1;
}
@ -531,9 +537,23 @@ static int _stack_node_op(node_op_t type, const char *dev_name, uint32_t major,
uint32_t read_ahead_flags)
{
struct node_op_parms *nop;
struct list *noph, *nopht;
size_t len = strlen(dev_name) + strlen(old_name) + 2;
char *pos;
/*
* Ignore any outstanding operations on the node if deleting it
*/
if (type == NODE_DEL) {
list_iterate_safe(noph, nopht, &_node_ops) {
nop = list_item(noph, struct node_op_parms);
if (!strcmp(dev_name, nop->dev_name)) {
list_del(&nop->list);
dm_free(nop);
}
}
}
if (!(nop = dm_malloc(sizeof(*nop) + len))) {
log_error("Insufficient memory to stack mknod operation");
return 0;
@ -592,7 +612,7 @@ int rename_dev_node(const char *old_name, const char *new_name)
int rm_dev_node(const char *dev_name)
{
log_debug("%s: Stacking NODE_DEL", dev_name);
log_debug("%s: Stacking NODE_DEL (replaces other stacked ops)", dev_name);
return _stack_node_op(NODE_DEL, dev_name, 0, 0, 0, 0, 0, "", 0, 0);
}

View File

@ -1510,7 +1510,6 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
void *handle = NULL;
struct dm_tree_node *child;
struct dm_info newinfo;
const char *name;
/* Preload children first */
while ((child = dm_tree_next_child(&handle, dnode, 0))) {
@ -1526,11 +1525,6 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
if (dm_tree_node_num_children(child, 0))
dm_tree_preload_children(child, uuid_prefix, uuid_prefix_len);
if (!(name = dm_tree_node_get_name(child))) {
stack;
continue;
}
/* FIXME Cope if name exists with no uuid? */
if (!child->info.exists) {
if (!_create_node(child)) {
@ -1553,11 +1547,11 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
if (!child->info.inactive_table && !child->info.suspended)
continue;
if (!_resume_node(name, child->info.major, child->info.minor,
if (!_resume_node(child->name, child->info.major, child->info.minor,
child->props.read_ahead,
child->props.read_ahead_flags, &newinfo)) {
log_error("Unable to resume %s (%" PRIu32
":%" PRIu32 ")", name, child->info.major,
":%" PRIu32 ")", child->name, child->info.major,
child->info.minor);
continue;
}