mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
get_alloc_string: compare only enum
Instead of possibly checking for cling_by_tags string twice, just compare resulting alloc number from search loop.
This commit is contained in:
parent
30adf7e91c
commit
b66b72b115
@ -65,14 +65,16 @@ const char *get_alloc_string(alloc_policy_t alloc)
|
|||||||
alloc_policy_t get_alloc_from_string(const char *str)
|
alloc_policy_t get_alloc_from_string(const char *str)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
alloc_policy_t alloc;
|
||||||
/* cling_by_tags is part of cling */
|
|
||||||
if (!strcmp("cling_by_tags", str))
|
|
||||||
return ALLOC_CLING;
|
|
||||||
|
|
||||||
for (i = 0; i < _num_policies; i++)
|
for (i = 0; i < _num_policies; i++)
|
||||||
if (!strcmp(_policies[i].str, str))
|
if (!strcmp(_policies[i].str, str)) {
|
||||||
return _policies[i].alloc;
|
alloc = _policies[i].alloc;
|
||||||
|
/* cling_by_tags is part of cling */
|
||||||
|
if (alloc == ALLOC_CLING_BY_TAGS)
|
||||||
|
alloc = ALLOC_CLING;
|
||||||
|
return alloc;
|
||||||
|
}
|
||||||
|
|
||||||
/* Special case for old metadata */
|
/* Special case for old metadata */
|
||||||
if (!strcmp("next free", str))
|
if (!strcmp("next free", str))
|
||||||
|
Loading…
Reference in New Issue
Block a user