]> sourceware.org Git - lvm2.git/log
lvm2.git
2 months agopost-release 1526437713
Marian Csontos [Mon, 4 Nov 2024 15:42:12 +0000 (16:42 +0100)]
post-release

2 months agopre-release 2.03.28 1526437872 v2_03_28
Marian Csontos [Mon, 4 Nov 2024 15:42:12 +0000 (16:42 +0100)]
pre-release 2.03.28

2 months agogcc: fix warning about uninitialized use 1523580926
Zdenek Kabelac [Fri, 1 Nov 2024 14:20:50 +0000 (15:20 +0100)]
gcc: fix warning about uninitialized use

get_sizes_lockspace() may not always initilize all passed values
in case the bitfield would not trigger if() path.
So just in case keep the path initilized.

TODO: maybe add INTERNAL_ERROR to get_sizes_lockspace().

2 months agolvmlockd: remove unused vg_sysid 1523487491
David Teigland [Fri, 1 Nov 2024 15:45:34 +0000 (10:45 -0500)]
lvmlockd: remove unused vg_sysid

from structs and info dump.

2 months agotests: skip test on older version 1523253922
Zdenek Kabelac [Fri, 1 Nov 2024 12:27:20 +0000 (13:27 +0100)]
tests: skip test on older version

Prevent crashing kernel on older systems.

2 months agolvmlockd: update prototype for non-lvmlockd build 1523129386
Zdenek Kabelac [Fri, 1 Nov 2024 10:27:02 +0000 (11:27 +0100)]
lvmlockd: update prototype for non-lvmlockd build

Match prototype to last updates of lockd_init_lv_args().

2 months agolvmlockd: optimize new lv lease search 1522704036
David Teigland [Fri, 1 Nov 2024 01:29:00 +0000 (20:29 -0500)]
lvmlockd: optimize new lv lease search

When converting a VG to locktype sanlock, a new
lease is allocated for each existing lv.  Finding
a new lease location involved searching the lvmlock
LV from the start for an unused location, which
would be very slow with many LVs.  Improve this by
starting each search from the last used location.

2 months agolvmlockd: fix vgchange --locktype sanlock 1522553670
David Teigland [Thu, 31 Oct 2024 21:31:35 +0000 (16:31 -0500)]
lvmlockd: fix vgchange --locktype sanlock

Fix regression from commit 7f29afdb06d
"lvmlockd: configurable sanlock lease sizes on 4K disks"

That change failed to recognize that a running lockspace will not
exist in lvmlockd when converting a local VG to a sanlock VG, i.e.
vgchange --locktype sanlock vgname.  When the vgchange attempted
to initialize new lv leases for existing LVs, lvmlockd would
return an error when it found no lockspace.

2 months agoWHATS_NEW: update 1522199585
Zdenek Kabelac [Thu, 31 Oct 2024 16:56:59 +0000 (17:56 +0100)]
WHATS_NEW: update

2 months agovg: add radix_tree for lv uuids
Zdenek Kabelac [Sat, 26 Oct 2024 20:37:00 +0000 (22:37 +0200)]
vg: add radix_tree for lv uuids

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().

2 months agometadata: use radix_tree for find_lv_in_vg
Zdenek Kabelac [Sat, 26 Oct 2024 20:18:19 +0000 (22:18 +0200)]
metadata: use radix_tree for find_lv_in_vg

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...

2 months agoconfig: introduce validate_metadata
Zdenek Kabelac [Thu, 31 Oct 2024 13:42:16 +0000 (14:42 +0100)]
config: introduce validate_metadata

Add lvm.conf  config/validate_metadata  configurable setting.
Allows to disable validation of volume_group structure before
writing to disk.
Call of vg_validate() is supposed to catch any inconsistency
of in-memory volume group structure and possibly early aborting
commnand before making any more 'damage' in case the VG struct
is found insistent after some metadata manipulation.

This is almost always useful for devel - and also for normal user
as for small metadata size this doesn't add too much overhead.

However if the volume_group size is large and operations are just
adding removing simple LVs - this validation time may add noticable
to final command running time.

So if the user seeks the highest perfomance of command and does
not do any 'complex' metadata manipulation - it's reasonably safe
to disable validation (with the use of setting "none") here.

2 months agovalidate_lvname: early exit
Zdenek Kabelac [Thu, 31 Oct 2024 12:53:20 +0000 (13:53 +0100)]
validate_lvname: early exit

