diff --git a/don-t-auto-assemble-if-any-arrays-are-list.patch b/don-t-auto-assemble-if-any-arrays-are-list.patch deleted file mode 100644 index 23a0604..0000000 --- a/don-t-auto-assemble-if-any-arrays-are-list.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 0d172d634f153165a730181572abe90c3a2b646f Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 20 Nov 2008 17:02:55 +1100 -Subject: [PATCH] Assemble: don't auto-assemble if any arrays are listed in mdadm.conf - -Auto-assembly and planned assembly don't really work well together, -it can be confusing. -In particular in mkinitrd or similar creates an mdadm.conf to -assemble a particular array, we shouldn't go assembling any -other arrays as well. - -If you want auto assembly, you need to give mdadm a config -file with no ARRAY lines. - mdadm -Ascpartitions -can do this. - -Signed-off-by: NeilBrown ---- - mdadm.c | 4 ++-- - 1 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/mdadm.c b/mdadm.c -index 2bd963a..e0f51b7 100644 ---- a/mdadm.c -+++ b/mdadm.c -@@ -1092,9 +1092,9 @@ int main(int argc, char *argv[]) - array_list, - NULL, NULL, - readonly, runstop, NULL, homehost, verbose-quiet, force); -- if (rv == 0) cnt++; -+ cnt++; - } -- if (homehost) { -+ if (homehost && cnt == 0) { - /* Maybe we can auto-assemble something. - * Repeatedly call Assemble in auto-assemble mode - * until it fails --- -1.5.6.5 - diff --git a/intel.fixes.patch b/intel.fixes.patch deleted file mode 100644 index c033649..0000000 --- a/intel.fixes.patch +++ /dev/null @@ -1,623 +0,0 @@ -Multiple patches combined, fixing various issues with Intel metadata. - -commit 92bd8f8d3f2c9c7733f92a062a0752d9b9997673 -Author: Dan Williams -Date: Sat Nov 8 16:03:07 2008 -0700 - - imsm: fix uuid_from_super given 'signature' is not constant - - The version portion of the signature changes depending on the contents - of the container. - - Signed-off-by: Dan Williams - -commit 4d1313e9017e2608bfd2d01f854c19e23f7daf62 -Author: Dan Williams -Date: Sat Nov 8 16:03:07 2008 -0700 - - imsm: compatibility fixes for creating imsm arrays - - When creating an imsm array use the lowest possible feature set to - maximize compatibility. - - Signed-off-by: Dan Williams - -commit f2f27e63c44baac976b0022c6830393954d59fd4 -Author: Dan Williams -Date: Sat Nov 8 16:02:56 2008 -0700 - - imsm: fixup disk status definition endianess - - Change the multibyte disk status field definitions to imsm byte-order - (little-endian) to match other multibyte field definitions. - - Signed-off-by: Dan Williams - -commit fe7ed8cb4f43e8324ca526e4a56fb23095f0023b -Author: Dan Williams -Date: Sat Nov 8 15:47:39 2008 -0700 - - imsm: add definitions for recent imsm versions - - Signed-off-by: Dan Williams - -commit e3bba0e010e5ce61a804139ee77ef8e25a244dd1 -Author: Dan Williams -Date: Fri Nov 7 15:57:31 2008 -0700 - - imsm: cleanup migration definitions and usage - - imsm_set_array_state need not look at the map_state when failed==0 - - Signed-off-by: Dan Williams - -commit 5115ca67fd28a0d2f4f156fbbbdf8f648c83fc20 -Author: Dan Williams -Date: Fri Nov 7 15:08:09 2008 -0700 - - imsm: cleanup ->match_home and comment on return value - - Signed-off-by: Dan Williams -diff --git a/super-intel.c b/super-intel.c -index 5f06f30..d160b6a 100644 ---- a/super-intel.c -+++ b/super-intel.c -@@ -30,9 +30,25 @@ - #define MPB_SIG_LEN (strlen(MPB_SIGNATURE)) - #define MPB_VERSION_RAID0 "1.0.00" - #define MPB_VERSION_RAID1 "1.1.00" -+#define MPB_VERSION_MANY_VOLUMES_PER_ARRAY "1.2.00" -+#define MPB_VERSION_3OR4_DISK_ARRAY "1.2.01" - #define MPB_VERSION_RAID5 "1.2.02" -+#define MPB_VERSION_5OR6_DISK_ARRAY "1.2.04" -+#define MPB_VERSION_CNG "1.2.06" -+#define MPB_VERSION_ATTRIBS "1.3.00" - #define MAX_SIGNATURE_LENGTH 32 - #define MAX_RAID_SERIAL_LEN 16 -+ -+#define MPB_ATTRIB_CHECKSUM_VERIFY __cpu_to_le32(0x80000000) -+#define MPB_ATTRIB_PM __cpu_to_le32(0x40000000) -+#define MPB_ATTRIB_2TB __cpu_to_le32(0x20000000) -+#define MPB_ATTRIB_RAID0 __cpu_to_le32(0x00000001) -+#define MPB_ATTRIB_RAID1 __cpu_to_le32(0x00000002) -+#define MPB_ATTRIB_RAID10 __cpu_to_le32(0x00000004) -+#define MPB_ATTRIB_RAID1E __cpu_to_le32(0x00000008) -+#define MPB_ATTRIB_RAID5 __cpu_to_le32(0x00000010) -+#define MPB_ATTRIB_RAIDCNG __cpu_to_le32(0x00000020) -+ - #define MPB_SECTOR_CNT 418 - #define IMSM_RESERVED_SECTORS 4096 - -@@ -42,13 +58,13 @@ struct imsm_disk { - __u8 serial[MAX_RAID_SERIAL_LEN];/* 0xD8 - 0xE7 ascii serial number */ - __u32 total_blocks; /* 0xE8 - 0xEB total blocks */ - __u32 scsi_id; /* 0xEC - 0xEF scsi ID */ -+#define SPARE_DISK __cpu_to_le32(0x01) /* Spare */ -+#define CONFIGURED_DISK __cpu_to_le32(0x02) /* Member of some RaidDev */ -+#define FAILED_DISK __cpu_to_le32(0x04) /* Permanent failure */ -+#define USABLE_DISK __cpu_to_le32(0x08) /* Fully usable unless FAILED_DISK is set */ - __u32 status; /* 0xF0 - 0xF3 */ --#define SPARE_DISK 0x01 /* Spare */ --#define CONFIGURED_DISK 0x02 /* Member of some RaidDev */ --#define FAILED_DISK 0x04 /* Permanent failure */ --#define USABLE_DISK 0x08 /* Fully usable unless FAILED_DISK is set */ -- --#define IMSM_DISK_FILLERS 5 -+ __u32 owner_cfg_num; /* which config 0,1,2... owns this disk */ -+#define IMSM_DISK_FILLERS 4 - __u32 filler[IMSM_DISK_FILLERS]; /* 0xF4 - 0x107 MPB_DISK_FILLERS for future expansion */ - }; - -@@ -61,14 +77,16 @@ struct imsm_map { - __u8 map_state; /* Normal, Uninitialized, Degraded, Failed */ - #define IMSM_T_STATE_NORMAL 0 - #define IMSM_T_STATE_UNINITIALIZED 1 --#define IMSM_T_STATE_DEGRADED 2 /* FIXME: is this correct? */ --#define IMSM_T_STATE_FAILED 3 /* FIXME: is this correct? */ -+#define IMSM_T_STATE_DEGRADED 2 -+#define IMSM_T_STATE_FAILED 3 - __u8 raid_level; - #define IMSM_T_RAID0 0 - #define IMSM_T_RAID1 1 - #define IMSM_T_RAID5 5 /* since metadata version 1.2.02 ? */ - __u8 num_members; /* number of member disks */ -- __u8 reserved[3]; -+ __u8 num_domains; /* number of parity domains */ -+ __u8 failed_disk_num; /* valid only when state is degraded */ -+ __u8 reserved[1]; - __u32 filler[7]; /* expansion area */ - #define IMSM_ORD_REBUILD (1 << 24) - __u32 disk_ord_tbl[1]; /* disk_ord_tbl[num_members], -@@ -78,23 +96,50 @@ struct imsm_map { - - struct imsm_vol { - __u32 curr_migr_unit; -- __u32 reserved; -+ __u32 checkpoint_id; /* id to access curr_migr_unit */ - __u8 migr_state; /* Normal or Migrating */ -+#define MIGR_INIT 0 -+#define MIGR_REBUILD 1 -+#define MIGR_VERIFY 2 /* analagous to echo check > sync_action */ -+#define MIGR_GEN_MIGR 3 -+#define MIGR_STATE_CHANGE 4 - __u8 migr_type; /* Initializing, Rebuilding, ... */ - __u8 dirty; -- __u8 fill[1]; -- __u32 filler[5]; -+ __u8 fs_state; /* fast-sync state for CnG (0xff == disabled) */ -+ __u16 verify_errors; /* number of mismatches */ -+ __u16 bad_blocks; /* number of bad blocks during verify */ -+ __u32 filler[4]; - struct imsm_map map[1]; - /* here comes another one if migr_state */ - } __attribute__ ((packed)); - - struct imsm_dev { -- __u8 volume[MAX_RAID_SERIAL_LEN]; -+ __u8 volume[MAX_RAID_SERIAL_LEN]; - __u32 size_low; - __u32 size_high; -+#define DEV_BOOTABLE __cpu_to_le32(0x01) -+#define DEV_BOOT_DEVICE __cpu_to_le32(0x02) -+#define DEV_READ_COALESCING __cpu_to_le32(0x04) -+#define DEV_WRITE_COALESCING __cpu_to_le32(0x08) -+#define DEV_LAST_SHUTDOWN_DIRTY __cpu_to_le32(0x10) -+#define DEV_HIDDEN_AT_BOOT __cpu_to_le32(0x20) -+#define DEV_CURRENTLY_HIDDEN __cpu_to_le32(0x40) -+#define DEV_VERIFY_AND_FIX __cpu_to_le32(0x80) -+#define DEV_MAP_STATE_UNINIT __cpu_to_le32(0x100) -+#define DEV_NO_AUTO_RECOVERY __cpu_to_le32(0x200) -+#define DEV_CLONE_N_GO __cpu_to_le32(0x400) -+#define DEV_CLONE_MAN_SYNC __cpu_to_le32(0x800) -+#define DEV_CNG_MASTER_DISK_NUM __cpu_to_le32(0x1000) - __u32 status; /* Persistent RaidDev status */ - __u32 reserved_blocks; /* Reserved blocks at beginning of volume */ --#define IMSM_DEV_FILLERS 12 -+ __u8 migr_priority; -+ __u8 num_sub_vols; -+ __u8 tid; -+ __u8 cng_master_disk; -+ __u16 cache_policy; -+ __u8 cng_state; -+ __u8 cng_sub_state; -+#define IMSM_DEV_FILLERS 10 - __u32 filler[IMSM_DEV_FILLERS]; - struct imsm_vol vol; - } __attribute__ ((packed)); -@@ -546,7 +591,7 @@ static void print_imsm_disk(struct imsm_super *mpb, int index, __u32 reserved) - printf("\n"); - snprintf(str, MAX_RAID_SERIAL_LEN + 1, "%s", disk->serial); - printf(" Disk%02d Serial : %s\n", index, str); -- s = __le32_to_cpu(disk->status); -+ s = disk->status; - printf(" State :%s%s%s%s\n", s&SPARE_DISK ? " spare" : "", - s&CONFIGURED_DISK ? " active" : "", - s&FAILED_DISK ? " failed" : "", -@@ -663,7 +708,14 @@ static void brief_detail_super_imsm(struct supertype *st) - - static int match_home_imsm(struct supertype *st, char *homehost) - { -- printf("%s\n", __FUNCTION__); -+ /* the imsm metadata format does not specify any host -+ * identification information. We return -1 since we can never -+ * confirm nor deny whether a given array is "meant" for this -+ * host. We rely on compare_super and the 'family_num' field to -+ * exclude member disks that do not belong, and we rely on -+ * mdadm.conf to specify the arrays that should be assembled. -+ * Auto-assembly may still pick up "foreign" arrays. -+ */ - - return -1; - } -@@ -699,7 +751,7 @@ static void uuid_from_super_imsm(struct supertype *st, int uuid[4]) - struct imsm_dev *dev = NULL; - - sha1_init_ctx(&ctx); -- sha1_process_bytes(super->anchor->sig, MAX_SIGNATURE_LENGTH, &ctx); -+ sha1_process_bytes(super->anchor->sig, MPB_SIG_LEN, &ctx); - sha1_process_bytes(&super->anchor->family_num, sizeof(__u32), &ctx); - if (super->current_vol >= 0) - dev = get_imsm_dev(super, super->current_vol); -@@ -838,7 +890,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info) - disk = &super->disks->disk; - info->data_offset = __le32_to_cpu(disk->total_blocks) - reserved; - info->component_size = reserved; -- s = __le32_to_cpu(disk->status); -+ s = disk->status; - info->disk.state = s & CONFIGURED_DISK ? (1 << MD_DISK_ACTIVE) : 0; - info->disk.state |= s & FAILED_DISK ? (1 << MD_DISK_FAULTY) : 0; - info->disk.state |= s & SPARE_DISK ? 0 : (1 << MD_DISK_SYNC); -@@ -1127,16 +1179,13 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd) - disk_iter = __get_imsm_disk(super->anchor, i); - - if (serialcmp(disk_iter->serial, dl->serial) == 0) { -- __u32 status; -- - dl->disk = *disk_iter; -- status = __le32_to_cpu(dl->disk.status); - /* only set index on disks that are a member of a - * populated contianer, i.e. one with raid_devs - */ -- if (status & FAILED_DISK) -+ if (dl->disk.status & FAILED_DISK) - dl->index = -2; -- else if (status & SPARE_DISK) -+ else if (dl->disk.status & SPARE_DISK) - dl->index = -1; - else - dl->index = i; -@@ -1148,7 +1197,7 @@ load_imsm_disk(int fd, struct intel_super *super, char *devname, int keep_fd) - /* no match, maybe a stale failed drive */ - if (i == super->anchor->num_disks && dl->index >= 0) { - dl->disk = *__get_imsm_disk(super->anchor, dl->index); -- if (__le32_to_cpu(dl->disk.status) & FAILED_DISK) -+ if (dl->disk.status & FAILED_DISK) - dl->index = -2; - } - -@@ -1171,11 +1220,11 @@ static void imsm_copy_dev(struct imsm_dev *dest, struct imsm_dev *src) - * - * Migration is indicated by one of the following states - * 1/ Idle (migr_state=0 map0state=normal||unitialized||degraded||failed) -- * 2/ Initialize (migr_state=1 migr_type=0 map0state=normal -+ * 2/ Initialize (migr_state=1 migr_type=MIGR_INIT map0state=normal - * map1state=unitialized) -- * 3/ Verify (Resync) (migr_state=1 migr_type=1 map0state=normal -+ * 3/ Verify (Resync) (migr_state=1 migr_type=MIGR_REBUILD map0state=normal - * map1state=normal) -- * 4/ Rebuild (migr_state=1 migr_type=1 map0state=normal -+ * 4/ Rebuild (migr_state=1 migr_type=MIGR_REBUILD map0state=normal - * map1state=degraded) - */ - static void migrate(struct imsm_dev *dev, __u8 to_state, int rebuild_resync) -@@ -1451,7 +1500,6 @@ static int find_missing(struct intel_super *super) - struct imsm_super *mpb = super->anchor; - struct dl *dl; - struct imsm_disk *disk; -- __u32 status; - - for (i = 0; i < mpb->num_disks; i++) { - disk = __get_imsm_disk(mpb, i); -@@ -1463,8 +1511,7 @@ static int find_missing(struct intel_super *super) - /* ok we have a 'disk' without a live entry in - * super->disks - */ -- status = __le32_to_cpu(disk->status); -- if (status & FAILED_DISK || !(status & USABLE_DISK)) -+ if (disk->status & FAILED_DISK || !(disk->status & USABLE_DISK)) - continue; /* never mind, already marked */ - - dl = malloc(sizeof(*dl)); -@@ -1659,6 +1706,53 @@ static __u32 info_to_blocks_per_member(mdu_array_info_t *info) - return (info->size * 2) & ~(info_to_blocks_per_strip(info) - 1); - } - -+static void imsm_update_version_info(struct intel_super *super) -+{ -+ /* update the version and attributes */ -+ struct imsm_super *mpb = super->anchor; -+ char *version; -+ struct imsm_dev *dev; -+ struct imsm_map *map; -+ int i; -+ -+ for (i = 0; i < mpb->num_raid_devs; i++) { -+ dev = get_imsm_dev(super, i); -+ map = get_imsm_map(dev, 0); -+ if (__le32_to_cpu(dev->size_high) > 0) -+ mpb->attributes |= MPB_ATTRIB_2TB; -+ -+ /* FIXME detect when an array spans a port multiplier */ -+ #if 0 -+ mpb->attributes |= MPB_ATTRIB_PM; -+ #endif -+ -+ if (mpb->num_raid_devs > 1 || -+ mpb->attributes != MPB_ATTRIB_CHECKSUM_VERIFY) { -+ version = MPB_VERSION_ATTRIBS; -+ switch (get_imsm_raid_level(map)) { -+ case 0: mpb->attributes |= MPB_ATTRIB_RAID0; break; -+ case 1: mpb->attributes |= MPB_ATTRIB_RAID1; break; -+ case 10: mpb->attributes |= MPB_ATTRIB_RAID10; break; -+ case 5: mpb->attributes |= MPB_ATTRIB_RAID5; break; -+ } -+ } else { -+ if (map->num_members >= 5) -+ version = MPB_VERSION_5OR6_DISK_ARRAY; -+ else if (dev->status == DEV_CLONE_N_GO) -+ version = MPB_VERSION_CNG; -+ else if (get_imsm_raid_level(map) == 5) -+ version = MPB_VERSION_RAID5; -+ else if (map->num_members >= 3) -+ version = MPB_VERSION_3OR4_DISK_ARRAY; -+ else if (get_imsm_raid_level(map) == 1) -+ version = MPB_VERSION_RAID1; -+ else -+ version = MPB_VERSION_RAID0; -+ } -+ strcpy(((char *) mpb->sig) + strlen(MPB_SIGNATURE), version); -+ } -+} -+ - static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, - unsigned long long size, char *name, - char *homehost, int *uuid) -@@ -1724,7 +1818,7 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, - dev->reserved_blocks = __cpu_to_le32(0); - vol = &dev->vol; - vol->migr_state = 0; -- vol->migr_type = 0; -+ vol->migr_type = MIGR_INIT; - vol->dirty = 0; - vol->curr_migr_unit = 0; - for (i = 0; i < idx; i++) { -@@ -1747,10 +1841,13 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, - "in a raid1 volume\n"); - return 0; - } -- if (info->level == 10) -+ if (info->level == 10) { - map->raid_level = 1; -- else -+ map->num_domains = info->raid_disks / 2; -+ } else { - map->raid_level = info->level; -+ map->num_domains = !!map->raid_level; -+ } - - map->num_members = info->raid_disks; - for (i = 0; i < map->num_members; i++) { -@@ -1760,6 +1857,8 @@ static int init_super_imsm_volume(struct supertype *st, mdu_array_info_t *info, - mpb->num_raid_devs++; - super->dev_tbl[super->current_vol] = dev; - -+ imsm_update_version_info(super); -+ - return 1; - } - -@@ -1778,6 +1877,7 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info, - struct intel_super *super; - struct imsm_super *mpb; - size_t mpb_size; -+ char *version; - - if (!info) { - st->sb = NULL; -@@ -1798,9 +1898,12 @@ static int init_super_imsm(struct supertype *st, mdu_array_info_t *info, - mpb = super->buf; - memset(mpb, 0, mpb_size); - -- memcpy(mpb->sig, MPB_SIGNATURE, strlen(MPB_SIGNATURE)); -- memcpy(mpb->sig + strlen(MPB_SIGNATURE), MPB_VERSION_RAID5, -- strlen(MPB_VERSION_RAID5)); -+ mpb->attributes = MPB_ATTRIB_CHECKSUM_VERIFY; -+ -+ version = (char *) mpb->sig; -+ strcpy(version, MPB_SIGNATURE); -+ version += strlen(MPB_SIGNATURE); -+ strcpy(version, MPB_VERSION_RAID0); - mpb->mpb_size = mpb_size; - - st->sb = super; -@@ -1816,7 +1919,6 @@ static void add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, - struct dl *dl; - struct imsm_dev *dev; - struct imsm_map *map; -- __u32 status; - - dev = get_imsm_dev(super, super->current_vol); - map = get_imsm_map(dev, 0); -@@ -1835,8 +1937,7 @@ static void add_to_super_imsm_volume(struct supertype *st, mdu_disk_info_t *dk, - super->anchor->num_disks++; - } - set_imsm_ord_tbl_ent(map, dk->number, dl->index); -- status = CONFIGURED_DISK | USABLE_DISK; -- dl->disk.status = __cpu_to_le32(status); -+ dl->disk.status = CONFIGURED_DISK | USABLE_DISK; - - /* if we are creating the first raid device update the family number */ - if (super->current_vol == 0) { -@@ -1857,7 +1958,7 @@ static void add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, - struct intel_super *super = st->sb; - struct dl *dd; - unsigned long long size; -- __u32 status, id; -+ __u32 id; - int rv; - struct stat stb; - -@@ -1889,10 +1990,9 @@ static void add_to_super_imsm(struct supertype *st, mdu_disk_info_t *dk, - - get_dev_size(fd, NULL, &size); - size /= 512; -- status = USABLE_DISK | SPARE_DISK; - serialcpy(dd->disk.serial, dd->serial); - dd->disk.total_blocks = __cpu_to_le32(size); -- dd->disk.status = __cpu_to_le32(status); -+ dd->disk.status = USABLE_DISK | SPARE_DISK; - if (sysfs_disk_to_scsi_id(fd, &id) == 0) - dd->disk.scsi_id = __cpu_to_le32(id); - else -@@ -2392,7 +2492,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st) - if (d == NULL) - skip = 1; - -- s = d ? __le32_to_cpu(d->disk.status) : 0; -+ s = d ? d->disk.status : 0; - if (s & FAILED_DISK) - skip = 1; - if (!(s & USABLE_DISK)) -@@ -2502,8 +2602,7 @@ static __u8 imsm_check_degraded(struct intel_super *super, struct imsm_dev *dev, - insync = 2; - - disk = get_imsm_disk(super, idx); -- if (!disk || -- __le32_to_cpu(disk->status) & FAILED_DISK || -+ if (!disk || disk->status & FAILED_DISK || - ord & IMSM_ORD_REBUILD) - insync--; - -@@ -2541,8 +2640,7 @@ static int imsm_count_failed(struct intel_super *super, struct imsm_dev *dev) - int idx = ord_to_idx(ord); - - disk = get_imsm_disk(super, idx); -- if (!disk || -- __le32_to_cpu(disk->status) & FAILED_DISK || -+ if (!disk || disk->status & FAILED_DISK || - ord & IMSM_ORD_REBUILD) - failed++; - } -@@ -2557,7 +2655,7 @@ static int is_resyncing(struct imsm_dev *dev) - if (!dev->vol.migr_state) - return 0; - -- if (dev->vol.migr_type == 0) -+ if (dev->vol.migr_type == MIGR_INIT) - return 1; - - migr_map = get_imsm_map(dev, 1); -@@ -2575,7 +2673,7 @@ static int is_rebuilding(struct imsm_dev *dev) - if (!dev->vol.migr_state) - return 0; - -- if (dev->vol.migr_type == 0) -+ if (dev->vol.migr_type != MIGR_REBUILD) - return 0; - - migr_map = get_imsm_map(dev, 1); -@@ -2588,12 +2686,9 @@ static int is_rebuilding(struct imsm_dev *dev) - - static void mark_failure(struct imsm_disk *disk) - { -- __u32 status = __le32_to_cpu(disk->status); -- -- if (status & FAILED_DISK) -+ if (disk->status & FAILED_DISK) - return; -- status |= FAILED_DISK; -- disk->status = __cpu_to_le32(status); -+ disk->status |= FAILED_DISK; - disk->scsi_id = __cpu_to_le32(~(__u32)0); - memmove(&disk->serial[0], &disk->serial[1], MAX_RAID_SERIAL_LEN - 1); - } -@@ -2641,9 +2736,10 @@ static int imsm_set_array_state(struct active_array *a, int consistent) - } else if (!is_resyncing(dev) && !failed) { - /* mark the start of the init process if nothing is failed */ - dprintf("imsm: mark resync start (%llu)\n", a->resync_start); -- map->map_state = map_state; -- migrate(dev, IMSM_T_STATE_NORMAL, -- map->map_state == IMSM_T_STATE_NORMAL); -+ if (map->map_state == IMSM_T_STATE_NORMAL) -+ migrate(dev, IMSM_T_STATE_NORMAL, MIGR_REBUILD); -+ else -+ migrate(dev, IMSM_T_STATE_NORMAL, MIGR_INIT); - super->updates_pending++; - } - -@@ -2676,7 +2772,6 @@ static void imsm_set_disk(struct active_array *a, int n, int state) - struct imsm_map *map = get_imsm_map(dev, 0); - struct imsm_disk *disk; - int failed; -- __u32 status; - __u32 ord; - __u8 map_state; - -@@ -2693,8 +2788,7 @@ static void imsm_set_disk(struct active_array *a, int n, int state) - disk = get_imsm_disk(super, ord_to_idx(ord)); - - /* check for new failures */ -- status = __le32_to_cpu(disk->status); -- if ((state & DS_FAULTY) && !(status & FAILED_DISK)) { -+ if ((state & DS_FAULTY) && !(disk->status & FAILED_DISK)) { - mark_failure(disk); - super->updates_pending++; - } -@@ -2781,7 +2875,7 @@ static struct dl *imsm_readd(struct intel_super *super, int idx, struct active_a - if (dl->index == i) - break; - -- if (dl && __le32_to_cpu(dl->disk.status) & FAILED_DISK) -+ if (dl && dl->disk.status & FAILED_DISK) - dl = NULL; - - if (dl) -@@ -2802,7 +2896,6 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot, struct act - int j; - int found; - __u32 array_start; -- __u32 status; - struct dl *dl; - - for (dl = super->disks; dl; dl = dl->next) { -@@ -2818,11 +2911,10 @@ static struct dl *imsm_add_spare(struct intel_super *super, int slot, struct act - continue; - - /* skip in use or failed drives */ -- status = __le32_to_cpu(dl->disk.status); -- if (status & FAILED_DISK || idx == dl->index) { -+ if (dl->disk.status & FAILED_DISK || idx == dl->index) { - dprintf("%x:%x status ( %s%s)\n", - dl->major, dl->minor, -- status & FAILED_DISK ? "failed " : "", -+ dl->disk.status & FAILED_DISK ? "failed " : "", - idx == dl->index ? "in use " : ""); - continue; - } -@@ -3072,7 +3164,6 @@ static void imsm_process_update(struct supertype *st, - struct imsm_map *migr_map; - struct active_array *a; - struct imsm_disk *disk; -- __u32 status; - __u8 to_state; - struct dl *dl; - unsigned int found; -@@ -3101,8 +3192,7 @@ static void imsm_process_update(struct supertype *st, - if (i == u->slot) - continue; - disk = get_imsm_disk(super, get_imsm_disk_idx(dev, i)); -- if (!disk || -- __le32_to_cpu(disk->status) & FAILED_DISK) -+ if (!disk || disk->status & FAILED_DISK) - failed++; - } - -@@ -3112,15 +3202,13 @@ static void imsm_process_update(struct supertype *st, - super->anchor->num_disks++; - } - disk = &dl->disk; -- status = __le32_to_cpu(disk->status); -- status |= CONFIGURED_DISK; -- status &= ~SPARE_DISK; -- disk->status = __cpu_to_le32(status); -+ disk->status |= CONFIGURED_DISK; -+ disk->status &= ~SPARE_DISK; - - /* mark rebuild */ - to_state = imsm_check_degraded(super, dev, failed); - map->map_state = IMSM_T_STATE_DEGRADED; -- migrate(dev, to_state, 1); -+ migrate(dev, to_state, MIGR_REBUILD); - migr_map = get_imsm_map(dev, 1); - set_imsm_ord_tbl_ent(map, u->slot, dl->index); - set_imsm_ord_tbl_ent(migr_map, u->slot, dl->index | IMSM_ORD_REBUILD); -@@ -3233,14 +3321,14 @@ static void imsm_process_update(struct supertype *st, - /* fix up flags */ - for (i = 0; i < map->num_members; i++) { - struct imsm_disk *disk; -- __u32 status; - - disk = get_imsm_disk(super, get_imsm_disk_idx(dev, i)); -- status = __le32_to_cpu(disk->status); -- status |= CONFIGURED_DISK; -- status &= ~SPARE_DISK; -- disk->status = __cpu_to_le32(status); -+ disk->status |= CONFIGURED_DISK; -+ disk->status &= ~SPARE_DISK; - } -+ -+ imsm_update_version_info(super); -+ - break; - } - case update_add_disk: diff --git a/mdadm-3.0-devel2.tar.bz2 b/mdadm-3.0-devel2.tar.bz2 deleted file mode 100644 index ac323c9..0000000 --- a/mdadm-3.0-devel2.tar.bz2 +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:40c18353b488cd1731349d4b585c3e14f3003e0d04f487c680f47b4500e1fcfc -size 246779 diff --git a/mdadm-3.0.tar.bz2 b/mdadm-3.0.tar.bz2 new file mode 100644 index 0000000..e20f227 --- /dev/null +++ b/mdadm-3.0.tar.bz2 @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6fd6ab77c4d996879192edd8ad90cd512165a857795c25c98fc35206df6c2e64 +size 250775 diff --git a/mdadm-auto-assemble.patch b/mdadm-auto-assemble.patch deleted file mode 100644 index 716d60c..0000000 --- a/mdadm-auto-assemble.patch +++ /dev/null @@ -1,110 +0,0 @@ -diff --git a/Assemble.c b/Assemble.c -index c86a165..20c4be7 100644 ---- a/Assemble.c -+++ b/Assemble.c -@@ -320,7 +320,7 @@ int Assemble(struct supertype *st, char *mddev, - - tmpdev->content = content->next; - if (tmpdev->content == NULL) -- tmpdev->used = 1; -+ tmpdev->used = 2; - - } else if (ident->container || ident->member) { - /* No chance of this matching if we don't have -@@ -396,12 +396,15 @@ int Assemble(struct supertype *st, char *mddev, - * looking. If the chosen member is active, skip. - */ - if (is_member_busy(content->text_version)) { -+ if (report_missmatch) -+ fprintf(stderr, Name ": member %s in %s is already assembled\n", -+ content->text_version, -+ devname); -+ tst->ss->free_super(tst); -+ tst = NULL; -+ content = NULL; - if (auto_assem) - goto loop; -- fprintf(stderr, Name ": member %s in %s is already assembled\n", -- content->text_version, -- devname); -- tst->ss->free_super(tst); - return 1; - } - st = tst; tst = NULL; -@@ -1202,8 +1205,10 @@ int assemble_container_content(struct supertype *st, int mdfd, - - sra = sysfs_read(mdfd, 0, GET_VERSION); - if (sra == NULL || strcmp(sra->text_version, content->text_version) != 0) -- if (sysfs_set_array(content, md_get_version(mdfd)) != 0) -+ if (sysfs_set_array(content, md_get_version(mdfd)) != 0) { -+ close(mdfd); - return 1; -+ } - if (sra) - sysfs_free(sra); - -@@ -1212,9 +1217,10 @@ int assemble_container_content(struct supertype *st, int mdfd, - working++; - else if (errno == EEXIST) - preexist++; -- if (working == 0) -- /* Nothing new, don't try to start */ ; -- else if (runstop > 0 || -+ if (working == 0) { -+ close(mdfd); -+ return 1;/* Nothing new, don't try to start */ -+ } else if (runstop > 0 || - (working + preexist) >= content->array.working_disks) { - - map_update(&map, fd2devnum(mdfd), -@@ -1246,15 +1252,18 @@ int assemble_container_content(struct supertype *st, int mdfd, - fprintf(stderr, "\n"); - } - wait_for(chosen_name); -+ close(mdfd); -+ return 0; - /* FIXME should have an O_EXCL and wait for read-auto */ -- } else -+ } else { - if (verbose >= 0) - fprintf(stderr, Name - ": %s assembled with %d devices but " - "not started\n", - chosen_name, working); -- -- return 0; -+ close(mdfd); -+ return 1; -+ } - } - #endif - -diff --git a/Create.c b/Create.c -index da05eed..783ab09 100644 ---- a/Create.c -+++ b/Create.c -@@ -780,11 +780,11 @@ int Create(struct supertype *st, char *mddev, - ping_monitor(devnum2devname(st->container_dev)); - close(container_fd); - } -+ wait_for(chosen_name); - } else { - fprintf(stderr, Name ": not starting array - not enough devices.\n"); - } - close(mdfd); -- wait_for(chosen_name); - return 0; - - abort: -diff --git a/Incremental.c b/Incremental.c -index ff8aa9a..474f78d 100644 ---- a/Incremental.c -+++ b/Incremental.c -@@ -829,7 +829,6 @@ int Incremental_container(struct supertype *st, char *devname, int verbose, - - err = assemble_container_content(st, mdfd, ra, runstop, - chosen_name, verbose); -- close(mdfd); - if (err) - return err; - } diff --git a/mdadm-destdir.patch b/mdadm-destdir.patch deleted file mode 100644 index 0d816fa..0000000 --- a/mdadm-destdir.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile -+++ Makefile -@@ -199,7 +199,7 @@ - $(INSTALL) -D -m 644 mdadm.conf.5 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 - - install-udev: udev-md-raid.rules -- $(INSTALL) -D -m 644 udev-md-raid.rules /lib/udev/rules.d/64-md-raid.rules -+ $(INSTALL) -D -m 644 udev-md-raid.rules $(DESTDIR)/lib/udev/rules.d/64-md-raid.rules - - uninstall: - rm -f $(DESTDIR)$(MAN8DIR)/mdadm.8 md.4 $(DESTDIR)$(MAN4DIR)/md.4 $(DESTDIR)$(MAN5DIR)/mdadm.conf.5 $(DESTDIR)$(BINDIR)/mdadm diff --git a/mdadm-overflow.patch b/mdadm-overflow.patch deleted file mode 100644 index d92cd1f..0000000 --- a/mdadm-overflow.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- mdopen.c -+++ mdopen.c -@@ -88,7 +88,7 @@ - if (chmod(name, stb2.st_mode & 07777)) - perror("chmod"); - } else { -- snprintf(sym, 10000, "%s%s%d", orig, odig?"p":"", i); -+ snprintf(sym, 1024, "%s%s%d", orig, odig?"p":"", i); - symlink(sym, name); - } - stat(name, &stb2); diff --git a/mdadm.changes b/mdadm.changes index e7f70a7..1c5a09b 100644 --- a/mdadm.changes +++ b/mdadm.changes @@ -1,3 +1,15 @@ +------------------------------------------------------------------- +Fri Jun 12 09:43:43 CEST 2009 - mmarek@suse.cz + +- remove static md* device nodes, they should not be needed + anymore. + +------------------------------------------------------------------- +Thu Jun 11 11:32:55 CEST 2009 - mmarek@suse.cz + +- updated to 3.0 final +- dropped all patches + ------------------------------------------------------------------- Tue Mar 3 10:36:11 CET 2009 - mmarek@suse.cz diff --git a/mdadm.spec b/mdadm.spec index 0b1cd00..faf1932 100644 --- a/mdadm.spec +++ b/mdadm.spec @@ -20,8 +20,8 @@ Name: mdadm Version: 3.0 -Release: 20 -%define ver 3.0-devel2 +Release: 21 +%define ver 3.0 BuildRequires: sgmltool PreReq: %fillup_prereq %insserv_prereq Obsoletes: raidtools @@ -32,19 +32,9 @@ Url: http://www.kernel.org/pub/linux/utils/raid/mdadm/ Summary: Utility for Configuring MD Setup BuildRoot: %{_tmppath}/%{name}-%{version}-build Source: %{name}-%{ver}.tar.bz2 -Patch1: super-intel-undefined-operation.patch -Patch2: mdmon-ia64-clone.patch -Patch3: mdadm-destdir.patch -Patch4: mdadm-overflow.patch -Patch5: mdadm-auto-assemble.patch +# XXX - still needed? Patch6: Start-kpartx-for-imsm-devices.patch -Patch7: intel.fixes.patch -Patch8: name.fixes.patch -Patch9: mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch -Patch10: don-t-auto-assemble-if-any-arrays-are-list.patch Patch11: manage-rebuild-map-for-kpartx -Patch12: super0-Do-all-metadata-IO-with-4096byte-alignment.patch -Patch13: super1-do-metadata-IO-in-sector_size-units.patch Source1: Software-RAID.HOWTO.tar.bz2 Source2: sysconfig.mdadm Source3: mdadmd @@ -65,19 +55,8 @@ Authors: %prep %setup -q -a1 -n %{name}-%{ver} -%patch1 -%patch2 -%patch3 -%patch4 -%patch5 -p1 -%patch6 -p1 -%patch7 -p1 -%patch8 -p1 -%patch9 -p1 -%patch10 -p1 -%patch11 -p1 -%patch12 -p1 -%patch13 -p1 +#patch6 -p1 +#patch11 -p1 %build %{suse_update_config -f} @@ -119,38 +98,6 @@ rm -rf $RPM_BUILD_ROOT %files %defattr(-,root,root) %attr(0755,root,root) %config %{_sysconfdir}/init.d/* -%attr(640,root,disk) %dev(b,9,0) /lib/udev/devices/md0 -%attr(640,root,disk) %dev(b,9,1) /lib/udev/devices/md1 -%attr(640,root,disk) %dev(b,9,2) /lib/udev/devices/md2 -%attr(640,root,disk) %dev(b,9,3) /lib/udev/devices/md3 -%attr(640,root,disk) %dev(b,9,4) /lib/udev/devices/md4 -%attr(640,root,disk) %dev(b,9,5) /lib/udev/devices/md5 -%attr(640,root,disk) %dev(b,9,6) /lib/udev/devices/md6 -%attr(640,root,disk) %dev(b,9,7) /lib/udev/devices/md7 -%attr(640,root,disk) %dev(b,9,8) /lib/udev/devices/md8 -%attr(640,root,disk) %dev(b,9,9) /lib/udev/devices/md9 -%attr(640,root,disk) %dev(b,9,10) /lib/udev/devices/md10 -%attr(640,root,disk) %dev(b,9,11) /lib/udev/devices/md11 -%attr(640,root,disk) %dev(b,9,12) /lib/udev/devices/md12 -%attr(640,root,disk) %dev(b,9,13) /lib/udev/devices/md13 -%attr(640,root,disk) %dev(b,9,14) /lib/udev/devices/md14 -%attr(640,root,disk) %dev(b,9,15) /lib/udev/devices/md15 -%attr(640,root,disk) %dev(b,9,16) /lib/udev/devices/md16 -%attr(640,root,disk) %dev(b,9,17) /lib/udev/devices/md17 -%attr(640,root,disk) %dev(b,9,18) /lib/udev/devices/md18 -%attr(640,root,disk) %dev(b,9,19) /lib/udev/devices/md19 -%attr(640,root,disk) %dev(b,9,20) /lib/udev/devices/md20 -%attr(640,root,disk) %dev(b,9,21) /lib/udev/devices/md21 -%attr(640,root,disk) %dev(b,9,22) /lib/udev/devices/md22 -%attr(640,root,disk) %dev(b,9,23) /lib/udev/devices/md23 -%attr(640,root,disk) %dev(b,9,24) /lib/udev/devices/md24 -%attr(640,root,disk) %dev(b,9,25) /lib/udev/devices/md25 -%attr(640,root,disk) %dev(b,9,26) /lib/udev/devices/md26 -%attr(640,root,disk) %dev(b,9,27) /lib/udev/devices/md27 -%attr(640,root,disk) %dev(b,9,28) /lib/udev/devices/md28 -%attr(640,root,disk) %dev(b,9,29) /lib/udev/devices/md29 -%attr(640,root,disk) %dev(b,9,30) /lib/udev/devices/md30 -%attr(640,root,disk) %dev(b,9,31) /lib/udev/devices/md31 %doc COPYING ChangeLog README.initramfs TODO mdadm.conf-example mkinitramfs %doc Software-RAID.HOWTO/Software-RAID.HOWTO*{.txt,.html} %doc %{_mandir}/man?/* @@ -166,423 +113,3 @@ rm -rf $RPM_BUILD_ROOT /lib/mkinitrd/scripts/boot-md.sh %changelog -* Tue Mar 03 2009 mmarek@suse.cz -- super0: Do all metadata IO with 4096byte alignment -- super1 - do metadata IO in sector_size units. - (bnc#466172) -* Sat Feb 21 2009 mmarek@suse.cz -- mkinitrd-setup.sh: filter out duplicate devices (bnc#461673, - patch by Xin Wei Hu) -* Tue Feb 17 2009 mmarek@suse.cz -- disable auto-assemly in boot.md completely as it can collide with - dmraid (bnc#474652). If someone wants to auto-assemble md arrays - in the rescue system, they can run - 'mdadm -Es -c partitions >mdadm.conf && mdadm -As -c mdadm.conf' - manually. -* Mon Feb 16 2009 mmarek@suse.cz -- fix segfault when stopping imsm arrays - (bnc#473947, patch by Dan Williams) -* Mon Jan 26 2009 ro@suse.de -- change fillup call from "-Y" to "-y" the boot script has - been present in this package for long enough (SLES10-GA) -* Fri Dec 05 2008 hare@suse.de -- Wait for udev to settle before continuing (bnc#435778) -* Fri Dec 05 2008 nfbrown@suse.de -- boot.md : an exit status of '2' from "mdadm --assemble" - should not be seen as failure by boot.md. - It happens if one or more arrays is already - assembled. - (bnc#456028) -* Thu Nov 20 2008 nfbrown@suse.de -- don-t-auto-assemble-if-any-arrays-are-list.patch - Avoid assembling extra arrays during initrd - processing. bnc#445438 -* Thu Nov 20 2008 nfbrown@suse.de -- mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch - avoid problems if mdmon is run before - udev creates any devices. -* Fri Nov 14 2008 nfbrown@suse.de -- intel.fixes.patch : various fixes from intel for - proper handling of their metadata -- name.fixes.patch : various fixes for new handling - of device names - one could cause a crash. -* Sun Nov 09 2008 ro@suse.de -- fix patch apply depth -* Fri Nov 07 2008 nfbrown@suse.de -- mdadm-auto-assemble.patch - fix various bugs in - auto-assemble -- start-kpartx-for-imsm-devices.patch - IMSM devices - need to be partitioned, and may programs including - YaST don't understand partitioned md devices, - so run kpartx to create 'dm' based partitions which - have a better chance for being understood - This relates to FATE#304220 -* Fri Nov 07 2008 ro@suse.de -- remove udev rule (conflicting with file in udev package) -* Fri Nov 07 2008 ro@suse.de -- buildfix: add missing DESTDIR to Makefile for udev rule -- fix len in snprintf to silence compiler warning about potential - overflow -* Thu Nov 06 2008 nfbrown@suse.de -- Update from mdadm-3.0-devel1 to mdadm-3.0-devel2. - This includes various bug fixes and enhancements to the - extent that DDF and IMSM work reasonably well and can be - auto-assembled much like other arrays. -- Allow BOOT_MD_USE_MDADM_CONFIG to have the value 'part' - that, like 'no', arrays are auto-assembled. However they - get assembled as 'mdp' partitionable arrays where possible. - This currently only affect arrays with v1.x metadata. - This supports FATE#303894 -* Fri Oct 03 2008 mmarek@suse.cz -- fixed mdmon's clone_monitor on ia64 -* Fri Oct 03 2008 mmarek@suse.cz -- fixed byte swapping in super-intel.c on big endian. -* Wed Sep 24 2008 ro@suse.de -- change "udevsettle" to "udevadm settle" -* Fri Sep 19 2008 mmarek@suse.cz -- added /var/run/mdadm for mdmon -- fixed build -* Thu Sep 18 2008 nfbrown@suse.de -- update to mdadm-3.0-devel1 - package version number is set to 3.0 to avodi future confusion. - This is a substantial update that provides support for handling - the metadata entirely in userspace and thus making easier to - handle a variety of metadata formats. Support is included for - DDF and for the Intel Matrix metadata used by recent ICH chipsets. - An extra program 'mdmon' is needed and included. It is run to - monitor any array using 'external' (to the kernel) metadata - and will update the metadata in response to device failures etc. - This is required for FATE 304219 -* Wed Sep 03 2008 hare@suse.de -- Call mkinitrd_setup during %%post and %%postun (bnc#413709) -* Sun Aug 17 2008 aj@suse.de -- Fix init scripts. -* Wed Jul 23 2008 hare@suse.de -- Include mkinitrd scriptlets. -* Fri Jun 20 2008 mmarek@suse.cz -- updated to 2.6.7 + fixes from git - * Avoid segfault when parsing /proc/mdstat with auto-read-only - arrays. - * For v0.90 superblocks, print the 'Events' count as a real - count, not 2 numbers separated by a dot. - * Allow creation of a RAID6 with exactly one missing device. - * Use LOG_PID for syslog, so you get the pid of mdadm in the - log files. - * --export now works with --examine too (not just --detail) - * Improve auto-creation of device special file when using - --incremental - * Simple locking for --incremental so mdadm doesn't get - confused when run concurrently with itself. - * Make --incremental cope better with arrays that are being - reshaped. - * Fix autoassemble for stack arrays. -- remove /tmp/mdadm.conf in boot.md (bnc#401138) -* Wed Apr 30 2008 mmarek@suse.cz -- added some fixes from Neil's git repo, fixing bnc#368704 among - others -* Mon Feb 04 2008 mmarek@suse.cz -- correctly display rc_status in boot.md -* Wed Jan 23 2008 mmarek@suse.cz -- fixed auto-assembly part of boot.md - * if /etc/mdadm.conf is empy or only contains whitespace or - comments, no autoassembly is done - * remove /tmp/mdadm.conf even if a directory [#329678] -- dropped mdrun and raidautorun (no longer needed) -* Wed Oct 24 2007 mmarek@suse.cz -- updated to 2.6.4 - * Make "--create --auto=mdp" work for non-standard device names. - * Fix restarting of a 'reshape' if it was stopped in the middle. - * Fix a segfault when using v1 superblock. - * Make --write-mostly effective when re-adding a device to an - array. - * Various minor fixes -- changes in 2.6.3: - * allow --write-behind to be set for --grow. - * When adding new disk to an array, don't reserve so much bitmap - space that the disk cannot store the required data. (Needed - when 1.x array was created with older mdadm). - * When adding a drive that was a little too small, we did not get - the correct error message. - * Make sure that if --assemble find an array in the critical - region of a reshape, and cannot find the critical data to - restart the reshape, it gives an error message. - * Fix segfault with '--detail --export' and non-persistent - superblocks. - * Various manpage updates. - * Improved 'raid4' support (--assemble, --monitor) - * Option parsing fixes w.r.t -a - * Interpret "--assemble --metadata=1" to allow any version 1.x - metadata, and be more specific in the "metadata=" message - printed with --examine --brief - * Fix spare migration in --monitor. -* Fri Jul 27 2007 mmarek@suse.cz -- changes to the init script [#288454] - * don't try to autoassemble if /etc/mdadm.conf exists (even an - empty one) - * ony autoassemble partitions found in /proc/partitions -* Fri Jul 13 2007 mmarek@suse.cz -- updated to 2.6.2 - * --fail detached and --remove faulty can be used to fail and - remove devices that are no longer physically present. - * --export option for --detail or present information in a format - that can be processed by udev. - * fix internal bitmap allocation problems with v1.1, v1.2 - metadata. - * --help now goes to stdout so you can direct it to a pager. - * Various manpage updates. - * Make "--grow --add" for linear arrays really work. - * --auto-detect to trigger in-kernel autodetect. - * Make return code for "--detail --test" more reliable. Missing - devices as well as failed devices cause an error. -- added some fixes from Neil's git repo (mdadm-git-fixes.patch) -* Thu Jun 21 2007 adrian@suse.de -- fix changelog entry order -* Mon Apr 02 2007 mmarek@suse.cz -- updated to 2.6.1 - * --monitor was producing some meaningless warnings due to a bug. - * Fix some compiler warnings. - * Fully support --grow for raid6. If a reshape crashed during - the critical period, mdadm wouldn't restore the Q information - properly. - * Update documentation for --grow. - * Report bitmap status in --detail and --examine - * Default to v1 superblocks instead of v0.90 if the array - is too big for 0.90 to handle. - * Sort the output of "mdadm --detail --scan" so that it is - in a suitable order for assembling arrays. i.e. components come - before an array that they are part of. - * Require bitmap files to have a '/' in their name. - * Rewrite 'reshape' support including performing a backup - of the critical region for a raid5 growth, and restoring that - backup after a crash. - * Put a 'canary' at each end of the backup so a corruption - can be more easily detected. - * Support --backup-file for backing-up critical section during - growth. - * Erase old superblocks (of different versions) when creating new - array. - * Allow --monitor to work with arrays with >28 devices - * Report reshape information in --detail - * Handle symlinks in /dev better - * Fix mess in --detail output which a device is missing. - * Support 'bitmap=' in mdadm.conf for auto-assembling arrays with - write-intent bitmaps in separate files. - * Fix alignment problem in version-1 superblocks. - NOTE: This is an incompatable change affecting raid5 reshape. - If you want to reshape a raid5 using version-1 superblocks, - use 2.6.17-rc2 or later, and mdadm-2.4.1 or later. - * Support 'mailfrom' line in mdadm.conf so the From: line in alert - emails can be explicitly set. - * Arrange that SparesMissing (which is similar in import to - DegradedArray) generates an Email. - * Assume "DEVICE partitions" if no DEVICE line is given. - * Support new 'offset' layout for raid10. - * When creating a bitmap file, choose a chunksize to limit number - of bitmap chunks to 2 million. More than this can cause kmalloc - failure. - * New 'CREATE' line in mdadm.conf for defaults such as owner, group, - mode and auto-flag - * --detail checks if array has been started or not and includes that - in report. - * When using --update=uuid on an array with a bitmap, update the - bitmap's uuid too. - * Add a copy of /proc/mdstat to the mail message sent by mdadm - --monitor. - * New flag --no-degraded to avoid starting arrays if there are - fewer devices available than last time the array was started. - This is only needed with --scan, as with --scan, that behaviour - is the default. - * Support for 'homehost' concept. This is a fairly major update. - It includes a configfile option and a command line option for - specifying a homehost, records that host in the superblock, - and reports the homehost where possible. - * Support for Auto Assembly. "mdadm -As" will, if provided with - the name of a homehost, try to assemble all arrays it can find - that were created for that homehost. See man pages for more details. - * Don't try to create devices with --manage or --grow - * allow default metadata (superblock) type to be specified - in mdadm.conf - * Avoid some misdetection of overlapping partitions - * Add 'Array Slot' line to --examine for version-1 superblocks - to make it a bit easier to see what is happening. - * Work around bug in --add handling for version-1 superblocks - in 2.6.17 (and prior). - * Make -assemble a bit more resilient to finding strange - information in superblocks. - * When creating devices in /dev/md/ create matching symlinks - from /dev. e.g. /dev/md0 -> /dev/md/0. - Allow this to be disabled in mdadm.conf or on command line. - * Allow a number (of partitions) after the 'yes' option to --auto= - This is particularly useful in the 'create' line in mdadm.conf. - * Remove partitions from any whole device that is made part of - an md array. This is a work-around for annoying messages - when the first block on some drive accidentally looks like a - partition table. - * Close stray fd in mdassemble so that it can assemble stacked - devices - * If mdassemble finds an array already assembled, it marks it - read-write. - * Remove error in md_open if array is already active. This isn't - needed and gets in the ways if an array was created e.g. in - initramfs, but device doesn't yet exist in /dev. - * When --assemble --scan is run, if all arrays that could be found - have already been started, don't report an error. - * Allow --assemble --force to mark a raid6 clean when it has two - missing devices (which is needed else if won't assemble. - Without this fix it would only assemble if one or zero - missing devices. - * Support --update=devicesize for cases where the underlying device - can change size. - * Default to --auto=yes so the array devices with 'standard' names - get created automatically, as this is almost always what is wanted. - * Give useful message if raid4/5/6 cannot be started because it is - not clean and is also degraded. - * Increase raid456 stripe cache size if needed to --grow the array. - The setting used unfortunately requires intimate knowledge of the - kernel, and it not reset when the reshape finishes. - * Change 'Device Size' to 'Used Dev Size' because it only shows how - much of each device is actually used, not how big they are. - * --wait or -W will wait for resync activity to finish on the given - devices. - * If two drives in a raid5 disappear at the same time, then "-Af" - will add them both in rather than just one and forcing the array - to 'clean'. This is slightly safer in some cases. - * Don't hold md device open for so long in --monitor mode - map_dev - can be slow and interferes with trying to stop the array. - * Support --uuid= with --create to choose your own UUID. - * New major more "--incremental" for incremental assemble of arrays, - intended for use with udev. - * lots of bugfixes - * manpage updates -* Wed Jan 10 2007 mmarek@suse.cz -- use raidautorun instead of mdrun to autodetect the raid arrays in - boot.md [#230733] -* Wed Nov 08 2006 prusnak@suse.cz -- fixed subscript out of range [#212697] -* Wed Sep 20 2006 mjancar@suse.cz -- update to 2.5.3 - * lots bugfixes - * drop all patches (integrated upstream) -* Fri Jul 28 2006 olh@suse.de -- remove dropped boot.ibmsis from boot.md -- boot.rootfsck should start before boot.md (#181972) -* Fri Jul 21 2006 olh@suse.de -- remove boot.proc from Required-Start: in boot.md (#178753) -* Wed May 03 2006 mjancar@suse.cz -- fix false SparesMissing error (#171326) -* Wed Apr 26 2006 hare@suse.de -- Fix init script dependencies -- Implement MDADM_DEVICE_TIMEOUT to set a timeout for - udevsettle (#149979) -* Tue Apr 25 2006 mjancar@suse.cz -- add static device nodes for udev (#168824) -* Wed Apr 19 2006 mjancar@suse.cz -- set $BOOT_MD_USE_MDADM_CONFIG to "yes" by default (#155120) -* Fri Apr 07 2006 mjancar@suse.cz -- detach mdadmd from tty in rcmdadmd (#160881) -* Mon Apr 03 2006 mjancar@suse.cz -- fix garbled output with --detail (#160827) -- fix fix write-mostly with --add and --re-add (#162968) -* Fri Mar 24 2006 mjancar@suse.cz -- add /sbin/raidautorun (#159460) -* Wed Mar 08 2006 mjancar@suse.cz -- add $BOOT_MD_USE_MDADM_CONFIG sysconfig variable (#155120) -* Thu Feb 09 2006 mjancar@suse.cz -- round free size to chunk size multiply on --create (#148562) -* Tue Feb 07 2006 mjancar@suse.cz -- move boot.multipath to Should-Start instead of Required-Start -* Mon Feb 06 2006 mjancar@suse.cz -- add "Obsoletes: raidtools" -- start boot.md after boot.multipath -- call mdadm without -a from mdrun, an argument is required in 2.2 -* Mon Feb 06 2006 mjancar@suse.de -- don't start mdadmd by default -* Sun Feb 05 2006 mjancar@suse.cz -- include option for email to be sent on start (#142105) -- fix missing md autostart due to raidtools dropped (#148234) - * include mdrun script from Debian - * create boot.md initscipt -* Sun Feb 05 2006 schwab@suse.de -- Fix memset parameters. -* Thu Feb 02 2006 mjancar@suse.cz -- fix segfault on --assemble (#146514) -* Fri Jan 27 2006 mls@suse.de -- converted neededforbuild to BuildRequires -* Wed Jan 25 2006 olh@suse.de -- fix uninitialized variable, memset call and memcmp/memcpy bug - mdadm.bug144647-array.init.patch - mdadm.bug144647-update_super1-memcpy.patch - mdadm.bug144647-add_internal_bitmap0-memcpy.patch -* Wed Jan 11 2006 mjancar@suse.cz -- update ro 2.2 -* Tue Dec 20 2005 ro@suse.de -- at least output errors if they occur (instead of ignoring) -* Wed Nov 30 2005 schwab@suse.de -- Fix broken formats. -* Tue Oct 25 2005 aj@suse.de -- Build with -fno-strict-aliasing. -* Wed Oct 12 2005 mjancar@suse.cz -- update to 2.1 -* Thu Jul 28 2005 anicka@suse.cz -- update to 1.12.0 -* Wed Jun 15 2005 meissner@suse.de -- use RPM_OPT_FLAGS correctly. -* Tue Apr 19 2005 postadal@suse.de -- updated to version 1.11.0 -- fixed for gcc 4.0 -- removed obsoleted patch config-fix -* Wed Mar 30 2005 postadal@suse.cz -- fixed parsing command line option '--config=partions' [#74603] -* Fri Feb 04 2005 postadal@suse.cz -- updated to version 1.9.0 -* Thu Jan 13 2005 postadal@suse.cz -- updated to version 1.8.1 -- extended comment in sysconfig.mdadm [#48567] -* Fri Aug 06 2004 postadal@suse.cz -- updated to version 1.6.0 - * added --auto= and --assume-clean options - * added "degraded" and "recovering" options to the "Status:" entry -* Tue Feb 10 2004 postadal@suse.cz -- updated to version 1.5.0 - * new commands "mdassemble" - * support for raid6 as found in 2.6.2 - * support partitioned md arrays with a different major number and - naming scheme - * added "SparesMissing" event when --monitor first sees an array and - it doesn't have the enough spare devices. -* Sun Jan 11 2004 adrian@suse.de -- add %%defattr -* Mon Dec 01 2003 fehr@suse.de -- fix quoting problem in start script (#33392) -* Fri Aug 29 2003 fehr@suse.de -- add PreReq for fillup -* Tue Aug 26 2003 fehr@suse.de -- add %%stop_on_removal and %%restart_on_update -* Thu Aug 14 2003 fehr@suse.de -- add missing activation metadata in sysconfig (#28901) -* Tue Jul 29 2003 fehr@suse.de -- update to new version 1.3.0 of package -* Mon Apr 14 2003 postadal@suse.cz -- fixed init script (added return value for unimplemented reload function) -* Mon Mar 31 2003 postadal@suse.cz -- added buildroot, init script, sysconfig -- bzip2 sources and cleaned specfile -* Thu Mar 20 2003 fehr@suse.de -- update to version 1.2.0 of package -* Mon Mar 03 2003 fehr@suse.de -- update to version 1.1.0 of package -* Mon Dec 02 2002 fehr@suse.de -- Fix for new glibc/gcc -* Tue Sep 17 2002 ro@suse.de -- removed bogus self-provides -* Fri Sep 13 2002 lmb@suse.de -- Fix for 64bit arch; ioctl returns long instead of int (#20339) -* Fri Aug 23 2002 lmb@suse.de -- Multipath arrays can now be build manually even without a superblock. -- One debugging chunk removed from patch. -* Tue Aug 13 2002 lmb@suse.de -- Fix for the assembly of multipath arrays. -* Mon Aug 12 2002 lmb@suse.de -- Added patch to support the enhanced multipath features. -* Mon Aug 05 2002 fehr@suse.de -- make SuSE package from version 1.0.1 of mdadm diff --git a/mdmon-ia64-clone.patch b/mdmon-ia64-clone.patch deleted file mode 100644 index 9656032..0000000 --- a/mdmon-ia64-clone.patch +++ /dev/null @@ -1,35 +0,0 @@ -ia64 has __clone2 instead of clone() ---- - mdmon.c | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -Index: mdmon.c -=================================================================== ---- mdmon.c.orig -+++ mdmon.c -@@ -79,13 +79,25 @@ int run_child(void *v) - return 0; - } - -+#ifdef __ia64__ -+int __clone2(int (*fn)(void *), -+ void *child_stack_base, size_t stack_size, -+ int flags, void *arg, ... -+ /* pid_t *pid, struct user_desc *tls, pid_t *ctid */ ); -+#endif - int clone_monitor(struct supertype *container) - { - static char stack[4096]; - -+#ifdef __ia64__ -+ mon_tid = __clone2(run_child, stack, sizeof(stack), -+ CLONE_FS|CLONE_FILES|CLONE_VM|CLONE_SIGHAND|CLONE_THREAD, -+ container); -+#else - mon_tid = clone(run_child, stack+4096-64, - CLONE_FS|CLONE_FILES|CLONE_VM|CLONE_SIGHAND|CLONE_THREAD, - container); -+#endif - - mgr_tid = syscall(SYS_gettid); - diff --git a/mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch b/mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch deleted file mode 100644 index 1337527..0000000 --- a/mdmon-pass-symbolic-name-to-mdmon-instead-of-device.patch +++ /dev/null @@ -1,138 +0,0 @@ -From b6e15d73b19d963de7412560cc651e3b6d6a5428 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Thu, 20 Nov 2008 14:51:42 +1100 -Subject: [PATCH] mdmon: pass symbolic name to mdmon instead of device name. - -Now that names in /dev are usually created (eventually) by udev, -it isn't really safe to rely in finding a name in /dev to pass to -mdmon to identify which array to monitor. -And it isn't really necessary to have a name in /dev. -So just pass the symbolic name, e.g. md127 or md123. - -Change util.c to pass that name, and change mdmon to process the -name sensibly. - -Signed-off-by: NeilBrown ---- - mdadm.h | 2 +- - mdmon.c | 17 +++++++++++++---- - monitor.c | 2 +- - util.c | 13 ++++++++++--- - 4 files changed, 25 insertions(+), 9 deletions(-) - -diff --git a/mdadm.h b/mdadm.h -index 9d819f9..2772650 100644 ---- a/mdadm.h -+++ b/mdadm.h -@@ -634,7 +634,6 @@ struct supertype { - * external:/md0/12 - */ - int devcnt; -- char *device_name; /* e.g. /dev/md/whatever */ - - struct mdinfo *devs; - -@@ -761,6 +760,7 @@ extern int check_raid(int fd, char *name); - - extern int get_mdp_major(void); - extern int dev_open(char *dev, int flags); -+extern int open_dev(int devnum); - extern int open_dev_excl(int devnum); - extern int is_standard(char *dev, int *nump); - extern int same_dev(char *one, char *two); -diff --git a/mdmon.c b/mdmon.c -index 5ee8346..73c244a 100644 ---- a/mdmon.c -+++ b/mdmon.c -@@ -287,6 +287,8 @@ int main(int argc, char *argv[]) - int ignore; - char *container_name = NULL; - char *switchroot = NULL; -+ int devnum; -+ char *devname; - - switch (argc) { - case 2: -@@ -304,7 +306,14 @@ int main(int argc, char *argv[]) - usage(); - } - -- mdfd = open(container_name, O_RDWR); -+ devnum = devname2devnum(container_name); -+ devname = devnum2devname(devnum); -+ if (strcmp(container_name, devname) != 0) { -+ fprintf(stderr, "mdmon: %s is not a valid md device name\n", -+ container_name); -+ exit(1); -+ } -+ mdfd = open_dev(devnum); - if (mdfd < 0) { - fprintf(stderr, "mdmon: %s: %s\n", container_name, - strerror(errno)); -@@ -342,9 +351,8 @@ int main(int argc, char *argv[]) - pfd[0] = pfd[1] = -1; - - container = malloc(sizeof(*container)); -- container->devnum = fd2devnum(mdfd); -- container->devname = devnum2devname(container->devnum); -- container->device_name = container_name; -+ container->devnum = devnum; -+ container->devname = devname; - container->arrays = NULL; - - if (!container->devname) { -@@ -462,6 +470,7 @@ int main(int argc, char *argv[]) - container_name); - exit(3); - } -+ close(mdfd); - - /* Ok, this is close enough. We can say goodbye to our parent now. - */ -diff --git a/monitor.c b/monitor.c -index 15791f4..5c17910 100644 ---- a/monitor.c -+++ b/monitor.c -@@ -469,7 +469,7 @@ static int wait_and_act(struct supertype *container, int nowait) - * problem as there are no active arrays, there is - * nothing that we need to be ready to do. - */ -- int fd = open(container->device_name, O_RDONLY|O_EXCL); -+ int fd = open_dev_excl(container->devnum); - if (fd >= 0 || errno != EBUSY) { - /* OK, we are safe to leave */ - if (sigterm && !dirty_arrays) -diff --git a/util.c b/util.c -index 2b4f902..d7597fa 100644 ---- a/util.c -+++ b/util.c -@@ -813,6 +813,14 @@ int dev_open(char *dev, int flags) - return fd; - } - -+int open_dev(int devnum) -+{ -+ char buf[20]; -+ -+ sprintf(buf, "%d:%d", dev2major(devnum), dev2minor(devnum)); -+ return dev_open(buf, O_RDWR); -+} -+ - int open_dev_excl(int devnum) - { - char buf[20]; -@@ -1261,9 +1269,8 @@ int start_mdmon(int devnum) - for (i=0; paths[i]; i++) - if (paths[i][0]) - execl(paths[i], "mdmon", -- map_dev(dev2major(devnum), -- dev2minor(devnum), -- 1), NULL); -+ devnum2devname(devnum), -+ NULL); - exit(1); - case -1: fprintf(stderr, Name ": cannot run mdmon. " - "Array remains readonly\n"); --- -1.5.6.5 - diff --git a/name.fixes.patch b/name.fixes.patch deleted file mode 100644 index 181d50a..0000000 --- a/name.fixes.patch +++ /dev/null @@ -1,62 +0,0 @@ -Two patches fixing issues with device naming. - -commit bf68e9d9ab185121b6004fc81b531bce8348726d -Author: Dan Williams -Date: Mon Nov 10 09:30:07 2008 -0700 - - fix add_dev() handling of broken links - - Resolves issues like: - mdadm -Ss - mdadm: unable to open /dev/md/r1: No such file or directory - - ...where /dev/md/r1 points to a removed device. - - Signed-off-by: Dan Williams - -commit ef70b9f4ef7a3a9f70b3a09b3a55b1cc675c0a37 -Author: Dan Williams -Date: Sat Nov 8 16:03:07 2008 -0700 - - fix remove_devices() - - Don't write to 'pe' if 'path' was not specified - - Signed-off-by: Dan Williams -diff --git a/Manage.c b/Manage.c -index 06f9e05..85bb2c8 100644 ---- a/Manage.c -+++ b/Manage.c -@@ -150,10 +150,12 @@ static void remove_devices(int devnum, char *path) - for (part = 0; part < 16; part++) { - if (part) { - sprintf(be, "p%d", part); -- if (isdigit(pe[-1])) -- sprintf(pe, "p%d", part); -- else -- sprintf(pe, "%d", part); -+ if (path) { -+ if (isdigit(pe[-1])) -+ sprintf(pe, "p%d", part); -+ else -+ sprintf(pe, "%d", part); -+ } - } - /* FIXME test if really is md device ?? */ - unlink(base); -diff --git a/util.c b/util.c -index f21d2bb..2b4f902 100644 ---- a/util.c -+++ b/util.c -@@ -467,8 +467,10 @@ int devlist_ready = 0; - int add_dev(const char *name, const struct stat *stb, int flag, struct FTW *s) - { - struct stat st; -+ - if (S_ISLNK(stb->st_mode)) { -- stat(name, &st); -+ if (stat(name, &st) != 0) -+ return 0; - stb = &st; - } - diff --git a/super-intel-undefined-operation.patch b/super-intel-undefined-operation.patch deleted file mode 100644 index bef7b9c..0000000 --- a/super-intel-undefined-operation.patch +++ /dev/null @@ -1,26 +0,0 @@ -super-intel.c:284: warning: operation on 'p' may be undefined -super-intel.c:284: warning: operation on 'p' may be undefined -super-intel.c:284: warning: operation on 'p' may be undefined - -The swap macros can evaluate their argument multiple times. ---- - super-intel.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -Index: super-intel.c -=================================================================== ---- super-intel.c.orig -+++ super-intel.c -@@ -271,8 +271,10 @@ static __u32 __gen_imsm_checksum(struct - __u32 *p = (__u32 *) mpb; - __u32 sum = 0; - -- while (end--) -- sum += __le32_to_cpu(*p++); -+ while (end--) { -+ sum += __le32_to_cpu(*p); -+ p++; -+ } - - return sum - __le32_to_cpu(mpb->check_sum); - } diff --git a/super0-Do-all-metadata-IO-with-4096byte-alignment.patch b/super0-Do-all-metadata-IO-with-4096byte-alignment.patch deleted file mode 100644 index bebc318..0000000 --- a/super0-Do-all-metadata-IO-with-4096byte-alignment.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 24303a80dfff51654595b3605fa8b1b9b1c4b578 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Tue, 3 Mar 2009 14:25:59 +1100 -Subject: [PATCH 1/2] super0: Do all metadata IO with 4096byte alignment - -.. because some devices (dasd) has 4096 byte sector size. - -As the superblock is 4096 bytes and the bitmap is in a -60K region, this is safe from any possible corruption. - -Signed-off-by: NeilBrown ---- - super0.c | 25 ++++++++++++++----------- - 1 files changed, 14 insertions(+), 11 deletions(-) - -Index: mdadm-3.0-devel2/super0.c -=================================================================== ---- mdadm-3.0-devel2.orig/super0.c -+++ mdadm-3.0-devel2/super0.c -@@ -545,7 +545,8 @@ static int init_super0(struct supertype - mdp_super_t *sb; - int spares; - -- if (posix_memalign((void**)&sb, 512, MD_SB_BYTES + sizeof(bitmap_super_t)) != 0) { -+ if (posix_memalign((void**)&sb, 4096, -+ MD_SB_BYTES + ROUND_UP(sizeof(bitmap_super_t), 4096)) != 0) { - fprintf(stderr, Name ": %s could not allocate superblock\n", __func__); - return 0; - } -@@ -680,8 +681,8 @@ static int store_super0(struct supertype - if (super->state & (1<magic) == BITMAP_MAGIC) -- if (write(fd, bm, ROUND_UP(sizeof(*bm),512)) != -- ROUND_UP(sizeof(*bm),512)) -+ if (write(fd, bm, ROUND_UP(sizeof(*bm),4096)) != -+ ROUND_UP(sizeof(*bm),4096)) - return 5; - } - -@@ -741,8 +742,9 @@ static int compare_super0(struct superty - if (second->md_magic != MD_SB_MAGIC) - return 1; - if (!first) { -- if (posix_memalign((void**)&first, 512, -- MD_SB_BYTES + sizeof(struct bitmap_super_s)) != 0) { -+ if (posix_memalign((void**)&first, 4096, -+ MD_SB_BYTES + -+ ROUND_UP(sizeof(struct bitmap_super_s), 4096)) != 0) { - fprintf(stderr, Name - ": %s could not allocate superblock\n", __func__); - return 1; -@@ -815,8 +817,9 @@ static int load_super0(struct supertype - return 1; - } - -- if (posix_memalign((void**)&super, 512, -- MD_SB_BYTES + sizeof(bitmap_super_t)+512) != 0) { -+ if (posix_memalign((void**)&super, 4096, -+ MD_SB_BYTES + -+ ROUND_UP(sizeof(bitmap_super_t), 4096)) != 0) { - fprintf(stderr, Name - ": %s could not allocate superblock\n", __func__); - return 1; -@@ -864,8 +867,8 @@ static int load_super0(struct supertype - * valid. If it doesn't clear the bit. An --assemble --force - * should get that written out. - */ -- if (read(fd, super+1, ROUND_UP(sizeof(struct bitmap_super_s),512)) -- != ROUND_UP(sizeof(struct bitmap_super_s),512)) -+ if (read(fd, super+1, ROUND_UP(sizeof(struct bitmap_super_s),4096)) -+ != ROUND_UP(sizeof(struct bitmap_super_s),4096)) - goto no_bitmap; - - uuid_from_super0(st, uuid); -@@ -996,8 +999,8 @@ static int write_bitmap0(struct supertyp - int rv = 0; - - int towrite, n; -- char abuf[4096+512]; -- char *buf = (char*)(((long)(abuf+512))&~511UL); -+ char abuf[4096+4096]; -+ char *buf = (char*)(((long)(abuf+4096))&~4095L); - - if (!get_dev_size(fd, NULL, &dsize)) - return 1; diff --git a/super1-do-metadata-IO-in-sector_size-units.patch b/super1-do-metadata-IO-in-sector_size-units.patch deleted file mode 100644 index c7d7163..0000000 --- a/super1-do-metadata-IO-in-sector_size-units.patch +++ /dev/null @@ -1,137 +0,0 @@ -From ae8b146d524dd162f159f27938ed14df037e3ff8 Mon Sep 17 00:00:00 2001 -From: NeilBrown -Date: Tue, 3 Mar 2009 15:44:26 +1100 -Subject: [PATCH 2/2] super1 - do metadata IO in sector_size units. - -If the sector size is > 512, we need to be more careful about -alignment. -The largest known sector size is 4096 and (fortunately) both the -superblock and (in many cases) the bitmap are 4096-byte aligned. -So there should be no data-overlap problems. - -The exception is when the bitmap is squeezed into the 3K after the -superblock. This arrangement cannot currently be supported on -4K sector-size devices. - -Signed-off-by: NeilBrown ---- - super1.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------ - 1 files changed, 64 insertions(+), 7 deletions(-) - -Index: mdadm-3.0-devel2/super1.c -=================================================================== ---- mdadm-3.0-devel2.orig/super1.c -+++ mdadm-3.0-devel2/super1.c -@@ -141,6 +141,64 @@ static unsigned int calc_sb_1_csum(struc - return __cpu_to_le32(csum); - } - -+static char abuf[4096+4096]; -+static int aread(int fd, void *buf, int len) -+{ -+ /* aligned read. -+ * On devices with a 4K sector size, we need to read -+ * the full sector and copy relevant bits into -+ * the buffer -+ */ -+ int bsize; -+ char *b; -+ int n; -+ if (ioctl(fd, BLKSSZGET, &bsize) != 0 || -+ bsize <= len) -+ return read(fd, buf, len); -+ if (bsize > 4096) -+ return -1; -+ b = (char*)(((long)(abuf+4096))&~4095UL); -+ -+ n = read(fd, b, bsize); -+ if (n <= 0) -+ return n; -+ lseek(fd, len - n, 1); -+ if (n > len) -+ n = len; -+ memcpy(buf, b, n); -+ return n; -+} -+ -+static int awrite(int fd, void *buf, int len) -+{ -+ /* aligned write. -+ * On devices with a 4K sector size, we need to write -+ * the full sector. We pre-read if the sector is larger -+ * than the write. -+ * The address must be sector-aligned. -+ */ -+ int bsize; -+ char *b; -+ int n; -+ if (ioctl(fd, BLKSSZGET, &bsize) != 0 || -+ bsize <= len) -+ return write(fd, buf, len); -+ if (bsize > 4096) -+ return -1; -+ b = (char*)(((long)(abuf+4096))&~4095UL); -+ -+ n = read(fd, b, bsize); -+ if (n <= 0) -+ return n; -+ lseek(fd, -n, 1); -+ memcpy(b, buf, len); -+ n = write(fd, b, bsize); -+ if (n <= 0) -+ return n; -+ lseek(fd, len - n, 1); -+ return len; -+} -+ - #ifndef MDASSEMBLE - static void examine_super1(struct supertype *st, char *homehost) - { -@@ -881,7 +939,7 @@ static int store_super1(struct supertype - sbsize = sizeof(*sb) + 2 * __le32_to_cpu(sb->max_dev); - sbsize = (sbsize+511)&(~511UL); - -- if (write(fd, sb, sbsize) != sbsize) -+ if (awrite(fd, sb, sbsize) != sbsize) - return 4; - - if (sb->feature_map & __cpu_to_le32(MD_FEATURE_BITMAP_OFFSET)) { -@@ -889,8 +947,8 @@ static int store_super1(struct supertype - (((char*)sb)+1024); - if (__le32_to_cpu(bm->magic) == BITMAP_MAGIC) { - locate_bitmap1(st, fd); -- if (write(fd, bm, ROUND_UP(sizeof(*bm),512)) != -- ROUND_UP(sizeof(*bm),512)) -+ if (awrite(fd, bm, sizeof(*bm)) != -+ sizeof(*bm)) - return 5; - } - } -@@ -1187,7 +1245,7 @@ static int load_super1(struct supertype - return 1; - } - -- if (read(fd, super, 1024) != 1024) { -+ if (aread(fd, super, 1024) != 1024) { - if (devname) - fprintf(stderr, Name ": Cannot read superblock on %s\n", - devname); -@@ -1232,7 +1290,7 @@ static int load_super1(struct supertype - * should get that written out. - */ - locate_bitmap1(st, fd); -- if (read(fd, ((char*)super)+1024, 512) -+ if (aread(fd, ((char*)super)+1024, 512) - != 512) - goto no_bitmap; - -@@ -1470,8 +1528,7 @@ static int write_bitmap1(struct supertyp - int rv = 0; - - int towrite, n; -- char abuf[4096+512]; -- char *buf = (char*)(((long)(abuf+512))&~511UL); -+ char *buf = (char*)(((long)(abuf+4096))&~4095UL); - - locate_bitmap1(st, fd); -