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

205 Commits

Author SHA1 Message Date
Zdenek Kabelac
a202e404cd debug-only: experimenting with avoiding dupcheck
Experimental hack try to see, how lvm2 stays if
duplicates are allowed to pass through 'vgcfgrestore()'
2024-10-29 23:00:08 +01:00
Zdenek Kabelac
e2b00dd162 device_mapper: use static array for dm_size_to_string
Avoid copying this structure on stack with every call.
2024-10-28 20:07:37 +01:00
Zdenek Kabelac
7d48c1f6e3 device_mapper: add omitted error message 2024-10-25 01:26:39 +02:00
Zdenek Kabelac
5d2d3c53a4 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).
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
89da9ae251 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.
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
9c9953dc3e device_mapper: join flags checks together
Just use a single bitmask flag check and OR fields together.
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
fd9f7d10ca device_mapper: query for json report once
Remember _is_json_report() check for whole function.
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
f59fa69507 device_mapper: use on stack allocation
Reduce number of heap allocation calls and for smaller
locally used string, use on stack allocation.
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
d8996a2a12 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().
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
c29e3410c9 device_mapper: slight improvement of tok_match
Reduce amount of unnecessary instructions for some code paths.
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
92158a24a5 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.
2024-10-22 19:36:00 +02:00
Zdenek Kabelac
2f022f5cbb 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.
2024-10-22 19:36:00 +02:00
zkabelac
0862e2b150 cleanup: typos in libdm 2024-09-27 13:42:45 +02:00
Peter Rajnoha
1e48599193
libdm: do not fail if GETVAL semctl fails for udev sync inc and dec
While performing udev sync semaphore's inc/dec operation, we use the
result from GETVAL semctl just to print a debug message with current
value of that sempahore, nothing else.

If the GETVAL fails for whetever reason while the actual inc/dec
completes successfully, just log a warning message about the GETVAL
(and print the debug messages without the actual semaphore value)
and return success for the inc/dec operation as a whole.
2024-09-05 12:14:42 +02:00
Peter Rajnoha
f7f08ba881
libdm: clean up udev sync semaphore on fail path during its creation
Clean up udev sync semaphore on fail path during its creation, otherwise
the caller will have no handle returned to clean it up itself and the
semaphore will keep staying in the system. The only way to clean it up
would be to call `dmsetup udevcomplete_all` which would destroy all
udev sync semaphores, not just the failed one, which we don't want.
2024-09-05 12:14:42 +02:00
Peter Rajnoha
de196f4b60
libdm: add 'cookie create/inc/dec' log prefix if GETVAL fails for udev sync ops
The same message is printed while performing create/inc/dec operation and
the GETVAL semctl fails. Add a prefix so we know exactly in which of
these functions the issue actually happened.
2024-09-05 12:14:37 +02:00
Zdenek Kabelac
39b7d1ba8f cleanup: typos in comments
Collection of typos in code comments.
Should have no runtime effect.
2024-08-30 16:51:15 +02:00
Zdenek Kabelac
7da47cea35 cleanup: typos in logging
Fixes various typos in printed/logged messages.
2024-08-30 16:51:15 +02:00
zkabelac
1c9e619fef libdm: _DOESNT_ to _DOES_NOT_
Rename internal define DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID
to DM_NAME_LIST_FLAG_DOES_NOT_HAVE_UUID
(currently unused)
2024-08-30 16:48:48 +02:00
Zdenek Kabelac
a8696ee72a libdm: check for queue name
Fix typo and check for queue string within sysfs kernel name.
2024-08-30 16:48:48 +02:00
Zdenek Kabelac
f301f6acbc integrity: typo interleave_sectors
Correct emitted parameter name for interleave_sectors for DM table line.
2024-08-30 16:48:48 +02:00
Zdenek Kabelac
e150931fc4 cov: validate list emptiness
Emit internal error for empty list.
2024-08-09 15:10:18 +02:00
David Teigland
78d14a805c integrity: add --integritysettings for tuning
The option can be used in multiple ways (like --cachesettings):

--integritysettings key=val
--integritysettings 'key1=val1 key2=val2'
--integritysettings key1=val1 --integritysettings key2=val2

Use with lvcreate or lvconvert when integrity is first enabled
to configure:
journal_sectors
journal_watermark
commit_time
bitmap_flush_interval
allow_discards

Use with lvchange to configure (only while inactive):
journal_watermark
commit_time
bitmap_flush_interval
allow_discards

lvchange --integritysettings "" clears any previously configured
settings, so dm-integrity will use its own defaults.