If the LV name does not any have '_' chr,
there is no point trying to call 'strstr()' to look for "_suffix".
Also we can search from _.

2 months agocov: validate string with lock mode 1519907630
Zdenek Kabelac [Wed, 30 Oct 2024 10:54:42 +0000 (11:54 +0100)]
cov: validate string with lock mode

Check the dev_mode string is not NULL before use.

2 months agocov: add stacktraces
Zdenek Kabelac [Wed, 30 Oct 2024 10:40:30 +0000 (11:40 +0100)]
cov: add stacktraces

Add stacktraces for unexpected paths.

2 months agovdo: reader checks there is enough data
Zdenek Kabelac [Wed, 30 Oct 2024 10:44:54 +0000 (11:44 +0100)]
vdo: reader checks there is enough data

Validate enough of data was read from disk to parse vdo header.
TODO: there should be a loop for buffer reading.

2 months agometadata: pahole logical_volume
Zdenek Kabelac [Tue, 29 Oct 2024 15:33:17 +0000 (16:33 +0100)]
metadata: pahole logical_volume

Shuffle some variables to remove 'extra' alignment holes
within the structure thus making it smaller.

2 months agometadata: lv_set_name use uniq_insert
Zdenek Kabelac [Tue, 29 Oct 2024 17:44:55 +0000 (18:44 +0100)]
metadata: lv_set_name use uniq_insert

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.

2 months agoget_alloc_string: compare only enum
Zdenek Kabelac [Tue, 29 Oct 2024 17:37:18 +0000 (18:37 +0100)]
get_alloc_string: compare only enum

Instead of possibly checking for cling_by_tags string twice,
just compare resulting alloc number from search loop.

2 months agotoolcontext: use the striped string first
Zdenek Kabelac [Tue, 29 Oct 2024 21:26:55 +0000 (22:26 +0100)]
toolcontext: use the striped string first

2 months agocache_manip: reset sigint handler
Zdenek Kabelac [Tue, 29 Oct 2024 19:25:35 +0000 (20:25 +0100)]
cache_manip: reset sigint handler

After processing interrupt, reset the interrupt counter,
so further code is not mislead and continues processing
in 'locked' section as expected.

2 months agotests: use longer tag
Zdenek Kabelac [Mon, 28 Oct 2024 20:41:30 +0000 (21:41 +0100)]
tests: use longer tag

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.

2 months agodebug: missing stacktrace 1516987104
Zdenek Kabelac [Fri, 25 Oct 2024 21:21:13 +0000 (23:21 +0200)]
debug: missing stacktrace

2 months agolv_manip: init major minor in alloc_lv
Zdenek Kabelac [Mon, 28 Oct 2024 10:05:59 +0000 (11:05 +0100)]
lv_manip: init major minor in alloc_lv

Move initialization of major and minor to alloc_lv().

2 months agodevice_mapper: use static array for dm_size_to_string
Zdenek Kabelac [Sun, 27 Oct 2024 22:15:24 +0000 (23:15 +0100)]
device_mapper: use static array for dm_size_to_string

Avoid copying this structure on stack with every call.

2 months agotests: add reproducer for failing raid5 activation
Zdenek Kabelac [Fri, 25 Oct 2024 19:26:30 +0000 (21:26 +0200)]
tests: add reproducer for failing raid5 activation

For now use 'should' to mark this 'known' failure.
This case needs solution.

2 months agotests: flip to use FSLASTBLOCK
Zdenek Kabelac [Fri, 25 Oct 2024 17:55:13 +0000 (19:55 +0200)]
tests: flip to use FSLASTBLOCK

It seems FSSIZE is newer then FSLASTBLOCK so use this one instead.

2 months agotests: correcting expected return code
Zdenek Kabelac [Fri, 25 Oct 2024 14:43:42 +0000 (16:43 +0200)]
tests: correcting expected return code

Expecting success when using with '-r'.

2 months agoman: lvchange update about --syncaction being transient 1512998003
Heinz Mauelshagen [Fri, 25 Oct 2024 20:03:18 +0000 (22:03 +0200)]
man: lvchange update about --syncaction being transient

2 months agoWHATS_NEW: update 1512458081
Zdenek Kabelac [Fri, 25 Oct 2024 13:05:16 +0000 (15:05 +0200)]
WHATS_NEW: update

