]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-intel.c
mdadm.h: include sysmacros.h unconditionally
[thirdparty/mdadm.git] / super-intel.c
index 5a7c9f8062e020e84ef10e6eab3ff660912a284d..d7e8a65fddba944b8631f57ddd50fc155f3e7c0b 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",
@@ -7455,9 +7455,8 @@ static int validate_geometry_imsm(struct supertype *st, int level, int layout,
                                                        verbose);
        }
 
-       if (size && ((size < 1024) || (*chunk != UnSet &&
-           size < (unsigned long long) *chunk))) {
-               pr_err("Given size must be greater than 1M and chunk size.\n");
+       if (size && (size < 1024)) {
+               pr_err("Given size must be greater than 1M.\n");
                /* Depends on algorithm in Create.c :
                 * if container was given (dev == NULL) return -1,
                 * if block device was given ( dev != NULL) return 0.
@@ -8561,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++;
        }