lvs -a -o integritysettings displays configured settings.
2024-08-07 17:40:34 -05:00
Zdenek Kabelac
336cb32884 device_mapper: empty string for missing uuid
Constify name & uuid within dm_active_device.
Set uuid to "" for case the DM device has no uuid.
Do not store "empty" device uuid in radix tree.
2024-06-21 14:51:25 +02:00
Zdenek Kabelac
e30bc9b179 device_mapper: refactor code to lvm library
Move the code around caching active dm device devno, name and uuid
from device_mapper/libdm-iface to dev_cache file - as libdm layer
cares about 'decoding' ioctl data from kernel and caching for use by
lvm stays within lvm.

Introduce:
dev_cache_update_dm_devs
dev_cache_get_dm_dev_by_devno
dev_cache_get_dm_dev_by_uuid

Use radix_tree for searching.
2024-06-21 11:28:54 +02:00
Zdenek Kabelac
fbdd26a4a3 device_mapper: solve no devices path
Malloc needs to use sane value when names would be NULL.
Also for devices without 'uuid' return empty string instead of NULL.
2024-05-27 21:33:59 +02:00
Zdenek Kabelac
93115ef91d libdm: drop allocation
Use structure allocated on local stack.
2024-05-27 15:35:57 +02:00
Zdenek Kabelac
1712845ab5 device_mapper: use const for this API
Allow using constified version of devs_list.
Internal loop does not need to modify anythin in this stucture.
2024-05-27 15:35:17 +02:00
Zdenek Kabelac
36691b9844 device_mapper: add dm_device_list_find_by_dev
Introduce function to find device's name and uuid for
a given major:minor.

This information is cached with dm_device_list which reads all the
info from single ioctl(DM_DEVICE_LIST).
Lvm keeps major:minor name & uuid for active devices in the system.
2024-05-27 15:34:16 +02:00
Zdenek Kabelac
dd78573073 libdm: parse only block section for proc_devices
Check for begining of 'B'lock section in /proc/devices file
before starting to sscanf() for major.
2024-05-27 15:16:25 +02:00
Zdenek Kabelac
32b2776afc makefiles: use properly defined varitable
Variable used for tracking dependencies is USE_TRACKING.
2024-05-14 17:59:26 +02:00
Zdenek Kabelac
7d22be22d9 gcc: use proper commnent 2024-05-14 17:59:26 +02:00
Zdenek Kabelac
a86fb27607 cov: ensure pointer has defined value
Add initialization of 'fin' pointer.
2024-05-13 17:32:46 +02:00
Zdenek Kabelac
026344e8cc cleanup: local const arrays
No need for relocation entries for locally used arrays.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
d25c43c8cd cleanup: remove unuable code path
Eliminate some ancient unreachable code
for historical version of libdm.
2024-05-13 12:58:37 +02:00
Zdenek Kabelac
00cfe3a24e libdm: reapply "fix condition"
This reverts commit d16a8f80e9.
So the correction was OK, however we missed to fix also
cut&paste bug here - as the second check should be
actually checking  field->type.
2024-05-10 14:24:17 +02:00
Zdenek Kabelac
2f3fcbd245 libdm: fix invalid conversion
Previous commit missed to also add one to added 'len'.
2024-05-08 10:16:01 +02:00
Zdenek Kabelac
f0d3d0482e cov: enum health status
Cleanly map health char status to enum.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
f6e0e7b9aa cov: sanitize input buffer
Make coverity aware the input line is legit.
Eventually add more sanitize functionality.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
4761753a6f cov: replace strcpy with memcpy 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
04b407674c cov: use sscanf buffer size limits
String parsing with buffer size limit.
2024-05-08 01:55:21 +02:00
Zdenek Kabelac
e56e7ed533 libdm: unlink checks for ENOENT 2024-05-08 01:55:21 +02:00
Zdenek Kabelac
a763420786 libdm: use literal for error message
Use literals for printf messages.
2024-05-08 01:55:20 +02:00
Zdenek Kabelac
d16a8f80e9 Revert "libdm: fix condition"
This reverts commit 2a1e200f7a.

Breaks some test - more analysis is needed.
2024-05-04 01:37:51 +02:00
Zdenek Kabelac
e0bd66b73a const: use common error path
Instead of defining  _field_selection_value_alloc_failed_msg[],
use common error path code for printing field_id.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
c9f9744f50 const: libdm cmd_data_v4 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
9247e754fe const: libdm tok_op 2024-05-04 01:01:57 +02:00
Zdenek Kabelac
e6f46fafe7 const: use arrays of strings 2
Next set of changes.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
efe2005022 const: drop static keyword
We don't need relocatable space to store 'const' number.
2024-05-04 01:01:57 +02:00
Zdenek Kabelac
abf7c40185 const: static array
Such array can be stored  in   .rodata   section.
2024-05-04 01:01:57 +02:00