2 months agolvmlockd: fix incorrect function definition
Zdenek Kabelac [Fri, 25 Oct 2024 12:01:11 +0000 (14:01 +0200)]
lvmlockd: fix incorrect function definition

In commit 7f29afdb06d9f3420b3d2174d6ed4c55a58ac706 this function
was added with misplaced ';'.

2 months agotests: add test to resize to same size
Zdenek Kabelac [Fri, 25 Oct 2024 12:47:40 +0000 (14:47 +0200)]
tests: add test to resize to same size

Check that 'lvresize/extend -r' resizing to the same size is
doing the fs resize.

2 months agolvresize: fix regression when resizing with fs
Zdenek Kabelac [Fri, 25 Oct 2024 12:44:50 +0000 (14:44 +0200)]
lvresize: fix regression when resizing with fs

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).

2 months agotests: lvresize-fs: check blkid version for lvresize with swap test 1512263819
Peter Rajnoha [Fri, 25 Oct 2024 11:21:50 +0000 (13:21 +0200)]
tests: lvresize-fs: check blkid version for lvresize with swap test

2 months agodev-type: update comment about swap info from blkid 1512213959
Peter Rajnoha [Fri, 25 Oct 2024 10:47:26 +0000 (12:47 +0200)]
dev-type: update comment about swap info from blkid

2 months agoclang: close file on memory alloc error path 1511485165
Zdenek Kabelac [Thu, 24 Oct 2024 22:21:49 +0000 (00:21 +0200)]
clang: close file on memory alloc error path

2 months agoclang: check for dirfd result
Zdenek Kabelac [Thu, 24 Oct 2024 22:17:25 +0000 (00:17 +0200)]
clang: check for dirfd result

2 months agoclang: check segment lv is defined
Zdenek Kabelac [Thu, 24 Oct 2024 22:14:09 +0000 (00:14 +0200)]
clang: check segment lv is defined

2 months agoclang: ensure pointer is defined
Zdenek Kabelac [Thu, 24 Oct 2024 22:07:16 +0000 (00:07 +0200)]
clang: ensure pointer is defined

Check for new_segtype and lv is defined
before dereferencing.

2 months agocov: use 64bit arithmentic
Zdenek Kabelac [Thu, 24 Oct 2024 21:26:19 +0000 (23:26 +0200)]
cov: use 64bit arithmentic

2 months agocov: ensure detached_log_lv exists before use
Zdenek Kabelac [Thu, 24 Oct 2024 21:04:54 +0000 (23:04 +0200)]
cov: ensure detached_log_lv exists before use

2 months agodebug: use major:minor
Zdenek Kabelac [Thu, 24 Oct 2024 23:19:21 +0000 (01:19 +0200)]
debug: use major:minor

Print major:minor as in other places.

2 months agodevice_id: close only opened dir
Zdenek Kabelac [Thu, 24 Oct 2024 21:26:53 +0000 (23:26 +0200)]
device_id: close only opened dir

After more of opendir, make sure 'dir' is closed
only when it's been opened.

2 months agometadata: check for mda_device existance
Zdenek Kabelac [Thu, 24 Oct 2024 21:00:44 +0000 (23:00 +0200)]
metadata: check for mda_device existance

2 months agodev-cache: ensure list has elements
Zdenek Kabelac [Thu, 24 Oct 2024 20:55:24 +0000 (22:55 +0200)]
dev-cache: ensure list has elements

When updating DM cache, check whether the list even has entries
before comparing it with old cached instance.

2 months agometadata: fallback search without radix_tree
Zdenek Kabelac [Thu, 24 Oct 2024 20:41:00 +0000 (22:41 +0200)]
metadata: fallback search without radix_tree

If we use some dummy vg struct, allow fallback
plain dm_list search.

2 months agodevice_mapper: add omitted error message
Zdenek Kabelac [Thu, 24 Oct 2024 20:38:56 +0000 (22:38 +0200)]
device_mapper: add omitted error message

2 months agodevice_mapper: check for pv before use in error msg
Zdenek Kabelac [Thu, 24 Oct 2024 20:38:14 +0000 (22:38 +0200)]
device_mapper: check for pv before use in error msg

