bug-parted
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MD partition creation (for p2, p3, ...) does not create new /dev/ device


From: Jim Meyering
Subject: MD partition creation (for p2, p3, ...) does not create new /dev/ devices
Date: Thu, 24 Nov 2011 22:50:09 +0100

Hi Petr,

Thanks for pinging me about this:
http://lists.alioth.debian.org/pipermail/parted-devel/2011-September/003901.html

Your patch seems right (below), but I haven't tested it yet.
Would you please adjust it to mention this URL in the commit log:

  http://bugzilla.novell.com/567652

and add a NEWS entry?

Also, since this counts as a bug fix, I would really appreciate
a test case, but I know that's nontrivial, so it's not a requirement.
This one is particular in that just to create the MD device we'll need
two real block devices.  One could be scsi_debug, but only one.
AFAIK, there's no way to have two scsi_debug devices at a time.
Maybe the other could be a loop device?  Or both.


>From 77f1d6abdbdf42a17f331ca1d0b55d1163e390db Mon Sep 17 00:00:00 2001
From: Petr Uzel <address@hidden>
Date: Mon, 5 Sep 2011 15:16:15 +0200
Subject: [PATCH] libparted: use ext_range to find out largest possible partition

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

Signed-off-by: Petr Uzel <address@hidden>
---
 libparted/arch/linux.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index bc42750..5eb1471 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -2416,7 +2416,7 @@ _blkpg_remove_partition (PedDisk* disk, int n)

 /*
  * The number of partitions that a device can have depends on the kernel.
- * If we don't find this value in /sys/block/DEV/range, we will use our own
+ * If we don't find this value in /sys/block/DEV/ext_range, we will use our own
  * value.
  */
 static unsigned int
@@ -2427,7 +2427,7 @@ _device_get_partition_range(PedDevice* dev)
         FILE*       fp;
         bool        ok;

-        r = snprintf(path, sizeof(path), "/sys/block/%s/range",
+        r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range",
                      last_component(dev->path));
         if (r < 0 || r >= sizeof(path))
                 return MAX_NUM_PARTS;
--
1.7.3.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]