mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
dev-cache: avoid hashing same data again
Before hashing device again with path, check if it's not already hashed. TODO: maybe bigger chunk of executed code might be actually skipped.
This commit is contained in:
parent
9b4b5d449e
commit
767a5e1281
@ -706,6 +706,12 @@ static int _insert_dev(const char *path, dev_t d)
|
||||
}
|
||||
}
|
||||
|
||||
if (dm_hash_lookup(_cache.names, path) == dev) {
|
||||
/* Hash already has matching entry present */
|
||||
log_debug("Path already cached %s.", path);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(path_copy = dm_pool_strdup(_cache.mem, path))) {
|
||||
log_error("Failed to duplicate path string.");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user