2 months agolvmlockd: enable lockopt nodelay for lockstart 1511436389
David Teigland [Thu, 24 Oct 2024 22:13:33 +0000 (17:13 -0500)]
lvmlockd: enable lockopt nodelay for lockstart

Avoid the sanlock add_lockspace delay in vgchange --lockstart
by adding --lockopt nodelay.  This is for testing, and is not
safe to use in general.

2 months agoWHATS_NEW: update 1511269214
Zdenek Kabelac [Thu, 24 Oct 2024 19:23:40 +0000 (21:23 +0200)]
WHATS_NEW: update

2 months agocleanup: correct invalid function
long.yunjian@zte.com.cn [Wed, 16 Oct 2024 02:16:27 +0000 (10:16 +0800)]
cleanup: correct invalid function

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
2 months agotests: do not use shell pipe for reshape_len
Zdenek Kabelac [Thu, 24 Oct 2024 18:31:38 +0000 (20:31 +0200)]
tests: do not use shell pipe for reshape_len

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.

2 months agodevicesfile: move opendir after fclose
Zdenek Kabelac [Thu, 24 Oct 2024 19:19:01 +0000 (21:19 +0200)]
devicesfile: move opendir after fclose

Call opendir() after new file is stored within dir,
otherwise this new file would not accounted.

2 months agometadata: missed lv_set_name users
Zdenek Kabelac [Thu, 24 Oct 2024 19:00:52 +0000 (21:00 +0200)]
metadata: missed lv_set_name users

Missed when introduced lv_set_name().

2 months agolv: add lv_set_vg
Zdenek Kabelac [Thu, 24 Oct 2024 17:43:10 +0000 (19:43 +0200)]
lv: add lv_set_vg

To keep vg->lv_names up-to-date also for merge & split,
add function lv_set_vg() the will update also radix tree
reference for a VG.

2 months agoWHATS_NEW: update 1510961636
Zdenek Kabelac [Thu, 24 Oct 2024 15:28:31 +0000 (17:28 +0200)]
WHATS_NEW: update

2 months agometadata: use radix tree to find lv_names
Zdenek Kabelac [Thu, 24 Oct 2024 14:12:18 +0000 (16:12 +0200)]
metadata: use radix tree to find lv_names

Replace usage of dm_hash with radix_tree to quickly find LV name
with a vg and also index PV names with set of available PVs.
This PV index is only needed during the import, but instead
of passing 'radix_tree *' everywhere, just keep this within
a VG struct as well and once the parsing is finished, release
this PV index radix_tree.

This also makes it easier to replace this structure
in the future if needed.

lv_set_name now uses  radix_tree remove+insert to keep lv_names
tree in-sync and usable for  find_lv queries.

2 months agorevert "metadata: use lv_hash in segment-specific metadata parsing"
Zdenek Kabelac [Sat, 12 Oct 2024 19:58:14 +0000 (21:58 +0200)]
revert "metadata: use lv_hash in segment-specific metadata parsing"

This reverts commit f42aef47064fcc3fa8f78beea9e9b7e7c028e123.

Going to replace dm_hash with radix_tree and use 'find_lv()'
to abstract lookup for LV with VG.

2 months agometadata: use lv_set_name for raid and mirror
Zdenek Kabelac [Mon, 21 Oct 2024 11:11:28 +0000 (13:11 +0200)]
metadata: use lv_set_name for raid and mirror

Use lv_set_name API also for raid and mirror LV manipulation.

2 months agometadata: add lv_set_name
Zdenek Kabelac [Thu, 24 Oct 2024 14:05:28 +0000 (16:05 +0200)]
metadata: add lv_set_name

Add function to set lv->name.
Also when creating empty LV, first add this LV
to linked list in a VG and just after that allocate lv name.

2 months agocheck_pv_segments: resolve pv name once
Zdenek Kabelac [Thu, 24 Oct 2024 09:54:41 +0000 (11:54 +0200)]
check_pv_segments: resolve pv name once

2 months agolog: postpone some initialization
Zdenek Kabelac [Thu, 24 Oct 2024 09:54:05 +0000 (11:54 +0200)]
log: postpone some initialization

Clear buffers when really logging.

2 months agolv_manip: remove duplicate check for max lv
Zdenek Kabelac [Thu, 24 Oct 2024 14:11:51 +0000 (16:11 +0200)]
lv_manip: remove duplicate check for max lv

This check is always performed with call to link_lv_to_vg().

