]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-intel.c
mdadm: Introduce new array state 'broken' for raid0/linear
[thirdparty/mdadm.git] / super-intel.c
index 2ba045aa3c396f9316f5f2a1bc8ac9b5ca71dde2..a103a3fc0cdd6a32898e85f5c44de8a27c6b1552 100644 (file)
@@ -1165,12 +1165,12 @@ static int count_memberships(struct dl *dl, struct intel_super *super)
 
 static __u32 imsm_min_reserved_sectors(struct intel_super *super);
 
-static int split_ull(unsigned long long n, __u32 *lo, __u32 *hi)
+static int split_ull(unsigned long long n, void *lo, void *hi)
 {
        if (lo == 0 || hi == 0)
                return 1;
-       *lo = __le32_to_cpu((unsigned)n);
-       *hi = __le32_to_cpu((unsigned)(n >> 32));
+       __put_unaligned32(__cpu_to_le32((__u32)n), lo);
+       __put_unaligned32(__cpu_to_le32((n >> 32)), hi);
        return 0;
 }
 
@@ -2875,7 +2875,7 @@ static unsigned long long calc_component_size(struct imsm_map *map,
 {
        unsigned long long component_size;
        unsigned long long dev_size = imsm_dev_size(dev);
-       unsigned long long calc_dev_size = 0;
+       long long calc_dev_size = 0;
        unsigned int member_disks = imsm_num_data_members(map);
 
        if (member_disks == 0)
@@ -2889,7 +2889,7 @@ static unsigned long long calc_component_size(struct imsm_map *map,
         * 2048 blocks per each device. If the difference is higher it means
         * that array size was expanded and num_data_stripes was not updated.
         */
-       if ((unsigned int)abs(calc_dev_size - dev_size) >
+       if (llabs(calc_dev_size - (long long)dev_size) >
            (1 << SECT_PER_MB_SHIFT) * member_disks) {
                component_size = dev_size / member_disks;
                dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n",
@@ -8560,7 +8560,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 */
-       if (state & DS_FAULTY) {
+       if (disk && (state & DS_FAULTY)) {
                if (mark_failure(super, dev, disk, ord_to_idx(ord)))
                        super->updates_pending++;
        }
@@ -9200,6 +9200,9 @@ static int add_remove_disk_update(struct intel_super *super)
                                        remove_disk_super(super,
                                                          disk_cfg->major,
                                                          disk_cfg->minor);
+                               } else {
+                                       disk_cfg->fd = disk->fd;
+                                       disk->fd = -1;
                                }
                        }
                        /* release allocate disk structure */