IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Just to see whether it makes code more readable
if we 'extract' just parsing of lv section
to standalone function
(also could be called maybe instead from _read_lvsegs
so _read_lvnames is only radix_treeing lvname)
To see whether use of 'radix_tree' for every find_lv() call helps.
As if we drop radix_tree after import, this code then may
fallback to old slower find_lv_in_vg.
When reading values out of tree node, we can look for them with
help of binary search.
For this bsearch functionality however config values must be
alphabetically sorted!
Move all the parsing for LV segment into _read_lvname,
so _read_lvsegs is only parsing individual segments.
Also use 'lv->size' to store seg_count - as the final lv->size
can be only set after parsing all segments of individual LV.
This way we don't need to allocate 'extra' var within logical_volume.
When parsing list of flags, we can use 'alphabetically'
sorted array and use 'bsearch()' to look for particular bit.
When creating string representation of flags, we can
reduce some unnecessary bit lookups by join those flags
without string description together, so there is no need
to check for those individual 'bits', but still maintaining
the bit validation.
Also exit the printing loop early, if there are no any more
status bit present.
When searching for committed LV by uuid, this search can
be expensive for commands like 'vgremove' - so for
this part introduce 'lv_uuids' radix_tree that is
build with first access to lv_committed().
Since there is a group of commands that need to access 'lv_list'
while still need to search for LV by its name, make the whole
struct lv_list a member of logical_volume structure.
This makes it easy to return also 'lv_list' this list this LV
within VG.
Also the patch should not use more memory, since we were allocating
lv_list for each LV anyway when linkin LV to VG.
Since find_lv_by_name() is now using radix_tree(),
use the same 'search for /' in LV in name for both
find_lv() & find_lv_in_vg().
TODO: Possibly refactor code and use only dm_list
instead of lv_list and dereference LV with container_of()
(thus saving pointer within struct logical_volume) - but
we use 'lv_list' currently in many places...
With presence of uniq_insert, use this function also
here for extra protection and check for duplicate lv_name
when inserting a new name into radix_tree.
Avoid config 'grep' with actual 'randomly' generated path name
which may eventually contain 'cc' as part the path and
causing a mismatch of the grep test.
When 'lvresize -r' is used to resize the volume, it's valid to
resize even to the same size of an LV, as the command then runs
fs-resize utility to eventually upsize the fs to the current
volume size.
Return code of such command then reflects the return value
of this fs-resize tool.
This fixes the regression introduced when the support
for option --fs was added (2.03.17).
Use proper function names in annotation
There are no fuction named print_common_options_cmd()
and print_common_options_lvm(). So, rename them to the
real function named print_usage_common_cmd() and
print_usage_common_lvm().
Signed-off-by: YunJian Long
Tricky one - as the pipe exit codes may result into whole
test failure depending on how quick/slow command exits
are within pipeline.
So get the len without piping.