2 months agoflags: drop no longer needed header
Zdenek Kabelac [Thu, 24 Oct 2024 13:36:25 +0000 (15:36 +0200)]
flags: drop no longer needed header

After code refactoring, this header is not needed here anymore.

2 months agovg_validate: use uniq_insert
Zdenek Kabelac [Thu, 24 Oct 2024 13:27:31 +0000 (15:27 +0200)]
vg_validate: use uniq_insert

Enhance usage with uniq_insert and also try to better
utilize CPU cache and do a smaller loop for individual
hashing of lvname and separately lvid.

Also correcting usage of 'continue' within validation of
historical names as it should report as much errors
as it can within a loop.

2 months agotests: unit test for uniq insert into radix_tree
Zdenek Kabelac [Thu, 24 Oct 2024 12:08:51 +0000 (14:08 +0200)]
tests: unit test for uniq insert into radix_tree

2 months agoradix_tree: add radix_tree_uniq_insert
Zdenek Kabelac [Thu, 24 Oct 2024 12:04:07 +0000 (14:04 +0200)]
radix_tree: add radix_tree_uniq_insert

When using radix_tree to identify duplicate entries we may
avoid to call an extra 'lookup()' prior the insert() operation
add radix_tree_uniq_insert/_ptr() that is able to report -1 if
there was already set a value for the given key.

2 months agovgcfgrestore: validate complete VG 1509439103
Zdenek Kabelac [Wed, 23 Oct 2024 17:22:10 +0000 (19:22 +0200)]
vgcfgrestore: validate complete VG

Avoid finding problems in vg_validate when restoring
invalid VG metadata as that would lead to internal error.
i.e. adding unsupported METADATA_FLAG to zero segtype
can trigger such thing.

2 months agoread_lvflags: keep flag reading focused on flags
Zdenek Kabelac [Wed, 23 Oct 2024 14:35:55 +0000 (16:35 +0200)]
read_lvflags: keep flag reading focused on flags

Previous update needed to add handling segtype within flag.c
which somewhat breaks API separition and also had bug in hanlding
actual flags.

So instead keep segtype code in _read_segtype_and_lvflags() within
import_vsn1.c and handle purly flags in read_lvflags() from const
string.

2 months agoexport: typo with buffer zeroing
Zdenek Kabelac [Wed, 23 Oct 2024 17:21:05 +0000 (19:21 +0200)]
export: typo with buffer zeroing

Lost '= 0' in cut & paste.
Also get rid of no longer needed 'goto' section.

2 months agoexport: add missed buffer initialization 1508906248
Zdenek Kabelac [Wed, 23 Oct 2024 12:38:21 +0000 (14:38 +0200)]
export: add missed buffer initialization

Since we reduced emitting to single string list,
we need to make sure empty list are not producing
garbage strings.

2 months agoWHATS_NEW: update 1508859043
Zdenek Kabelac [Wed, 23 Oct 2024 12:07:57 +0000 (14:07 +0200)]
WHATS_NEW: update

2 months agoexport: change to read_segtype_and_lvflags
Zdenek Kabelac [Wed, 23 Oct 2024 11:30:55 +0000 (13:30 +0200)]
export: change to read_segtype_and_lvflags

Instead of duplicating whole segtype string with flags and
using 2 calls read_segtype_lvflags() + get_segtype_from_string(),
merge the functionality into a single read_segtype_and_lvflags().
This allows to make only a local string copy (no allocs) and eventually
to not copy segtype string at all, when there are no flags.

2 months agoexport: reduce emit_to_buffer calls
Zdenek Kabelac [Sun, 20 Oct 2024 20:14:39 +0000 (22:14 +0200)]
export: reduce emit_to_buffer calls

As the 'emit_to_buffer' uses relatively complex
vsnprintf() call inside, try to reduce number
of unnecessary calls and try replace some more
complex string build with a single call instead.

2 months agodev-cache: enhance usability of dm cache
Zdenek Kabelac [Wed, 23 Oct 2024 09:49:55 +0000 (11:49 +0200)]
dev-cache: enhance usability of dm cache

With existing code, the cache was working only to the 2nd. locking.
So i.e. when 'lvs' scans system with more then one VG, the caching
was effectively not working.

Update the code, so the label invalidate code is able to update DM
cache - so whenever we take a new lock - we will refresh the cache.

