master - device: add physical block size info and make sure VG extent size >= PV's phys. block size
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=32080c4ff748e4afbeacf9dbc4a98bfea658a392 Commit: 32080c4ff748e4afbeacf9dbc4a98bfea658a392 Parent: 3eed0aa7dca9c1895bbf80e1585debf9bddac5a8 Author: Peter Rajnoha <[email protected]> AuthorDate: Thu Dec 12 11:26:35 2013 +0100 Committer: Peter Rajnoha <[email protected]> CommitterDate: Thu Dec 12 15:02:36 2013 +0100
device: add physical block size info and make sure VG extent size >= PV's phys. block size
--- WHATS_NEW | 1 + lib/device/dev-cache.c | 1 + lib/device/dev-io.c | 65 +++++++++++++++++--------------------- lib/device/device.h | 3 +- lib/metadata/metadata-exported.h | 1 + lib/metadata/metadata.c | 56 +++++++++++++++++++++++++++++--- lib/metadata/metadata.h | 3 ++ man/vgchange.8.in | 6 ++- man/vgcreate.8.in | 6 ++- tools/vgchange.c | 6 +++ 10 files changed, 101 insertions(+), 47 deletions(-)
WHATS_NEW +1 -0
@@ -1,5 +1,6 @@ Version 2.02.105 - ===================================== + Make sure VG extent size is always greater or equal to PV phys. block size. Optimize double call of stat() for cached devices. Enable support for thin provisioning for default configuration. Improve process_each_lv_in_vg() tag processing.
lib/device/dev-cache.c +1 -0
@@ -56,6 +56,7 @@ static int _insert(const char *path, const struct stat *info,/* Setup non-zero members of passed zeroed 'struct device' */ static void _dev_init (struct device *dev,int max_error_count) { + dev->phys_block_size =-1 ; dev->block_size =-1 ; dev->fd =-1 ; dev->read_ahead =-1 ;
lib/device/dev-io.c +29 -36
107 lines not on this page · raw message
lib/device/device.h +2 -1
@@ -42,6 +42,7 @@ struct device {int open_count;int error_count;int max_error_count; +int phys_block_size;int block_size;int read_ahead;uint32_t flags;
@@ -66,8 +67,8 @@ struct device_area {/* * All io should use these routines. */ +int dev_get_block_size (struct device *dev,unsigned int *phys_block_size,unsigned int *block_size);int dev_get_size (const struct device *dev,uint64_t *size); -int dev_get_sectsize (struct device *dev,uint32_t *size);int dev_get_read_ahead (struct device *dev,uint32_t *read_ahead);int dev_discard_blocks (struct device *dev,uint64_t offset_bytes,uint64_t size_bytes);
lib/metadata/metadata-exported.h +1 -0
@@ -903,6 +903,7 @@ int vg_remove_snapshot(struct logical_volume *cow);int vg_check_status (const struct volume_group *vg,uint64_t status); +int vg_check_pv_dev_block_sizes (const struct volume_group *vg);/* * Check if the VG reached maximal LVs count (if set)
lib/metadata/metadata.c +50 -6
90 lines not on this page · raw message
lib/metadata/metadata.h +3 -0
@@ -347,6 +347,9 @@ int pvremove_single(struct cmd_context *cmd, const char *pv_name,struct physical_volume *pvcreate_vol (struct cmd_context *cmd,const char *pv_name,struct pvcreate_params *pp,int write_now); +int check_dev_block_size_for_vg (struct device *dev,const struct volume_group *vg, +unsigned int *max_phys_block_size_found); +/* Manipulate PV structures */ int pv_add (struct volume_group *vg,struct physical_volume *pv);int pv_remove (struct volume_group *vg,struct physical_volume *pv);
man/vgchange.8.in +4 -2
@@ -183,8 +183,10 @@ minimize metadata read and write overhead. .BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize [ \fIBbBsSkKmMgGtTpPeE ] Changes the physical extent size on physical volumes of this volume group. A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes -is the default if no suffix is present. -The default is 4 MiB and it must be at least 1 KiB and a power of 2. +is the default if no suffix is present. The value must be at least 1 sector +for LVM2 format (where the sector size is the largest sector size of the +PVs currently used in the VG) or 8KiB for LVM1 format and it must be a +power of 2. The default is 4 MiB. Before increasing the physical extent size, you might need to use lvresize, pvresize and/or pvmove so that everything fits. For example, every
man/vgcreate.8.in +4 -2
@@ -94,8 +94,10 @@ The default value is \fIunmanaged\fP. .BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize [ \fIbBsSkKmMgGtTpPeE ] Sets the physical extent size on physical volumes of this volume group. A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes -is the default if no suffix is present. -The default is 4 MiB and it must be at least 1 KiB and a power of 2. +is the default if no suffix is present. The value must be at least 1 sector +for LVM2 format (where the sector size is the largest sector size of the +PVs currently used in the VG) or 8KiB for LVM1 format and it must be a +power of 2. The default is 4 MiB. Once this value has been set, it is difficult to change it without recreating the volume group which would involve backing up and restoring data on any
tools/vgchange.c +6 -0
@@ -368,6 +368,12 @@ static int _vgchange_pesize(struct cmd_context *cmd, struct volume_group *vg)if (!vg_set_extent_size (vg, extent_size)) return_0; +if (!vg_check_pv_dev_block_sizes (vg)) { +log_error ("Failed to change physical extent size for VG %s." , + vg->name); +return 0 ; + } +return 1 ; }