[parted-devel] [PATCH 1/2] libparted: use ext_range to find out largest possible partition

Jim Meyering jim at meyering.net
Sat Nov 26 21:22:49 UTC 2011


Petr Uzel wrote:
> Parted uses /sys/block/DEV/range file to find out how many partitions
> can the blockdevice hold and uses this number in its algorithm
> for informing the kernel about modified partitions. This works
> fine for most devices, however, it fails on partitionable MD arrays,
> because these have 1 in range file. Using ext_range should be safer
> and work for all devices.
>
> * libparted/arch/linux.c (_device_get_partition_range): Use
> /sys/block/DEV/ext_range instead of range sysfs file
> * NEWS: Mention the change.
>
> Addresses: http://bugzilla.novell.com/567652
> Signed-off-by: Petr Uzel <petr.uzel at suse.cz>
> ---
>  NEWS                   |    4 ++++
>  libparted/arch/linux.c |    4 ++--
>  2 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/NEWS b/NEWS
> index 566484c..7797e4f 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -38,6 +38,10 @@ GNU parted NEWS                                    -*- outline -*-
>    with an HFS or HFS+ signature, but with invalid ->total_blocks and/or
>    ->block_size values.
>
> +  parted now uses ext_range device sysfs attribute to determine maximum number
> +  of partitions the device can hold. With this change, parted now now correctly
> +  informs kernel about new partitions on partitionable MD RAID devices.
> +
>  ** Changes in behavior
>
>    parted: mkpart command has changed semantics with regard to specifying end
> diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
...

Thank you.
I'll push that soon, with this correction:

diff --git a/NEWS b/NEWS
index 7797e4f..5d8df35 100644
--- a/NEWS
+++ b/NEWS
@@ -39,7 +39,7 @@ GNU parted NEWS                                    -*- outline -*-
   ->block_size values.

   parted now uses ext_range device sysfs attribute to determine maximum number
-  of partitions the device can hold. With this change, parted now now correctly
+  of partitions the device can hold.  With this change, parted now correctly
   informs kernel about new partitions on partitionable MD RAID devices.

 ** Changes in behavior
--
1.7.8.rc3.31.g017d1


Oh, and I've removed your Signed-off-by: lines.
They are needless clutter when you're the author.
If you have that enabled globally, please turn it off for parted,
e.g., by running this in your clone(s):

  git config format.signoff false



More information about the parted-devel mailing list