TODO: the refresh ATM does a very simple compare of old a new list
of cached DM device, and with the first spotted difference, it just
fallback to the full rebuild of DM cache - with large amount of active
devices this might not the most efficient way....

2 months agotests: skip test for too old sfdisk 1507849733
Zdenek Kabelac [Tue, 22 Oct 2024 20:30:47 +0000 (22:30 +0200)]
tests: skip test for too old sfdisk

2 months agocheck_lv_segment: correct last change
Zdenek Kabelac [Tue, 22 Oct 2024 20:25:54 +0000 (22:25 +0200)]
check_lv_segment: correct last change

Previous commit 7c5cca600c071c9991acb3fcafb9f8a3f60e03e5
was not correctly aliging block that was checking mirrors.

2 months agoWHATS_NEW: update 1507600020
Zdenek Kabelac [Wed, 9 Oct 2024 11:18:14 +0000 (13:18 +0200)]
WHATS_NEW: update

2 months agodebug: drop stack
Zdenek Kabelac [Sat, 19 Oct 2024 22:43:42 +0000 (00:43 +0200)]
debug: drop stack

2 months agodebug: use just LV name for debug message
Zdenek Kabelac [Sun, 20 Oct 2024 18:48:56 +0000 (20:48 +0200)]
debug: use just LV name for debug message

Since we detect 'debug' level after calling 'log_debug()' - all
the arguments are evaluated, so in this case display_lvname() was
preparing a string that is not used in case debugging is not enabled.

So since these string are on 'hot-path' and it's already known
which VG is being worked on, in these few cases just use lv->name.

2 months agoreporting: prepare id string only for json output
Zdenek Kabelac [Fri, 18 Oct 2024 17:38:25 +0000 (19:38 +0200)]
reporting: prepare id string only for json output

When processing LVs for a command we stored  '*object_id' & '*group_id'
as printable string that was however only used with json reporting.

Refactor code so we simply store there 'struct id*' that is just
converted into printable string when json reporting is really used.

Also check for 'sigint()' right before loop processing begins which
is primary purpose of this test.

2 months agovg_validate: use radix_tree
Zdenek Kabelac [Tue, 15 Oct 2024 13:28:10 +0000 (15:28 +0200)]
vg_validate: use radix_tree

Replace dm_hash with radix_tree which uses less memory
and gives same performance.

2 months agoconfig: use dm_config_parse_only_section
Zdenek Kabelac [Thu, 17 Oct 2024 21:11:16 +0000 (23:11 +0200)]
config: use dm_config_parse_only_section

2 months agodevice_mapper: add dm_config_parse_only_section
Zdenek Kabelac [Thu, 17 Oct 2024 21:10:01 +0000 (23:10 +0200)]
device_mapper: add dm_config_parse_only_section

This function call is able to setup config parser so it stops
parsing 'subsection' nodes after parsing named section node.
Only nodes at 'level' 0 will be still processed. And this nodes
are found by searching for last  \n}\n sequence from the end of
buffer   (instead of trying to analyze all the text in buffer).

2 months agoexport: use radix_tree for write formatter
Zdenek Kabelac [Sat, 12 Oct 2024 22:23:08 +0000 (00:23 +0200)]
export: use radix_tree for write formatter

Replace use of dm_hash with radix_tree when making PV index names.

Store just the index number itself and use pv%d for outf() string.

For lookup up a PV - use just the PV pointer itself, it's faster then
converint for it's ID to UUID format.

2 months agocheck_lv_segment: split into incomplete complete
Zdenek Kabelac [Fri, 18 Oct 2024 22:05:45 +0000 (00:05 +0200)]
check_lv_segment: split into incomplete complete

Split single check_lv_segments() into 2 separate
versions so they can be called independently.
This allow to 'skip' already checked segment
check after it's been imported to VG and also
avoid another repeated checking when validating
segment with complete vg.

**
check_lv_segments_incomplete_vg()

this check just basic LV segment properties and does not
validate those requiring full VG.

**
check_lv_segments_complete_vg()

Remaining check that expects complete VG is present.

2 months agometadata: look for LV by name with find_lv
Zdenek Kabelac [Tue, 15 Oct 2024 11:31:21 +0000 (13:31 +0200)]
metadata: look for LV by name with find_lv

Avoid getting dm_list reference when looking for logical_volume*.

