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

Add global/si_unit_consistency to enable cleaned-up use of units in output.

Add configure --enable-units-compat to set si_unit_consistency off by default.

Use standard output units for 'PE Size' and 'Stripe size' in pv/lvdisplay.
This commit is contained in:
Alasdair Kergon 2009-09-28 16:23:44 +00:00
parent ec0b34a9ca
commit 95eaa68309
10 changed files with 68 additions and 3 deletions

View File

@ -1,5 +1,8 @@
Version 2.02.54 -
=====================================
Use standard output units for 'PE Size' and 'Stripe size' in pv/lvdisplay.
Add configure --enable-units-compat to set si_unit_consistency off by default.
Add global/si_unit_consistency to enable cleaned-up use of units in output.
Version 2.02.53 - 25th September 2009
=====================================

20
configure vendored
View File

@ -825,6 +825,7 @@ enable_devmapper
enable_udev_sync
enable_udev_rules
enable_compat
enable_units_compat
enable_ioctl
enable_o_direct
enable_applib
@ -1514,6 +1515,8 @@ Optional Features:
--enable-udev_sync Enable synchronisation with udev processing
--enable-udev_rules Install rule files needed for udev synchronisation
--enable-compat Enable support for old device-mapper versions
--enable-units-compat Enable output compatibility with old versions that
that don't use KiB-style unit suffixes
--disable-driver Disable calls to device-mapper in the kernel
--disable-o_direct Disable O_DIRECT
--enable-applib Build application library
@ -12215,6 +12218,23 @@ else
fi
################################################################################
# Check whether --enable-units-compat was given.
if test "${enable_units_compat+set}" = set; then
enableval=$enable_units_compat; UNITS_COMPAT=$enableval
else
UNITS_COMPAT=no
fi
if test x$UNITS_COMPAT = xyes; then
cat >>confdefs.h <<\_ACEOF
#define DEFAULT_SI_UNIT_CONSISTENCY 0
_ACEOF
fi
################################################################################
# Check whether --enable-ioctl was given.
if test "${enable_ioctl+set}" = set; then

View File

@ -678,6 +678,17 @@ dnl -- Compatibility mode
AC_ARG_ENABLE(compat, [ --enable-compat Enable support for old device-mapper versions],
DM_COMPAT=$enableval, DM_COMPAT=no)
################################################################################
dnl -- Compatible units suffix mode
AC_ARG_ENABLE(units-compat,
[ --enable-units-compat Enable output compatibility with old versions that
that don't use KiB-style unit suffixes],
UNITS_COMPAT=$enableval, UNITS_COMPAT=no)
if test x$UNITS_COMPAT = xyes; then
AC_DEFINE([DEFAULT_SI_UNIT_CONSISTENCY], 0, [Define to 0 to reinstate the pre-2.02.54 handling of unit suffixes.])
fi
################################################################################
dnl -- Disable ioctl
AC_ARG_ENABLE(ioctl, [ --disable-driver Disable calls to device-mapper in the kernel],

View File

@ -236,6 +236,13 @@ global {
# Default value for --units argument
units = "h"
# Since version 2.02.54, the tools distinguish between powers of
# 1024 bytes (e.g. KiB, MiB, GiB) and powers of 1000 bytes (e.g.
# KB, MB, GB).
# If you have scripts that depend on the old behaviour, set this to 0
# temporarily until you update them.
si_unit_consistency = 1
# Whether or not to communicate with the kernel device-mapper.
# Set to 0 if you want to use the tools to manipulate LVM metadata
# without activating any logical volumes.

View File

@ -293,6 +293,10 @@ static int _process_config(struct cmd_context *cmd)
}
}
cmd->si_unit_consistency = find_config_tree_int(cmd,
"global/si_unit_consistency",
DEFAULT_SI_UNIT_CONSISTENCY);
return 1;
}

View File

@ -70,6 +70,7 @@ struct cmd_context {
unsigned is_long_lived:1; /* Optimises persistent_filter handling */
unsigned handles_missing_pvs:1;
unsigned partial_activation:1;
unsigned si_unit_consistency:1;
struct dev_filter *filter;
int dump_filter; /* Dump filter when exiting? */

View File

@ -92,6 +92,10 @@
#define DEFAULT_SUFFIX 1
#define DEFAULT_HOSTTAGS 0
#ifndef DEFAULT_SI_UNIT_CONSISTENCY
# define DEFAULT_SI_UNIT_CONSISTENCY 1
#endif
#ifdef DEVMAPPER_SUPPORT
# define DEFAULT_ACTIVATION 1
# define DEFAULT_RESERVED_MEMORY 8192

View File

@ -344,7 +344,12 @@ void pvdisplay_full(const struct cmd_context *cmd,
/* LV count is no longer available when displaying PV
log_print("Cur LV %u", vg->lv_count);
*/
log_print("PE Size (KByte) %" PRIu32, pv->pe_size / 2);
if (cmd->si_unit_consistency)
log_print("PE Size %s", display_size(cmd, (uint64_t) pv->pe_size));
else
log_print("PE Size (KByte) %" PRIu32, pv->pe_size / 2);
log_print("Total PE %u", pv->pe_count);
log_print("Free PE %" PRIu32, pe_free);
log_print("Allocated PE %u", pv->pe_alloc_count);
@ -489,7 +494,7 @@ int lvdisplay_full(struct cmd_context *cmd,
log_print("Segments %u", dm_list_size(&lv->segments));
/********* FIXME Stripes & stripesize for each segment
log_print("Stripe size (KByte) %u", lv->stripesize / 2);
log_print("Stripe size %s", display_size(cmd, (uint64_t) lv->stripesize));
***********/
log_print("Allocation %s", get_alloc_string(lv->alloc));

View File

@ -17,6 +17,9 @@
/* Define to 1 if using `alloca.c'. */
#undef C_ALLOCA
/* Define to 0 to reinstate the pre-2.02.54 handling of unit suffixes. */
#undef DEFAULT_SI_UNIT_CONSISTENCY
/* Define to 1 to enable LVM2 device-mapper interaction. */
#undef DEVMAPPER_SUPPORT

View File

@ -40,7 +40,14 @@ static void _striped_display(const struct lv_segment *seg)
display_stripe(seg, 0, " ");
else {
log_print(" Stripes\t\t%u", seg->area_count);
log_print(" Stripe size\t\t%u KB", seg->stripe_size / 2);
if (seg->lv->vg->cmd->si_unit_consistency)
log_print(" Stripe size\t\t%s",
display_size(seg->lv->vg->cmd,
(uint64_t) seg->stripe_size));
else
log_print(" Stripe size\t\t%u KB",
seg->stripe_size / 2);
for (s = 0; s < seg->area_count; s++) {
log_print(" Stripe %d:", s);