master - activation: log target version present
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0650a16a2273f9...
Commit: 0650a16a2273f9ce8b224533083055b67cbff892
Parent: 7b5ea9a5a89b4eff41520142f719a7d89435f7df
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 7 18:47:33 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 7 18:47:33 2012 +0100
activation: log target version present
Log (very verbose) the target version present in target_version.
---
lib/activate/activate.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 3156f01..512adcf 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -514,6 +514,11 @@ int target_version(const char *target_name, uint32_t *maj,
} while (last_target != target);
out:
+ if (r)
+ log_very_verbose("Found %s target "
+ "v%" PRIu32 ".%" PRIu32 ".%" PRIu32 ".",
+ target_name, *maj, *min, *patchlevel);
+
dm_task_destroy(dmt);
return r;
11 years, 8 months
master - thin: tighten discard string conversions
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7b5ea9a5a89b4e...
Commit: 7b5ea9a5a89b4eff41520142f719a7d89435f7df
Parent: adfa778a58719cb78971526b68a93cee56a18cc4
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 7 18:37:35 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 7 18:37:35 2012 +0100
thin: tighten discard string conversions
Respond with "unknown" rather than a NULL pointer if there's an
internal error and the discard value is invalid.
Don't accept 'no_passdown' or 'no-passdown' variants in the LVM
metadata: this is written by the program so should only ever contain
"nopassdown" and should be validated strictly against that.
---
lib/metadata/thin_manip.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 8d1744c..0395b48 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -433,10 +433,7 @@ int get_pool_discard(const char *str, thin_discard_t *discard)
{
if (!strcasecmp(str, "passdown"))
*discard = THIN_DISCARD_PASSDOWN;
- /* Allow some variation in thin parameter */
- else if (!strcasecmp(str, "nopassdown") ||
- !strcasecmp(str, "no-passdown") ||
- !strcasecmp(str, "no_passdown"))
+ else if (!strcasecmp(str, "nopassdown"))
*discard = THIN_DISCARD_NO_PASSDOWN;
else if (!strcasecmp(str, "ignore"))
*discard = THIN_DISCARD_IGNORE;
@@ -459,7 +456,7 @@ const char *get_pool_discard_name(thin_discard_t discard)
return "ignore";
}
- log_error(INTERNAL_ERROR "Uknown discard type.");
+ log_error(INTERNAL_ERROR "Uknown discard type encountered.");
- return NULL;
+ return "unknown";
}
11 years, 8 months
master - thin: order discard enum alphabetically
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=adfa778a58719c...
Commit: adfa778a58719cb78971526b68a93cee56a18cc4
Parent: 4dab0d3175a9bc6658611f06ba8b0c05b40e06bd
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 7 18:36:40 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 7 18:36:40 2012 +0100
thin: order discard enum alphabetically
---
lib/metadata/metadata-exported.h | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index d2afdb1..35ffa93 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -167,9 +167,9 @@ typedef enum {
} force_t;
typedef enum {
- THIN_DISCARD_PASSDOWN,
- THIN_DISCARD_NO_PASSDOWN,
THIN_DISCARD_IGNORE,
+ THIN_DISCARD_NO_PASSDOWN,
+ THIN_DISCARD_PASSDOWN,
} thin_discard_t;
struct cmd_context;
11 years, 8 months
master - comments: misc updates
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4dab0d3175a9bc...
Commit: 4dab0d3175a9bc6658611f06ba8b0c05b40e06bd
Parent: 016997acaf8bc59e5b48e9b33ef2db0596e25063
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 7 18:34:30 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 7 18:34:30 2012 +0100
comments: misc updates
Miscellaneous clarifications to comments.
---
doc/example.conf.in | 6 +++---
lib/mm/memlock.c | 1 +
libdm/libdevmapper.h | 6 +++---
libdm/libdm-deptree.c | 8 ++++----
4 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/doc/example.conf.in b/doc/example.conf.in
index a085014..576397b 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -86,9 +86,9 @@ devices {
# It is safe to delete the contents: the tools regenerate it.
# (The old setting 'cache' is still respected if neither of
# these new ones is present.)
- # N.B. This type of caching is obsolete and existing .cache
- # file is removed if the list of devices is obtained from
- # udev by setting the obtain_device_list_from_udev to 1.
+ # N.B. If obtain_device_list_from_udev is set to 1 the list of
+ # devices is instead obtained from udev and any existing .cache
+ # file is removed.
cache_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@"
cache_file_prefix = ""
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index dfc0d42..2240a1d 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -131,6 +131,7 @@ static void _allocate_memory(void)
((_size_stack * 2) < limit.rlim_cur) &&
((stack_mem = alloca(_size_stack))))
_touch_memory(stack_mem, _size_stack);
+ /* FIXME else warn user setting got ignored */
if ((temp_malloc_mem = malloc(_size_malloc_tmp)))
_touch_memory(temp_malloc_mem, _size_malloc_tmp);
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 0786b38..28685b2 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -650,8 +650,8 @@ typedef enum {
DM_THIN_MESSAGE_CREATE_THIN, /* device_id */
DM_THIN_MESSAGE_DELETE, /* device_id */
DM_THIN_MESSAGE_SET_TRANSACTION_ID, /* current_id, new_id */
- DM_THIN_MESSAGE_RESERVE_METADATA_SNAP, /* 1.1 */
- DM_THIN_MESSAGE_RELEASE_METADATA_SNAP, /* 1.1 */
+ DM_THIN_MESSAGE_RESERVE_METADATA_SNAP, /* target version >= 1.1 */
+ DM_THIN_MESSAGE_RELEASE_METADATA_SNAP, /* target version >= 1.1 */
} dm_thin_message_t;
int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
@@ -663,7 +663,7 @@ int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
* ignore - Disable discard support
* no_passdown - Don't pass discard down to underlaying data device,
* just remove the mapping
- * Feature is available for 1.1
+ * Feature is available since version 1.1 of the thin target.
*/
int dm_tree_node_set_thin_pool_discard(struct dm_tree_node *node,
unsigned ignore,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index acd82ca..031ce5e 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -192,8 +192,8 @@ struct load_segment {
uint64_t low_water_mark; /* Thin_pool */
uint32_t data_block_size; /* Thin_pool */
unsigned skip_block_zeroing; /* Thin_pool */
- unsigned ignore_discard; /* Thin_pool 1.1 */
- unsigned no_discard_passdown; /* Thin_pool 1.1 */
+ unsigned ignore_discard; /* Thin_pool target vsn 1.1 */
+ unsigned no_discard_passdown; /* Thin_pool target vsn 1.1 */
uint32_t device_id; /* Thin */
};
@@ -1411,10 +1411,10 @@ static int _thin_pool_node_message(struct dm_tree_node *dnode, struct thin_messa
m->u.m_set_transaction_id.current_id,
m->u.m_set_transaction_id.new_id);
break;
- case DM_THIN_MESSAGE_RESERVE_METADATA_SNAP: /* 1.1 */
+ case DM_THIN_MESSAGE_RESERVE_METADATA_SNAP: /* target vsn 1.1 */
r = dm_snprintf(buf, sizeof(buf), "reserve_metadata_snap");
break;
- case DM_THIN_MESSAGE_RELEASE_METADATA_SNAP: /* 1.1 */
+ case DM_THIN_MESSAGE_RELEASE_METADATA_SNAP: /* target vsn 1.1 */
r = dm_snprintf(buf, sizeof(buf), "release_metadata_snap");
break;
default:
11 years, 8 months
master - man: document allocation process in lvm.8
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=016997acaf8bc5...
Commit: 016997acaf8bc59e5b48e9b33ef2db0596e25063
Parent: 6e55201144be3bcf82b6aafe7e9f7430318719d0
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 7 02:06:42 2012 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 7 02:06:42 2012 +0100
man: document allocation process in lvm.8
---
WHATS_NEW | 1 +
man/lvm.8.in | 190 +++++++++++++++++++++++++++++++++++++++-------------------
2 files changed, 130 insertions(+), 61 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index eab7e99..2c4d139 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Improve documention of allocation policies in lvm.8.
Increase limit for major:minor to 4095:1048575 when using -My option.
Add make install_systemd_generators.
Add generator for lvm2 activation systemd units.
diff --git a/man/lvm.8.in b/man/lvm.8.in
index cf5d4bc..a2108ed 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -50,96 +50,99 @@ loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
\fBpvdata\fP \(em Not implemented in LVM2.
.TP
-\fBsegtypes\fP \(em Display recognised logical volume segment types.
+\fBsegtypes\fP \(em Display recognised Logical Volume segment types.
.TP
\fBversion\fP \(em Display version information.
.LP
.SH COMMANDS
The following commands implement the core LVM functionality.
.TP
-\fBpvchange\fP \(em Change attributes of a physical volume.
+\fBpvchange\fP \(em Change attributes of a Physical Volume.
.TP
-\fBpvck\fP \(em Check physical volume metadata.
+\fBpvck\fP \(em Check Physical Volume metadata.
.TP
\fBpvcreate\fP \(em Initialize a disk or partition for use by LVM.
.TP
-\fBpvdisplay\fP \(em Display attributes of a physical volume.
+\fBpvdisplay\fP \(em Display attributes of a Physical Volume.
.TP
-\fBpvmove\fP \(em Move physical extents.
+\fBpvmove\fP \(em Move Physical Extents.
.TP
-\fBpvremove\fP \(em Remove a physical volume.
+\fBpvremove\fP \(em Remove a Physical Volume.
.TP
\fBpvresize\fP \(em Resize a disk or partition in use by LVM2.
.TP
-\fBpvs\fP \(em Report information about physical volumes.
+\fBpvs\fP \(em Report information about Physical Volumes.
.TP
-\fBpvscan\fP \(em Scan all disks for physical volumes.
+\fBpvscan\fP \(em Scan all disks for Physical Volumes.
.TP
-\fBvgcfgbackup\fP \(em Backup volume group descriptor area.
+\fBvgcfgbackup\fP \(em Backup Volume Group descriptor area.
.TP
-\fBvgcfgrestore\fP \(em Restore volume group descriptor area.
+\fBvgcfgrestore\fP \(em Restore Volume Group descriptor area.
.TP
-\fBvgchange\fP \(em Change attributes of a volume group.
+\fBvgchange\fP \(em Change attributes of a Volume Group.
.TP
-\fBvgck\fP \(em Check volume group metadata.
+\fBvgck\fP \(em Check Volume Group metadata.
.TP
-\fBvgconvert\fP \(em Convert volume group metadata format.
+\fBvgconvert\fP \(em Convert Volume Group metadata format.
.TP
-\fBvgcreate\fP \(em Create a volume group.
+\fBvgcreate\fP \(em Create a Volume Group.
.TP
-\fBvgdisplay\fP \(em Display attributes of volume groups.
+\fBvgdisplay\fP \(em Display attributes of Volume Groups.
.TP
-\fBvgexport\fP \(em Make volume groups unknown to the system.
+\fBvgexport\fP \(em Make volume Groups unknown to the system.
.TP
-\fBvgextend\fP \(em Add physical volumes to a volume group.
+\fBvgextend\fP \(em Add Physical Volumes to a Volume Group.
.TP
-\fBvgimport\fP \(em Make exported volume groups known to the system.
+\fBvgimport\fP \(em Make exported Volume Groups known to the system.
.TP
-\fBvgimportclone\fP \(em Import and rename duplicated volume group (e.g. a hardware snapshot).
+\fBvgimportclone\fP \(em Import and rename duplicated Volume Group (e.g. a hardware snapshot).
.TP
-\fBvgmerge\fP \(em Merge two volume groups.
+\fBvgmerge\fP \(em Merge two Volume Groups.
.TP
-\fBvgmknodes\fP \(em Recreate volume group directory and logical volume special files
+\fBvgmknodes\fP \(em Recreate Volume Group directory and Logical Volume special files
.TP
-\fBvgreduce\fP \(em Reduce a volume group by removing one or more physical volumes.
+\fBvgreduce\fP \(em Reduce a Volume Group by removing one or more
+Physical Volumes.
.TP
-\fBvgremove\fP \(em Remove a volume group.
+\fBvgremove\fP \(em Remove a Volume Group.
.TP
-\fBvgrename\fP \(em Rename a volume group.
+\fBvgrename\fP \(em Rename a Volume Group.
.TP
-\fBvgs\fP \(em Report information about volume groups.
+\fBvgs\fP \(em Report information about Volume Groups.
.TP
-\fBvgscan\fP \(em Scan all disks for volume groups and rebuild caches.
+\fBvgscan\fP \(em Scan all disks for Volume Groups and rebuild caches.
.TP
-\fBvgsplit\fP \(em Split a volume group into two, moving any logical volumes from one volume group to another by moving entire physical volumes.
+\fBvgsplit\fP \(em Split a Volume Group into two, moving any logical
+volumes from one Volume Group to another by moving entire Physical
+Volumes.
.TP
-\fBlvchange\fP \(em Change attributes of a logical volume.
+\fBlvchange\fP \(em Change attributes of a Logical Volume.
.TP
-\fBlvconvert\fP \(em Convert a logical volume from linear to mirror or snapshot.
+\fBlvconvert\fP \(em Convert a Logical Volume from linear to mirror or snapshot.
.TP
-\fBlvcreate\fP \(em Create a logical volume in an existing volume group.
+\fBlvcreate\fP \(em Create a Logical Volume in an existing Volume Group.
.TP
-\fBlvdisplay\fP \(em Display attributes of a logical volume.
+\fBlvdisplay\fP \(em Display attributes of a Logical Volume.
.TP
-\fBlvextend\fP \(em Extend the size of a logical volume.
+\fBlvextend\fP \(em Extend the size of a Logical Volume.
.TP
-\fBlvmchange\fP \(em Change attributes of the logical volume manager.
+\fBlvmchange\fP \(em Change attributes of the Logical Volume Manager.
.TP
\fBlvmdiskscan\fP \(em Scan for all devices visible to LVM2.
.TP
\fBlvmdump\fP \(em Create lvm2 information dumps for diagnostic purposes.
.TP
-\fBlvreduce\fP \(em Reduce the size of a logical volume.
+\fBlvreduce\fP \(em Reduce the size of a Logical Volume.
.TP
-\fBlvremove\fP \(em Remove a logical volume.
+\fBlvremove\fP \(em Remove a Logical Volume.
.TP
-\fBlvrename\fP \(em Rename a logical volume.
+\fBlvrename\fP \(em Rename a Logical Volume.
.TP
-\fBlvresize\fP \(em Resize a logical volume.
+\fBlvresize\fP \(em Resize a Logical Volume.
.TP
-\fBlvs\fP \(em Report information about logical volumes.
+\fBlvs\fP \(em Report information about Logical Volumes.
.TP
-\fBlvscan\fP \(em Scan (all disks) for logical volumes.
+\fBlvscan\fP \(em Scan (all disks) for Logical Volumes.
.TP
The following commands are not implemented in LVM2 but might be in the future: lvmsadc, lvmsar, pvdata.
.SH OPTIONS
@@ -183,13 +186,13 @@ You are strongly advised not to disable this!
See \fBvgcfgbackup\fP(8).
.TP
.BR \-P ", " \-\-partial
-When set, the tools will do their best to provide access to volume groups
-that are only partially available (one or more physical volumes belonging
-to the volume group are missing from the system). Where part of a logical
+When set, the tools will do their best to provide access to Volume Groups
+that are only partially available (one or more Physical Volumes belonging
+to the Volume Group are missing from the system). Where part of a logical
volume is missing, \fB/dev/ioerror\fP will be substituted, and you could use
\fBdmsetup\fP(8) to set this up to return I/O errors when accessed,
or create it as a large block device of nulls. Metadata may not be
-changed with this option. To insert a replacement physical volume
+changed with this option. To insert a replacement Physical Volume
of the same or large size use \fBpvcreate \-u\fP to set the uuid to
match the original followed by \fBvgcfgrestore\fP(8).
.TP
@@ -239,27 +242,23 @@ The allocation policy to use:
.IR normal ,
.IR anywhere " or"
.IR inherit .
-When a command needs to allocate physical extents from the volume group,
+When a command needs to allocate Physical Extents from the Volume Group,
the allocation policy controls how they are chosen.
-Each volume group and logical volume has an allocation policy.
-The default for a volume group is \fInormal\fP which applies
+Each Volume Group and Logical Volume has an allocation policy defined.
+The default for a Volume Group is \fInormal\fP which applies
common-sense rules such as not placing parallel stripes on the same
-physical volume. The default for a logical volume is \fIinherit\fP
-which applies the same policy as for the volume group. These policies can
-be changed using \fBlvchange\fP(8) and \fBvgchange\fP(8) or over-ridden
+Physical Volume. The default for a Logical Volume is \fIinherit\fP
+which applies the same policy as for the Volume Group. These policies can
+be changed using \fBlvchange\fP(8) and \fBvgchange\fP(8) or overridden
on the command line of any command that performs allocation.
-The \fIcontiguous\fP policy requires that new extents be placed adjacent
-to existing extents.
-The \fIcling\fP policy places new extents on the same physical
-volume as existing extents in the same stripe of the Logical Volume.
-If there are sufficient free extents to satisfy
+The \fIcontiguous\fP policy requires that new Physical Extents be placed adjacent
+to existing Physical Extents.
+The \fIcling\fP policy places new Physical Extents on the same Physical
+Volume as existing Physical Extents in the same stripe of the Logical Volume.
+If there are sufficient free Physical Extents to satisfy
an allocation request but \fInormal\fP doesn't use them,
\fIanywhere\fP will - even if that reduces performance by
-placing two stripes on the same physical volume.
-.IP
-N.B. The policies described above are not implemented fully yet.
-In particular, contiguous free space cannot be broken up to
-satisfy allocation attempts.
+placing two stripes on the same Physical Volume.
.SH ENVIRONMENT VARIABLES
.TP
.B HOME
@@ -271,8 +270,8 @@ Directory containing \fBlvm.conf\fP(5) and other LVM system files.
Defaults to "#DEFAULT_SYS_DIR#".
.TP
.B LVM_VG_NAME
-The volume group name that is assumed for
-any reference to a logical volume that doesn't specify a path.
+The Volume Group name that is assumed for
+any reference to a Logical Volume that doesn't specify a path.
Not set by default.
.SH VALID NAMES
The following characters are valid for VG and LV names:
@@ -283,8 +282,77 @@ There are also various reserved names that are used internally by lvm that can n
A VG cannot be called anything that exists in /dev/ at the time of creation, nor can it be called '.' or '..'.
A LV cannot be called '.' '..' 'snapshot' or 'pvmove'. The LV name may also not contain
the strings '_mlog', '_mimage', '_rimage', '_tdata', '_tmeta'.
+.SH ALLOCATION
+When an operation needs to allocate Physical Extents for one or more
+Logical Volumes, the tools proceed as follows:
+First of all, they generate the complete set of unallocated Physical Extents
+in the Volume Group. If any ranges of Physical Extents are supplied at
+the end of the command line, only unallocated Physical Extents within
+those ranges on the specified Physical Volumes are considered.
+Then they try each allocation policy in turn, starting with the strictest
+policy (\fIcontiguous\fP) and ending with the allocation policy specified
+using \fB\-\-alloc\fP or set as the default for the particular Logical
+Volume or Volume Group concerned. For each policy, working from the
+lowest-numbered Logical Extent of the empty Logical Volume space that
+needs to be filled, they allocate as much space as possible according to
+the restrictions imposed by the policy. If more space is needed,
+they move on to the next policy.
+
+The restrictions are as follows:
+
+\fIContiguous\fP requires that the physical location of any Logical
+Extent that is not the first Logical Extent of a Logical Volume is
+adjacent to the physical location of the Logical Extent immediately
+preceding it.
+
+\fICling\fP requires that the Physical Volume used for any Logical
+Extent to be added to an existing Logical Volume is already in use by at
+least one Logical Extent earlier in that Logical Volume. If the
+configuration parameter allocation/cling_tag_list is defined, then two
+Physical Volumes are considered to match if any of the listed tags is
+present on both Physical Volumes. This allows groups of Physical
+Volumes with similar properties (such as their physical location) to be
+tagged and treated as equivalent for allocation purposes.
+
+When a Logical Volume is striped or mirrored, the above restrictions are
+applied independently to each stripe or mirror image (leg) that needs
+space.
+
+\fINormal\fP will not choose a Physical Extent that shares the same Physical
+Volume as a Logical Extent already allocated to a parallel Logical
+Volume (i.e. a different stripe or mirror image/leg) at the same offset
+within that parallel Logical Volume.
+
+When allocating a mirror log at the same time as Logical Volumes to hold
+the mirror data, Normal will first try to select different Physical
+Volumes for the log and the data. If that's not possible and the
+allocation/mirror_logs_require_separate_pvs configuration parameter is
+set to 0, it will then allow the log to share Physical Volume(s) with
+part of the data.
+
+When allocating thin pool metadata, similar considerations to those of a
+mirror log in the last paragraph apply based on the value of the
+allocation/thin_pool_metadata_require_separate_pvs configuration
+parameter.
+
+If you rely upon any layout behaviour beyond that documented here, be
+aware that it might change in future versions of the code.
+
+For example, if you supply on the command line two empty Physical
+Volumes that have an identical number of free Physical Extents available for
+allocation, the current code considers using each of them in the order
+they are listed, but there is no guarantee that future releases will
+maintain that property. If it is important to obtain a specific layout
+for a particular Logical Volume, then you should build it up through a
+sequence of \fBlvcreate\fP(8) and \fBlvconvert\fP(8) steps such that the
+restrictions described above applied to each step leave the tools no
+discretion over the layout.
+
+To view the way the allocation process currently works in any specific
+case, read the debug logging output, for example by adding \-vvvv to
+a command.
.SH DIAGNOSTICS
All tools return a status code of zero on success or non-zero on failure.
.SH FILES
11 years, 8 months
master - args: increase major:minor limit to 4095:1048575
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6e55201144be3b...
Commit: 6e55201144be3bcf82b6aafe7e9f7430318719d0
Parent: 3843f54974ea7c3bbe51fcd681a55fc23f4e7736
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Aug 6 18:01:01 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Aug 6 18:01:01 2012 +0200
args: increase major:minor limit to 4095:1048575
Remove the limit for major and minor number arguments used while specifying
persistent numbers via -My --major <major> --minor <minor> option which
was set to 255 before. Follow the kernel limit instead which is 12 bits
for major and 20 bits for minor number (kernel >= 2.6 and LVM formats
that does not have FMT_RESTRICTED_LVIDS - so still keep the old limit
of 255 for lvm1 format).
---
WHATS_NEW | 1 +
tools/args.h | 4 +-
tools/lvchange.c | 11 +++++++-
tools/lvcreate.c | 7 ++++-
tools/lvmcmdline.c | 61 ++++++++++++++++++++++++---------------------------
tools/tools.h | 2 +
6 files changed, 48 insertions(+), 38 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 92dd0dc..eab7e99 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Increase limit for major:minor to 4095:1048575 when using -My option.
Add make install_systemd_generators.
Add generator for lvm2 activation systemd units.
Add lvm_config_find_bool lvm2app fn to retrieve bool value from config tree.
diff --git a/tools/args.h b/tools/args.h
index 4909f9e..b195303 100644
--- a/tools/args.h
+++ b/tools/args.h
@@ -44,7 +44,7 @@ arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE)
arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE)
arg(refresh_ARG, '\0', "refresh", NULL, 0)
arg(mknodes_ARG, '\0', "mknodes", NULL, 0)
-arg(minor_ARG, '\0', "minor", minor_arg, ARG_GROUPABLE)
+arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE)
arg(type_ARG, '\0', "type", segtype_arg, 0)
arg(alloc_ARG, '\0', "alloc", alloc_arg, 0)
arg(separator_ARG, '\0', "separator", string_arg, 0)
@@ -117,7 +117,7 @@ arg(size_ARG, 'L', "size", size_mb_arg, 0)
arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign, 0)
arg(persistent_ARG, 'M', "persistent", yes_no_arg, 0)
arg(merge_ARG, '\0', "merge", NULL, 0)
-arg(major_ARG, 'j', "major", major_arg, ARG_GROUPABLE)
+arg(major_ARG, 'j', "major", int_arg, ARG_GROUPABLE)
arg(mirrors_ARG, 'm', "mirrors", int_arg_with_sign, 0)
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg, 0)
arg(maps_ARG, 'm', "maps", NULL, 0)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index a24d26c..c5cbe08 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -516,6 +516,7 @@ static int lvchange_persistent(struct cmd_context *cmd,
{
struct lvinfo info;
int active = 0;
+ int32_t major, minor;
if (!strcmp(arg_str_value(cmd, persistent_ARG, "n"), "n")) {
if (!(lv->status & FIXED_MINOR)) {
@@ -547,6 +548,12 @@ static int lvchange_persistent(struct cmd_context *cmd,
}
if (lv_info(cmd, lv, 0, &info, 0, 0) && info.exists)
active = 1;
+
+ major = arg_int_value(cmd, major_ARG, lv->major);
+ minor = arg_int_value(cmd, minor_ARG, lv->minor);
+ if (!major_minor_valid(cmd, lv->vg->fid->fmt, major, minor))
+ return 0;
+
if (active && !arg_count(cmd, force_ARG) &&
yes_no_prompt("Logical volume %s will be "
"deactivated temporarily. "
@@ -565,8 +572,8 @@ static int lvchange_persistent(struct cmd_context *cmd,
return 0;
}
lv->status |= FIXED_MINOR;
- lv->minor = arg_int_value(cmd, minor_ARG, lv->minor);
- lv->major = arg_int_value(cmd, major_ARG, lv->major);
+ lv->minor = minor;
+ lv->major = major;
log_verbose("Setting persistent device number to (%d, %d) "
"for \"%s\"", lv->major, lv->minor, lv->name);
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index ab217cf..48977d7 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -555,7 +555,8 @@ static int _read_raid_params(struct lvcreate_params *lp,
return 1;
}
-static int _read_activation_params(struct lvcreate_params *lp, struct cmd_context *cmd)
+static int _read_activation_params(struct lvcreate_params *lp, struct cmd_context *cmd,
+ struct volume_group *vg)
{
unsigned pagesize;
@@ -637,6 +638,8 @@ static int _read_activation_params(struct lvcreate_params *lp, struct cmd_contex
"--major when using -My");
return 0;
}
+ if (!major_minor_valid(cmd, vg->fid->fmt, lp->major, lp->minor))
+ return 0;
} else {
if ((lp->minor != -1) || (lp->major != -1)) {
log_error("--major and --minor incompatible "
@@ -1032,7 +1035,7 @@ int lvcreate(struct cmd_context *cmd, int argc, char **argv)
* Check activation parameters to support inactive thin snapshot creation
* FIXME: anything else needs to be moved past _determine_snapshot_type()?
*/
- if (!_read_activation_params(&lp, cmd)) {
+ if (!_read_activation_params(&lp, cmd, vg)) {
r = ECMD_FAILED;
goto_out;
}
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 0e6a51c..50a2ac1 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -407,38 +407,6 @@ int int_arg_with_sign_and_percent(struct cmd_context *cmd __attribute__((unused)
return 1;
}
-int minor_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av)
-{
- char *ptr;
-
- if (!_get_int_arg(av, &ptr) || (*ptr) || (av->sign == SIGN_MINUS))
- return 0;
-
- if (av->i_value > 255) {
- log_error("Minor number outside range 0-255");
- return 0;
- }
-
- return 1;
-}
-
-int major_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av)
-{
- char *ptr;
-
- if (!_get_int_arg(av, &ptr) || (*ptr) || (av->sign == SIGN_MINUS))
- return 0;
-
- if (av->i_value > 255) {
- log_error("Major number outside range 0-255");
- return 0;
- }
-
- /* FIXME Also Check against /proc/devices */
-
- return 1;
-}
-
int string_arg(struct cmd_context *cmd __attribute__((unused)),
struct arg_values *av __attribute__((unused)))
{
@@ -540,6 +508,35 @@ int metadatacopies_arg(struct cmd_context *cmd, struct arg_values *av)
return int_arg(cmd, av);
}
+int major_minor_valid(const struct cmd_context *cmd, const struct format_type *fmt,
+ int32_t major, int32_t minor)
+{
+ if (!strncmp(cmd->kernel_vsn, "2.4.", 4) ||
+ (fmt->features & FMT_RESTRICTED_LVIDS)) {
+ if (major < 0 || major > 255) {
+ log_error("Major number outside range 0-255");
+ return 0;
+ }
+ if (minor < 0 || minor > 255) {
+ log_error("Minor number outside range 0-255");
+ return 0;
+ }
+ } else {
+ /* 12 bits for major number */
+ if (major < 0 || major > 4095) {
+ log_error("Major number outside range 0-4095");
+ return 0;
+ }
+ /* 20 bits for minor number */
+ if (minor < 0 || minor > 1048575) {
+ log_error("Minor number outside range 0-1048575");
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
static void __alloc(int size)
{
if (!(_cmdline.commands = dm_realloc(_cmdline.commands, sizeof(*_cmdline.commands) * size))) {
diff --git a/tools/tools.h b/tools/tools.h
index f92abd5..4d2f5b0 100644
--- a/tools/tools.h
+++ b/tools/tools.h
@@ -156,6 +156,8 @@ int segtype_arg(struct cmd_context *cmd, struct arg_values *av);
int alloc_arg(struct cmd_context *cmd, struct arg_values *av);
int readahead_arg(struct cmd_context *cmd, struct arg_values *av);
int metadatacopies_arg(struct cmd_context *cmd __attribute__((unused)), struct arg_values *av);
+int major_minor_valid(const struct cmd_context * cmd, const struct format_type *fmt,
+ int32_t major, int32_t minor);
/* we use the enums to access the switches */
unsigned arg_count(const struct cmd_context *cmd, int a);
11 years, 8 months
master - [lvmetad] Continue reading/writing on EINTR
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3843f54974ea7c...
Commit: 3843f54974ea7c3bbe51fcd681a55fc23f4e7736
Parent: 55c9286dea6b7d77338b4663d67337ca5a7b2b55
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Aug 2 16:40:21 2012 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Aug 2 16:50:37 2012 +0200
[lvmetad] Continue reading/writing on EINTR
---
libdaemon/client/daemon-shared.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/libdaemon/client/daemon-shared.c b/libdaemon/client/daemon-shared.c
index f90deb4..b767794 100644
--- a/libdaemon/client/daemon-shared.c
+++ b/libdaemon/client/daemon-shared.c
@@ -56,9 +56,9 @@ int read_buffer(int fd, char **buffer) {
errno = ECONNRESET;
goto fail; /* we should never encounter EOF here */
}
- if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK)
+ if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR)
goto fail;
- /* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */
+ /* TODO call select here if we encountered EAGAIN/EWOULDBLOCK/EINTR */
}
return 1;
fail:
@@ -71,7 +71,7 @@ fail:
* Write a buffer to a filedescriptor. Keep trying. Blocks (even on
* SOCK_NONBLOCK) until all of the write went through.
*
- * TODO use select on EWOULDBLOCK/EAGAIN to avoid useless spinning
+ * TODO use select on EWOULDBLOCK/EAGAIN/EINTR to avoid useless spinning
*/
int write_buffer(int fd, const char *buffer, int length) {
static const char terminate[] = "\n##\n";
@@ -82,7 +82,7 @@ write:
int result = write(fd, buffer + written, length - written);
if (result > 0)
written += result;
- if (result < 0 && errno != EWOULDBLOCK && errno != EAGAIN)
+ if (result < 0 && errno != EWOULDBLOCK && errno != EAGAIN && errno != EINTR)
return 0; /* too bad */
if (written == length) {
if (done)
11 years, 9 months
master - Remove redundant (potentially harmful) semicolon
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55c9286dea6b7d...
Commit: 55c9286dea6b7d77338b4663d67337ca5a7b2b55
Parent: 49ae67cba364e7fba0d0715c4350f28239d42a68
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Thu Aug 2 11:38:19 2012 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Aug 2 16:50:37 2012 +0200
Remove redundant (potentially harmful) semicolon
---
libdm/libdm-config.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index 8457497..2423f9b 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -77,7 +77,7 @@ static const int sep = '/';
p->tb - p->fb + 1, p->line); \
return 0;\
} \
-} while(0);
+} while(0)
static int _tok_match(const char *str, const char *b, const char *e)
{
11 years, 9 months
master - lvmetad: Skip redundant checks on no input
by Marian Csontos
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=49ae67cba364e7...
Commit: 49ae67cba364e7fba0d0715c4350f28239d42a68
Parent: 9952331d5d58a4cc2580eddec34defa9cfe141c9
Author: Marian Csontos <mcsontos(a)redhat.com>
AuthorDate: Wed Aug 1 16:06:32 2012 +0200
Committer: Marian Csontos <mcsontos(a)redhat.com>
CommitterDate: Thu Aug 2 16:50:37 2012 +0200
lvmetad: Skip redundant checks on no input
---
libdaemon/client/daemon-shared.c | 27 +++++++++++++--------------
1 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/libdaemon/client/daemon-shared.c b/libdaemon/client/daemon-shared.c
index 33ff48f..f90deb4 100644
--- a/libdaemon/client/daemon-shared.c
+++ b/libdaemon/client/daemon-shared.c
@@ -38,27 +38,26 @@ int read_buffer(int fd, char **buffer) {
while (1) {
int result = read(fd, (*buffer) + bytes, buffersize - bytes);
- if (result > 0)
+ if (result > 0) {
bytes += result;
+ if (!strncmp((*buffer) + bytes - 4, "\n##\n", 4)) {
+ *(*buffer + bytes - 4) = 0;
+ break; /* success, we have the full message now */
+ }
+ if (bytes == buffersize) {
+ buffersize += 1024;
+ if (!(new = realloc(*buffer, buffersize + 1)))
+ goto fail;
+ *buffer = new;
+ }
+ continue;
+ }
if (result == 0) {
errno = ECONNRESET;
goto fail; /* we should never encounter EOF here */
}
if (result < 0 && errno != EAGAIN && errno != EWOULDBLOCK)
goto fail;
-
- if (!strncmp((*buffer) + bytes - 4, "\n##\n", 4)) {
- *(*buffer + bytes - 4) = 0;
- break; /* success, we have the full message now */
- }
-
- if (bytes == buffersize) {
- buffersize += 1024;
- if (!(new = realloc(*buffer, buffersize + 1)))
- goto fail;
-
- *buffer = new;
- }
/* TODO call select here if we encountered EAGAIN/EWOULDBLOCK */
}
return 1;
11 years, 9 months
master - make: fix make in scripts dir for --disable-applib
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9952331d5d58a4...
Commit: 9952331d5d58a4cc2580eddec34defa9cfe141c9
Parent: 286f298bb79a43b61baab36582481df93e84137b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Aug 1 15:48:53 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Aug 1 15:48:53 2012 +0200
make: fix make in scripts dir for --disable-applib
---
scripts/Makefile.in | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/scripts/Makefile.in b/scripts/Makefile.in
index 2298f0c..df13c3d 100644
--- a/scripts/Makefile.in
+++ b/scripts/Makefile.in
@@ -15,14 +15,18 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
-SOURCES = lvm2_activation_generator_systemd_red_hat.c
-TARGETS = lvm2_activation_generator_systemd_red_hat
+ifeq ("@APPLIB@", "yes")
+ SOURCES = lvm2_activation_generator_systemd_red_hat.c
+ TARGETS = lvm2_activation_generator_systemd_red_hat
+endif
include $(top_builddir)/make.tmpl
-DEPLIBS += $(top_builddir)/liblvm/liblvm2app.so $(top_builddir)/libdm/libdevmapper.so
-LDFLAGS += -L$(top_builddir)/liblvm
-LVMLIBS = @LVM2APP_LIB@ -ldevmapper
+ifeq ("@APPLIB@", "yes")
+ DEPLIBS += $(top_builddir)/liblvm/liblvm2app.so $(top_builddir)/libdm/libdevmapper.so
+ LDFLAGS += -L$(top_builddir)/liblvm
+ LVMLIBS = @LVM2APP_LIB@ -ldevmapper
+endif
ifeq ("@DMEVENTD@", "yes")
LVMLIBS += -ldevmapper-event
@@ -76,7 +80,12 @@ lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(DEPLIBS)
install_systemd_generators:
$(INSTALL_DIR) $(systemd_generator_dir)
+ifeq ("@APPLIB@", "yes")
$(INSTALL_PROGRAM) lvm2_activation_generator_systemd_red_hat $(systemd_generator_dir)/lvm2-activation-generator
+else
+ @echo "WARNING: LVM2 activation systemd generator not installed." \
+ "It requires the LVM2 application library to be built as well."
+endif
install_systemd_units:
$(INSTALL_DIR) $(systemd_unit_dir)
11 years, 9 months