diff options
-rw-r--r-- | WHATS_NEW | 3 | ||||
-rwxr-xr-x | configure | 20 | ||||
-rw-r--r-- | configure.in | 11 | ||||
-rw-r--r-- | doc/example.conf | 7 | ||||
-rw-r--r-- | lib/commands/toolcontext.c | 4 | ||||
-rw-r--r-- | lib/commands/toolcontext.h | 1 | ||||
-rw-r--r-- | lib/config/defaults.h | 4 | ||||
-rw-r--r-- | lib/display/display.c | 9 | ||||
-rw-r--r-- | lib/misc/configure.h.in | 3 | ||||
-rw-r--r-- | lib/striped/striped.c | 9 |
10 files changed, 68 insertions, 3 deletions
@@ -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 ===================================== @@ -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 @@ -12216,6 +12219,23 @@ 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 enableval=$enable_ioctl; DM_IOCTLS=$enableval diff --git a/configure.in b/configure.in index 8a63e736..6a3f53a1 100644 --- a/configure.in +++ b/configure.in @@ -679,6 +679,17 @@ AC_ARG_ENABLE(compat, [ --enable-compat Enable support for old device 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], DM_IOCTLS=$enableval) diff --git a/doc/example.conf b/doc/example.conf index 4f57b59e..f254325f 100644 --- a/doc/example.conf +++ b/doc/example.conf @@ -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. diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c index 4c259260..2a561004 100644 --- a/lib/commands/toolcontext.c +++ b/lib/commands/toolcontext.c @@ -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; } diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h index 24f924a1..e4341a70 100644 --- a/lib/commands/toolcontext.h +++ b/lib/commands/toolcontext.h @@ -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? */ diff --git a/lib/config/defaults.h b/lib/config/defaults.h index d483492b..7ce96abc 100644 --- a/lib/config/defaults.h +++ b/lib/config/defaults.h @@ -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 diff --git a/lib/display/display.c b/lib/display/display.c index 62f30f64..6e8534a7 100644 --- a/lib/display/display.c +++ b/lib/display/display.c @@ -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)); diff --git a/lib/misc/configure.h.in b/lib/misc/configure.h.in index 6e4043ca..e5c2e675 100644 --- a/lib/misc/configure.h.in +++ b/lib/misc/configure.h.in @@ -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 diff --git a/lib/striped/striped.c b/lib/striped/striped.c index 0e1ca2d3..f187da54 100644 --- a/lib/striped/striped.c +++ b/lib/striped/striped.c @@ -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); |