2 months agothin: check only for profiled config vars
Zdenek Kabelac [Sat, 12 Oct 2024 23:11:04 +0000 (01:11 +0200)]
thin: check only for profiled config vars

ATM this rather save a lot of unncessary log entries as it grabs
the global autoextend_threshold (profile == NULL) just once instead
of revealing it every time with NULL profile.

2 months agolv: set creation uses const string
Zdenek Kabelac [Mon, 21 Oct 2024 09:20:12 +0000 (11:20 +0200)]
lv: set creation uses const string

There is no need to duplicate const string we got and keep
from uname() call.

2 months agoexport: limit generation of comment strings
Zdenek Kabelac [Sat, 19 Oct 2024 23:56:23 +0000 (01:56 +0200)]
export: limit generation of comment strings

Generate comment string only for formatter with comments.

2 months agoimport: check fixup mirror only when needed
Zdenek Kabelac [Sat, 19 Oct 2024 17:37:25 +0000 (19:37 +0200)]
import: check fixup mirror only when needed

Track whether import has even seen segment of LV with log_lv,
and call fixup mirror only in this case.

Also avoid repeated lookup of get_segtype_from_string for
SEG_TYPE_NAME_MIRROR.

2 months agodevice_mapper: increase mem pool chunk size
Zdenek Kabelac [Sat, 12 Oct 2024 18:52:27 +0000 (20:52 +0200)]
device_mapper: increase mem pool chunk size

Use bigger memory pool chunk size and reduces amount of
memory pool extensions when handling larger metadata, but do not
make it noticable bigger when handling small ones...

Use same large value also when allocating VG memory pool.

2 months agodevice_mapper: join flags checks together
Zdenek Kabelac [Sat, 19 Oct 2024 16:31:26 +0000 (18:31 +0200)]
device_mapper: join flags checks together

Just use a single bitmask flag check and OR fields together.

2 months agodevice_mapper: query for json report once
Zdenek Kabelac [Mon, 21 Oct 2024 12:17:28 +0000 (14:17 +0200)]
device_mapper: query for json report once

Remember _is_json_report() check for whole function.

2 months agodevice_mapper: use on stack allocation
Zdenek Kabelac [Mon, 21 Oct 2024 12:16:23 +0000 (14:16 +0200)]
device_mapper: use on stack allocation

Reduce number of heap allocation calls and for smaller
locally used string, use on stack allocation.

2 months agodevice_mapper: store string on stack
Zdenek Kabelac [Sat, 12 Oct 2024 19:31:11 +0000 (21:31 +0200)]
device_mapper: store string on stack

Instead of allocating string from a pool, for shorted strings
use buffer on stack since the string after the use in _find_or_make_node()
as no longer needed.
Eventually we may enhance code also for TOK_STRING_ESCAPED and TOK_STRING,
but they appear to be unused for _section().

2 months agodevice_mapper: slight improvement of tok_match
Zdenek Kabelac [Wed, 9 Oct 2024 15:16:44 +0000 (17:16 +0200)]
device_mapper: slight improvement of tok_match

Reduce amount of unnecessary instructions for some code paths.

2 months agodevice_mapper: optimize _get_token
Zdenek Kabelac [Wed, 9 Oct 2024 12:59:25 +0000 (14:59 +0200)]
device_mapper: optimize _get_token

For the most common part check for '#' when it's known it's not a space.
And also when we checked for '\n' we dont need to check again isspace().

Also help a bit more 'gcc' optimizer to grab buffer char just once and
simplify jump to next characted in the buffer when checking for token.

2 months agodevice_mapper: nodes and values with strings
Zdenek Kabelac [Wed, 9 Oct 2024 12:23:51 +0000 (14:23 +0200)]
device_mapper: nodes and values with strings

Avoid double dm_pool allocation call by copying string
for node name and config value directly after the end
of node/value structure.

It would be likely better to not copy these strings at all
and derefence it from the original string however that
needs futher changes in the code base.

2 months agocrc: add newer zlib code
Zdenek Kabelac [Fri, 4 Oct 2024 12:03:16 +0000 (14:03 +0200)]
crc: add newer zlib code

This code is faster when calculating crc32 checksum for larger
block areas. There is also SIMD variant present in the code,
however ATM the influence on performance of lvm2 is not that big..

This page took 0.072214 seconds and 5 git commands to generate.