forked from Minki/linux
Some fixes for md in 3.7
- one recently introduced crash for dm-raid10 with discard - one bug in new functionality that has been around for a few releases. - minor bug in md's 'faulty' personality and UAPI disintegration for md. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.18 (GNU/Linux) iQIVAwUAUJB3rDnsnt1WYoG5AQLuAw/8C2I1LNHRc9zccO4akAg9AyYcpoNGcY6I PG1SR7sQiKuQYNTwc7xqqYJ241r3U+Ablh8nurr0rbCmYX8rcnjwTZzhH6h0ER5Q M31i7CKb2OY7VGKjs1FtlVnRtdRWVkLHHappEaT0NzjHUqpCDGZYcLMoSaLaCNdE 8P8GlAI+w8kachkWRnp1a4pdR7Kc1SnP97aZJ304EDy63gYwcsOg+m8zZj5h74u9 gJpVES1yqflN12CHIkK3K22QM9a1KbP9L9TKQSsevmOe4ju/ID3IlTKjKJvvYoUS r9FJIJsGbzOREr1iap4hr81+rrH56t4o1FxgWCuj2wpw7EWelMFrTH0iMNNaxjyk z+g7ZElnSjkOYxQXirKcWTJ+F5F4jEc48XlFNjtuvHz771xby3Q5dTN/+hMCQ9k1 JNML2A9QquK0jLZauRIsbBpVy2uC+vOoJ2BX2kcMOvuHUeCzK78x4HZjZi7mP6Dg O9E4+ocGnFZsqnCPtBAxv9G8RE36Efp3uxms9HlwY6TeTGJWyZuiWDyNea2tRLct OARMseYVxkup7DOnHirtb9Pywc3kkLqtXcWbZH68Hi5uHMrGFUO2ZhSwjfsC5+rZ Nyt1lcRLZaxy/JFgHXzOeLqA2o/nY62OiMEgP+ENbASNJ4HKf685ytzmg2BVetsY 9E/KUQBEJqY= =plEs -----END PGP SIGNATURE----- Merge tag 'md-3.7-fixes' of git://neil.brown.name/md Pull md fixes from NeilBrown: "Some fixes for md in 3.7 - one recently introduced crash for dm-raid10 with discard - one bug in new functionality that has been around for a few releases. - minor bug in md's 'faulty' personality and UAPI disintegration for md." * tag 'md-3.7-fixes' of git://neil.brown.name/md: MD RAID10: Fix oops when creating RAID10 arrays via dm-raid.c md/raid1: Fix assembling of arrays containing Replacements. md faulty: use disk_stack_limits() UAPI: (Scripted) Disintegrate include/linux/raid
This commit is contained in:
commit
2df4f26167
@ -315,8 +315,11 @@ static int run(struct mddev *mddev)
|
|||||||
}
|
}
|
||||||
conf->nfaults = 0;
|
conf->nfaults = 0;
|
||||||
|
|
||||||
rdev_for_each(rdev, mddev)
|
rdev_for_each(rdev, mddev) {
|
||||||
conf->rdev = rdev;
|
conf->rdev = rdev;
|
||||||
|
disk_stack_limits(mddev->gendisk, rdev->bdev,
|
||||||
|
rdev->data_offset << 9);
|
||||||
|
}
|
||||||
|
|
||||||
md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
|
md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
|
||||||
mddev->private = conf;
|
mddev->private = conf;
|
||||||
|
@ -2710,7 +2710,7 @@ static struct r1conf *setup_conf(struct mddev *mddev)
|
|||||||
|| disk_idx < 0)
|
|| disk_idx < 0)
|
||||||
continue;
|
continue;
|
||||||
if (test_bit(Replacement, &rdev->flags))
|
if (test_bit(Replacement, &rdev->flags))
|
||||||
disk = conf->mirrors + conf->raid_disks + disk_idx;
|
disk = conf->mirrors + mddev->raid_disks + disk_idx;
|
||||||
else
|
else
|
||||||
disk = conf->mirrors + disk_idx;
|
disk = conf->mirrors + disk_idx;
|
||||||
|
|
||||||
|
@ -1783,7 +1783,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev)
|
|||||||
clear_bit(Unmerged, &rdev->flags);
|
clear_bit(Unmerged, &rdev->flags);
|
||||||
}
|
}
|
||||||
md_integrity_add_rdev(rdev, mddev);
|
md_integrity_add_rdev(rdev, mddev);
|
||||||
if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
|
if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev)))
|
||||||
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
|
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
|
||||||
|
|
||||||
print_conf(conf);
|
print_conf(conf);
|
||||||
@ -3613,11 +3613,14 @@ static int run(struct mddev *mddev)
|
|||||||
discard_supported = true;
|
discard_supported = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (discard_supported)
|
if (mddev->queue) {
|
||||||
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
|
if (discard_supported)
|
||||||
else
|
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
|
||||||
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
|
mddev->queue);
|
||||||
|
else
|
||||||
|
queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD,
|
||||||
|
mddev->queue);
|
||||||
|
}
|
||||||
/* need to check that every block has at least one working mirror */
|
/* need to check that every block has at least one working mirror */
|
||||||
if (!enough(conf, -1)) {
|
if (!enough(conf, -1)) {
|
||||||
printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n",
|
printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n",
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
header-y += md_p.h
|
|
||||||
header-y += md_u.h
|
|
@ -11,149 +11,10 @@
|
|||||||
(for example /usr/src/linux/COPYING); if not, write to the Free
|
(for example /usr/src/linux/COPYING); if not, write to the Free
|
||||||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _MD_U_H
|
#ifndef _MD_U_H
|
||||||
#define _MD_U_H
|
#define _MD_U_H
|
||||||
|
|
||||||
/*
|
#include <uapi/linux/raid/md_u.h>
|
||||||
* Different major versions are not compatible.
|
|
||||||
* Different minor versions are only downward compatible.
|
|
||||||
* Different patchlevel versions are downward and upward compatible.
|
|
||||||
*/
|
|
||||||
#define MD_MAJOR_VERSION 0
|
|
||||||
#define MD_MINOR_VERSION 90
|
|
||||||
/*
|
|
||||||
* MD_PATCHLEVEL_VERSION indicates kernel functionality.
|
|
||||||
* >=1 means different superblock formats are selectable using SET_ARRAY_INFO
|
|
||||||
* and major_version/minor_version accordingly
|
|
||||||
* >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
|
|
||||||
* in the super status byte
|
|
||||||
* >=3 means that bitmap superblock version 4 is supported, which uses
|
|
||||||
* little-ending representation rather than host-endian
|
|
||||||
*/
|
|
||||||
#define MD_PATCHLEVEL_VERSION 3
|
|
||||||
|
|
||||||
/* ioctls */
|
|
||||||
|
|
||||||
/* status */
|
|
||||||
#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
|
|
||||||
#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
|
|
||||||
#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
|
|
||||||
#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
|
|
||||||
#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
|
|
||||||
#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
|
|
||||||
|
|
||||||
/* configuration */
|
|
||||||
#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
|
|
||||||
#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
|
|
||||||
#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
|
|
||||||
#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
|
|
||||||
#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
|
|
||||||
#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
|
|
||||||
#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
|
|
||||||
#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
|
|
||||||
#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
|
|
||||||
#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
|
|
||||||
#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
|
|
||||||
#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
|
|
||||||
|
|
||||||
/* usage */
|
|
||||||
#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
|
|
||||||
/* 0x31 was START_ARRAY */
|
|
||||||
#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
|
|
||||||
#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
|
|
||||||
#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
|
|
||||||
|
|
||||||
/* 63 partitions with the alternate major number (mdp) */
|
|
||||||
#define MdpMinorShift 6
|
|
||||||
#ifdef __KERNEL__
|
|
||||||
extern int mdp_major;
|
extern int mdp_major;
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct mdu_version_s {
|
|
||||||
int major;
|
|
||||||
int minor;
|
|
||||||
int patchlevel;
|
|
||||||
} mdu_version_t;
|
|
||||||
|
|
||||||
typedef struct mdu_array_info_s {
|
|
||||||
/*
|
|
||||||
* Generic constant information
|
|
||||||
*/
|
|
||||||
int major_version;
|
|
||||||
int minor_version;
|
|
||||||
int patch_version;
|
|
||||||
int ctime;
|
|
||||||
int level;
|
|
||||||
int size;
|
|
||||||
int nr_disks;
|
|
||||||
int raid_disks;
|
|
||||||
int md_minor;
|
|
||||||
int not_persistent;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Generic state information
|
|
||||||
*/
|
|
||||||
int utime; /* 0 Superblock update time */
|
|
||||||
int state; /* 1 State bits (clean, ...) */
|
|
||||||
int active_disks; /* 2 Number of currently active disks */
|
|
||||||
int working_disks; /* 3 Number of working disks */
|
|
||||||
int failed_disks; /* 4 Number of failed disks */
|
|
||||||
int spare_disks; /* 5 Number of spare disks */
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Personality information
|
|
||||||
*/
|
|
||||||
int layout; /* 0 the array's physical layout */
|
|
||||||
int chunk_size; /* 1 chunk size in bytes */
|
|
||||||
|
|
||||||
} mdu_array_info_t;
|
|
||||||
|
|
||||||
/* non-obvious values for 'level' */
|
|
||||||
#define LEVEL_MULTIPATH (-4)
|
|
||||||
#define LEVEL_LINEAR (-1)
|
|
||||||
#define LEVEL_FAULTY (-5)
|
|
||||||
|
|
||||||
/* we need a value for 'no level specified' and 0
|
|
||||||
* means 'raid0', so we need something else. This is
|
|
||||||
* for internal use only
|
|
||||||
*/
|
|
||||||
#define LEVEL_NONE (-1000000)
|
|
||||||
|
|
||||||
typedef struct mdu_disk_info_s {
|
|
||||||
/*
|
|
||||||
* configuration/status of one particular disk
|
|
||||||
*/
|
|
||||||
int number;
|
|
||||||
int major;
|
|
||||||
int minor;
|
|
||||||
int raid_disk;
|
|
||||||
int state;
|
|
||||||
|
|
||||||
} mdu_disk_info_t;
|
|
||||||
|
|
||||||
typedef struct mdu_start_info_s {
|
|
||||||
/*
|
|
||||||
* configuration/status of one particular disk
|
|
||||||
*/
|
|
||||||
int major;
|
|
||||||
int minor;
|
|
||||||
int raid_disk;
|
|
||||||
int state;
|
|
||||||
|
|
||||||
} mdu_start_info_t;
|
|
||||||
|
|
||||||
typedef struct mdu_bitmap_file_s
|
|
||||||
{
|
|
||||||
char pathname[4096];
|
|
||||||
} mdu_bitmap_file_t;
|
|
||||||
|
|
||||||
typedef struct mdu_param_s
|
|
||||||
{
|
|
||||||
int personality; /* 1,2,3,4 */
|
|
||||||
int chunk_size; /* in bytes */
|
|
||||||
int max_fault; /* unused for now */
|
|
||||||
} mdu_param_t;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1 +1,3 @@
|
|||||||
# UAPI Header export list
|
# UAPI Header export list
|
||||||
|
header-y += md_p.h
|
||||||
|
header-y += md_u.h
|
||||||
|
155
include/uapi/linux/raid/md_u.h
Normal file
155
include/uapi/linux/raid/md_u.h
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/*
|
||||||
|
md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
|
||||||
|
Copyright (C) 1998 Ingo Molnar
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
(for example /usr/src/linux/COPYING); if not, write to the Free
|
||||||
|
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _UAPI_MD_U_H
|
||||||
|
#define _UAPI_MD_U_H
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Different major versions are not compatible.
|
||||||
|
* Different minor versions are only downward compatible.
|
||||||
|
* Different patchlevel versions are downward and upward compatible.
|
||||||
|
*/
|
||||||
|
#define MD_MAJOR_VERSION 0
|
||||||
|
#define MD_MINOR_VERSION 90
|
||||||
|
/*
|
||||||
|
* MD_PATCHLEVEL_VERSION indicates kernel functionality.
|
||||||
|
* >=1 means different superblock formats are selectable using SET_ARRAY_INFO
|
||||||
|
* and major_version/minor_version accordingly
|
||||||
|
* >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
|
||||||
|
* in the super status byte
|
||||||
|
* >=3 means that bitmap superblock version 4 is supported, which uses
|
||||||
|
* little-ending representation rather than host-endian
|
||||||
|
*/
|
||||||
|
#define MD_PATCHLEVEL_VERSION 3
|
||||||
|
|
||||||
|
/* ioctls */
|
||||||
|
|
||||||
|
/* status */
|
||||||
|
#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
|
||||||
|
#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
|
||||||
|
#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
|
||||||
|
#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
|
||||||
|
#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
|
||||||
|
#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
|
||||||
|
|
||||||
|
/* configuration */
|
||||||
|
#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
|
||||||
|
#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
|
||||||
|
#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
|
||||||
|
#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
|
||||||
|
#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
|
||||||
|
#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
|
||||||
|
#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
|
||||||
|
#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
|
||||||
|
#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
|
||||||
|
#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
|
||||||
|
#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
|
||||||
|
#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
|
||||||
|
|
||||||
|
/* usage */
|
||||||
|
#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
|
||||||
|
/* 0x31 was START_ARRAY */
|
||||||
|
#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
|
||||||
|
#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
|
||||||
|
#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
|
||||||
|
|
||||||
|
/* 63 partitions with the alternate major number (mdp) */
|
||||||
|
#define MdpMinorShift 6
|
||||||
|
|
||||||
|
typedef struct mdu_version_s {
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
|
int patchlevel;
|
||||||
|
} mdu_version_t;
|
||||||
|
|
||||||
|
typedef struct mdu_array_info_s {
|
||||||
|
/*
|
||||||
|
* Generic constant information
|
||||||
|
*/
|
||||||
|
int major_version;
|
||||||
|
int minor_version;
|
||||||
|
int patch_version;
|
||||||
|
int ctime;
|
||||||
|
int level;
|
||||||
|
int size;
|
||||||
|
int nr_disks;
|
||||||
|
int raid_disks;
|
||||||
|
int md_minor;
|
||||||
|
int not_persistent;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generic state information
|
||||||
|
*/
|
||||||
|
int utime; /* 0 Superblock update time */
|
||||||
|
int state; /* 1 State bits (clean, ...) */
|
||||||
|
int active_disks; /* 2 Number of currently active disks */
|
||||||
|
int working_disks; /* 3 Number of working disks */
|
||||||
|
int failed_disks; /* 4 Number of failed disks */
|
||||||
|
int spare_disks; /* 5 Number of spare disks */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Personality information
|
||||||
|
*/
|
||||||
|
int layout; /* 0 the array's physical layout */
|
||||||
|
int chunk_size; /* 1 chunk size in bytes */
|
||||||
|
|
||||||
|
} mdu_array_info_t;
|
||||||
|
|
||||||
|
/* non-obvious values for 'level' */
|
||||||
|
#define LEVEL_MULTIPATH (-4)
|
||||||
|
#define LEVEL_LINEAR (-1)
|
||||||
|
#define LEVEL_FAULTY (-5)
|
||||||
|
|
||||||
|
/* we need a value for 'no level specified' and 0
|
||||||
|
* means 'raid0', so we need something else. This is
|
||||||
|
* for internal use only
|
||||||
|
*/
|
||||||
|
#define LEVEL_NONE (-1000000)
|
||||||
|
|
||||||
|
typedef struct mdu_disk_info_s {
|
||||||
|
/*
|
||||||
|
* configuration/status of one particular disk
|
||||||
|
*/
|
||||||
|
int number;
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
|
int raid_disk;
|
||||||
|
int state;
|
||||||
|
|
||||||
|
} mdu_disk_info_t;
|
||||||
|
|
||||||
|
typedef struct mdu_start_info_s {
|
||||||
|
/*
|
||||||
|
* configuration/status of one particular disk
|
||||||
|
*/
|
||||||
|
int major;
|
||||||
|
int minor;
|
||||||
|
int raid_disk;
|
||||||
|
int state;
|
||||||
|
|
||||||
|
} mdu_start_info_t;
|
||||||
|
|
||||||
|
typedef struct mdu_bitmap_file_s
|
||||||
|
{
|
||||||
|
char pathname[4096];
|
||||||
|
} mdu_bitmap_file_t;
|
||||||
|
|
||||||
|
typedef struct mdu_param_s
|
||||||
|
{
|
||||||
|
int personality; /* 1,2,3,4 */
|
||||||
|
int chunk_size; /* in bytes */
|
||||||
|
int max_fault; /* unused for now */
|
||||||
|
} mdu_param_t;
|
||||||
|
|
||||||
|
#endif /* _UAPI_MD_U_H */
|
Loading…
Reference in New Issue
Block a user