* [PATCH 000 of 6] md: Introduction
@ 2006-09-29 2:52 NeilBrown
2006-09-29 2:52 ` [PATCH 001 of 6] md: Fix duplicity of levels in md.txt NeilBrown
` (5 more replies)
0 siblings, 6 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
Following are 6 bug fixes and minor improvements for md.
Patches are against 2.6.18-mm2 and are all suitable for
immediate inclusion in 2.6.19.
Thanks,
NeilBrown
[PATCH 001 of 6] md: Fix duplicity of levels in md.txt
[PATCH 002 of 6] md: Remove MAX_MD_DEVS which is an arbitrary limit.
[PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape.
[PATCH 004 of 6] md: Use ffz instead of find_first_set to convert multiplier to shift.
[PATCH 005 of 6] md: Allow SET_BITMAP_FILE to work on 64bit kernel with 32bit userspace.
[PATCH 006 of 6] md: Add error reporting to superblock write failure
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 001 of 6] md: Fix duplicity of levels in md.txt
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
@ 2006-09-29 2:52 ` NeilBrown
2006-09-29 2:52 ` [PATCH 002 of 6] md: Remove MAX_MD_DEVS which is an arbitrary limit NeilBrown
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel, Christian Kujau
md.txt has two sections describing the 'level'
sysfs attribute, and some of the text is out-of-date.
So make just one section, and make it right.
Cc: Christian Kujau <evil@g-house.de>
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./Documentation/md.txt | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff .prev/Documentation/md.txt ./Documentation/md.txt
--- .prev/Documentation/md.txt 2006-09-29 11:44:38.000000000 +1000
+++ ./Documentation/md.txt 2006-09-29 11:48:54.000000000 +1000
@@ -154,11 +154,12 @@ contains further md-specific information
All md devices contain:
level
- a text file indicating the 'raid level'. This may be a standard
- numerical level prefixed by "RAID-" - e.g. "RAID-5", or some
- other name such as "linear" or "multipath".
+ a text file indicating the 'raid level'. e.g. raid0, raid1,
+ raid5, linear, multipath, faulty.
If no raid level has been set yet (array is still being
- assembled), this file will be empty.
+ assembled), the value will reflect whatever has been written
+ to it, which may be a name like the above, or may be a number
+ such as '0', '5', etc.
raid_disks
a text file with a simple number indicating the number of devices
@@ -192,14 +193,6 @@ All md devices contain:
1.2 (newer format in varying locations) or "none" indicating that
the kernel isn't managing metadata at all.
- level
- The raid 'level' for this array. The name will often (but not
- always) be the same as the name of the module that implements the
- level. To be auto-loaded the module must have an alias
- md-$LEVEL e.g. md-raid5
- This can be written only while the array is being assembled, not
- after it is started.
-
layout
The "layout" for the array for the particular level. This is
simply a number that is interpretted differently by different
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 002 of 6] md: Remove MAX_MD_DEVS which is an arbitrary limit.
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
2006-09-29 2:52 ` [PATCH 001 of 6] md: Fix duplicity of levels in md.txt NeilBrown
@ 2006-09-29 2:52 ` NeilBrown
2006-09-29 2:53 ` [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape NeilBrown
` (3 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:52 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
Once upon a time we needed to fixed limit to the number of md
devices, probably because we preallocated some array.
This need no longer exists, but we still have an arbitrary limit.
So remove MAX_MD_DEVS and allow as many devices as we can fit into the
'minor' part of a device number.
Also remove some useless noise at init time (which reports
MAX_MD_DEVS) and remove MD_THREAD_NAME_MAX which hasn't been used for
a while.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/md.c | 33 +++++++++++++++------------------
./include/linux/raid/md_k.h | 5 +----
./init/do_mounts_md.c | 8 ++------
3 files changed, 18 insertions(+), 28 deletions(-)
diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c 2006-09-29 11:44:38.000000000 +1000
+++ ./drivers/md/md.c 2006-09-29 11:49:00.000000000 +1000
@@ -3409,6 +3409,7 @@ static void autorun_devices(int part)
printk(KERN_INFO "md: autorun ...\n");
while (!list_empty(&pending_raid_disks)) {
+ int unit;
dev_t dev;
LIST_HEAD(candidates);
rdev0 = list_entry(pending_raid_disks.next,
@@ -3428,16 +3429,19 @@ static void autorun_devices(int part)
* mostly sane superblocks. It's time to allocate the
* mddev.
*/
- if (rdev0->preferred_minor < 0 || rdev0->preferred_minor >= MAX_MD_DEVS) {
+ if (part) {
+ dev = MKDEV(mdp_major,
+ rdev0->preferred_minor << MdpMinorShift);
+ unit = MINOR(dev) >> MdpMinorShift;
+ } else {
+ dev = MKDEV(MD_MAJOR, rdev0->preferred_minor);
+ unit = MINOR(dev);
+ }
+ if (rdev0->preferred_minor != unit) {
printk(KERN_INFO "md: unit number in %s is bad: %d\n",
bdevname(rdev0->bdev, b), rdev0->preferred_minor);
break;
}
- if (part)
- dev = MKDEV(mdp_major,
- rdev0->preferred_minor << MdpMinorShift);
- else
- dev = MKDEV(MD_MAJOR, rdev0->preferred_minor);
md_probe(dev, NULL, NULL);
mddev = mddev_find(dev);
@@ -5524,22 +5528,15 @@ static void md_geninit(void)
static int __init md_init(void)
{
- printk(KERN_INFO "md: md driver %d.%d.%d MAX_MD_DEVS=%d,"
- " MD_SB_DISKS=%d\n",
- MD_MAJOR_VERSION, MD_MINOR_VERSION,
- MD_PATCHLEVEL_VERSION, MAX_MD_DEVS, MD_SB_DISKS);
- printk(KERN_INFO "md: bitmap version %d.%d\n", BITMAP_MAJOR_HI,
- BITMAP_MINOR);
-
if (register_blkdev(MAJOR_NR, "md"))
return -1;
if ((mdp_major=register_blkdev(0, "mdp"))<=0) {
unregister_blkdev(MAJOR_NR, "md");
return -1;
}
- blk_register_region(MKDEV(MAJOR_NR, 0), MAX_MD_DEVS, THIS_MODULE,
- md_probe, NULL, NULL);
- blk_register_region(MKDEV(mdp_major, 0), MAX_MD_DEVS<<MdpMinorShift, THIS_MODULE,
+ blk_register_region(MKDEV(MAJOR_NR, 0), 1UL<<MINORBITS, THIS_MODULE,
+ md_probe, NULL, NULL);
+ blk_register_region(MKDEV(mdp_major, 0), 1UL<<MINORBITS, THIS_MODULE,
md_probe, NULL, NULL);
register_reboot_notifier(&md_notifier);
@@ -5598,8 +5595,8 @@ static __exit void md_exit(void)
mddev_t *mddev;
struct list_head *tmp;
- blk_unregister_region(MKDEV(MAJOR_NR,0), MAX_MD_DEVS);
- blk_unregister_region(MKDEV(mdp_major,0), MAX_MD_DEVS << MdpMinorShift);
+ blk_unregister_region(MKDEV(MAJOR_NR,0), 1U << MINORBITS);
+ blk_unregister_region(MKDEV(mdp_major,0), 1U << MINORBITS);
unregister_blkdev(MAJOR_NR,"md");
unregister_blkdev(mdp_major, "mdp");
diff .prev/include/linux/raid/md_k.h ./include/linux/raid/md_k.h
--- .prev/include/linux/raid/md_k.h 2006-09-29 11:44:34.000000000 +1000
+++ ./include/linux/raid/md_k.h 2006-09-29 11:49:00.000000000 +1000
@@ -31,18 +31,15 @@
#define LEVEL_NONE (-1000000)
#define MaxSector (~(sector_t)0)
-#define MD_THREAD_NAME_MAX 14
typedef struct mddev_s mddev_t;
typedef struct mdk_rdev_s mdk_rdev_t;
-#define MAX_MD_DEVS 256 /* Max number of md dev */
-
/*
* options passed in raidrun:
*/
-/* Currently this must fix in an 'int' */
+/* Currently this must fit in an 'int' */
#define MAX_CHUNK_SIZE (1<<30)
/*
diff .prev/init/do_mounts_md.c ./init/do_mounts_md.c
--- .prev/init/do_mounts_md.c 2006-09-29 11:38:46.000000000 +1000
+++ ./init/do_mounts_md.c 2006-09-29 11:49:00.000000000 +1000
@@ -20,7 +20,7 @@ static struct {
int level;
int chunk;
char *device_names;
-} md_setup_args[MAX_MD_DEVS] __initdata;
+} md_setup_args[256] __initdata;
static int md_setup_ents __initdata;
@@ -61,10 +61,6 @@ static int __init md_setup(char *str)
return 0;
}
str1 = str;
- if (minor >= MAX_MD_DEVS) {
- printk(KERN_WARNING "md: md=%d, Minor device number too high.\n", minor);
- return 0;
- }
for (ent=0 ; ent< md_setup_ents ; ent++)
if (md_setup_args[ent].minor == minor &&
md_setup_args[ent].partitioned == partitioned) {
@@ -72,7 +68,7 @@ static int __init md_setup(char *str)
"Replacing previous definition.\n", partitioned?"d":"", minor);
break;
}
- if (ent >= MAX_MD_DEVS) {
+ if (ent >= ARRAY_SIZE(md_setup_args)) {
printk(KERN_WARNING "md: md=%s%d - too many md initialisations\n", partitioned?"d":"", minor);
return 0;
}
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape.
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
2006-09-29 2:52 ` [PATCH 001 of 6] md: Fix duplicity of levels in md.txt NeilBrown
2006-09-29 2:52 ` [PATCH 002 of 6] md: Remove MAX_MD_DEVS which is an arbitrary limit NeilBrown
@ 2006-09-29 2:53 ` NeilBrown
2006-09-29 4:24 ` Jeff Breidenbach
2006-10-02 8:07 ` David Greaves
2006-09-29 2:53 ` [PATCH 004 of 6] md: Use ffz instead of find_first_set to convert multiplier to shift NeilBrown
` (2 subsequent siblings)
5 siblings, 2 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
I have had enough success reports not to believe that this
is safe for 2.6.19.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/Kconfig | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff .prev/drivers/md/Kconfig ./drivers/md/Kconfig
--- .prev/drivers/md/Kconfig 2006-09-29 11:38:03.000000000 +1000
+++ ./drivers/md/Kconfig 2006-09-29 11:49:16.000000000 +1000
@@ -138,16 +138,16 @@ config MD_RAID456
If unsure, say Y.
config MD_RAID5_RESHAPE
- bool "Support adding drives to a raid-5 array (experimental)"
- depends on MD_RAID456 && EXPERIMENTAL
+ bool "Support adding drives to a raid-5 array"
+ depends on MD_RAID456
+ default y
---help---
A RAID-5 set can be expanded by adding extra drives. This
requires "restriping" the array which means (almost) every
block must be written to a different place.
This option allows such restriping to be done while the array
- is online. However it is still EXPERIMENTAL code. It should
- work, but please be sure that you have backups.
+ is online.
You will need mdadm version 2.4.1 or later to use this
feature safely. During the early stage of reshape there is
@@ -164,6 +164,8 @@ config MD_RAID5_RESHAPE
There should be enough spares already present to make the new
array workable.
+ In unsure, say Y.
+
config MD_MULTIPATH
tristate "Multipath I/O support"
depends on BLK_DEV_MD
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 004 of 6] md: Use ffz instead of find_first_set to convert multiplier to shift.
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
` (2 preceding siblings ...)
2006-09-29 2:53 ` [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape NeilBrown
@ 2006-09-29 2:53 ` NeilBrown
2006-09-29 2:53 ` [PATCH 005 of 6] md: Allow SET_BITMAP_FILE to work on 64bit kernel with 32bit userspace NeilBrown
2006-09-29 2:53 ` [PATCH 006 of 6] md: Add error reporting to superblock write failure NeilBrown
5 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
From: Paul Clements <paul.clements@steeleye.com>
find_first_set doesn't find the least-significant bit on bigendian
machines, so it is really wrong to use it.
ffs is closer, but takes an 'int' and we have a 'unsigned long'.
So use ffz(~X) to convert a chunksize into a chunkshift.
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/bitmap.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff .prev/drivers/md/bitmap.c ./drivers/md/bitmap.c
--- .prev/drivers/md/bitmap.c 2006-09-29 11:44:38.000000000 +1000
+++ ./drivers/md/bitmap.c 2006-09-29 11:49:40.000000000 +1000
@@ -1444,8 +1444,7 @@ int bitmap_create(mddev_t *mddev)
if (err)
goto error;
- bitmap->chunkshift = find_first_bit(&bitmap->chunksize,
- sizeof(bitmap->chunksize));
+ bitmap->chunkshift = ffz(~bitmap->chunksize);
/* now that chunksize and chunkshift are set, we can use these macros */
chunks = (blocks + CHUNK_BLOCK_RATIO(bitmap) - 1) /
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 005 of 6] md: Allow SET_BITMAP_FILE to work on 64bit kernel with 32bit userspace.
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
` (3 preceding siblings ...)
2006-09-29 2:53 ` [PATCH 004 of 6] md: Use ffz instead of find_first_set to convert multiplier to shift NeilBrown
@ 2006-09-29 2:53 ` NeilBrown
2006-09-29 2:53 ` [PATCH 006 of 6] md: Add error reporting to superblock write failure NeilBrown
5 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
From: Paul Clements <paul.clements@steeleye.com>
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./include/linux/compat_ioctl.h | 1 +
1 file changed, 1 insertion(+)
diff .prev/include/linux/compat_ioctl.h ./include/linux/compat_ioctl.h
--- .prev/include/linux/compat_ioctl.h 2006-09-29 11:49:49.000000000 +1000
+++ ./include/linux/compat_ioctl.h 2006-09-29 11:49:49.000000000 +1000
@@ -125,6 +125,7 @@ COMPATIBLE_IOCTL(RUN_ARRAY)
COMPATIBLE_IOCTL(STOP_ARRAY)
COMPATIBLE_IOCTL(STOP_ARRAY_RO)
COMPATIBLE_IOCTL(RESTART_ARRAY_RW)
+ULONG_IOCTL(SET_BITMAP_FILE)
/* DM */
COMPATIBLE_IOCTL(DM_VERSION_32)
COMPATIBLE_IOCTL(DM_REMOVE_ALL_32)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 006 of 6] md: Add error reporting to superblock write failure
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
` (4 preceding siblings ...)
2006-09-29 2:53 ` [PATCH 005 of 6] md: Allow SET_BITMAP_FILE to work on 64bit kernel with 32bit userspace NeilBrown
@ 2006-09-29 2:53 ` NeilBrown
5 siblings, 0 replies; 9+ messages in thread
From: NeilBrown @ 2006-09-29 2:53 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-raid, linux-kernel
Signed-off-by: Neil Brown <neilb@suse.de>
### Diffstat output
./drivers/md/md.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c 2006-09-29 11:49:00.000000000 +1000
+++ ./drivers/md/md.c 2006-09-29 11:51:39.000000000 +1000
@@ -389,8 +389,12 @@ static int super_written(struct bio *bio
if (bio->bi_size)
return 1;
- if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags))
+ if (error || !test_bit(BIO_UPTODATE, &bio->bi_flags)) {
+ printk("md: super_written gets error=%d, uptodate=%d\n",
+ error, test_bit(BIO_UPTODATE, &bio->bi_flags));
+ WARN_ON(test_bit(BIO_UPTODATE, &bio->bi_flags));
md_error(mddev, rdev);
+ }
if (atomic_dec_and_test(&mddev->pending_writes))
wake_up(&mddev->sb_wait);
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape.
2006-09-29 2:53 ` [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape NeilBrown
@ 2006-09-29 4:24 ` Jeff Breidenbach
2006-10-02 8:07 ` David Greaves
1 sibling, 0 replies; 9+ messages in thread
From: Jeff Breidenbach @ 2006-09-29 4:24 UTC (permalink / raw)
To: NeilBrown, Andrew Morton; +Cc: linux-raid, linux-kernel
Typo in last line of this patch.
> + In unsure, say Y.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape.
2006-09-29 2:53 ` [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape NeilBrown
2006-09-29 4:24 ` Jeff Breidenbach
@ 2006-10-02 8:07 ` David Greaves
1 sibling, 0 replies; 9+ messages in thread
From: David Greaves @ 2006-10-02 8:07 UTC (permalink / raw)
To: NeilBrown; +Cc: Andrew Morton, linux-raid, linux-kernel
Typo in first line of this patch :)
> I have had enough success reports not^H^H^H to believe that this
> is safe for 2.6.19.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-10-02 8:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-29 2:52 [PATCH 000 of 6] md: Introduction NeilBrown
2006-09-29 2:52 ` [PATCH 001 of 6] md: Fix duplicity of levels in md.txt NeilBrown
2006-09-29 2:52 ` [PATCH 002 of 6] md: Remove MAX_MD_DEVS which is an arbitrary limit NeilBrown
2006-09-29 2:53 ` [PATCH 003 of 6] md: Remove 'experimental' classification from raid5 reshape NeilBrown
2006-09-29 4:24 ` Jeff Breidenbach
2006-10-02 8:07 ` David Greaves
2006-09-29 2:53 ` [PATCH 004 of 6] md: Use ffz instead of find_first_set to convert multiplier to shift NeilBrown
2006-09-29 2:53 ` [PATCH 005 of 6] md: Allow SET_BITMAP_FILE to work on 64bit kernel with 32bit userspace NeilBrown
2006-09-29 2:53 ` [PATCH 006 of 6] md: Add error reporting to superblock write failure NeilBrown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).