]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Remove all "if zeros"
authorMateusz Kusiak <mateusz.kusiak@intel.com>
Mon, 18 Dec 2023 15:03:51 +0000 (16:03 +0100)
committerMariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Tue, 19 Dec 2023 16:03:32 +0000 (17:03 +0100)
No more random encounters of "if zeros".
Remove all "if 0" code blocks.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@intel.com>
Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com>
Assemble.c
Detail.c
super-intel.c
super1.c
sysfs.c

index 0557a007ef4cd93fb235be8d1bf6b537bb204a56..0879c2ed547308ff745cf01004c9b5e32a31d676 100644 (file)
@@ -1806,12 +1806,6 @@ try_again:
                                               i, mddev, devices[j].devname);
                        }
                }
-#if 0
-               if (!(super.disks[i].i.disk.state & (1 << MD_DISK_FAULTY))) {
-                       pr_err("devices %d of %s is not marked FAULTY in superblock, but cannot be found\n",
-                              i, mddev);
-               }
-#endif
        }
        if (c->force && !clean && !is_container(content->array.level) &&
            !enough(content->array.level, content->array.raid_disks,
index 57ac336fc31223de45103aa464e2c3151b754ae9..aaa3dd6e0ee7f1d7e3e78c086db6e0a0b3f31c9e 100644 (file)
--- a/Detail.c
+++ b/Detail.c
@@ -603,13 +603,6 @@ int Detail(char *dev, struct context *c)
                }
 
                if ((st && st->sb) && (info && info->reshape_active)) {
-#if 0
-This is pretty boring
-                       printf("     Reshape pos'n : %llu%s\n",
-                              (unsigned long long) info->reshape_progress << 9,
-                              human_size((unsigned long long)
-                                         info->reshape_progress << 9));
-#endif
                        if (info->delta_disks != 0)
                                printf("     Delta Devices : %d, (%d->%d)\n",
                                       info->delta_disks,
index 6bdd5c4cf64df843c9cd4581abc79e93b78b8a33..efac07d59c53b58d73105a8acbe431be2be2e02e 100644 (file)
@@ -2976,34 +2976,6 @@ static void uuid_from_super_imsm(struct supertype *st, int uuid[4])
        memcpy(uuid, buf, 4*4);
 }
 
-#if 0
-static void
-get_imsm_numerical_version(struct imsm_super *mpb, int *m, int *p)
-{
-       __u8 *v = get_imsm_version(mpb);
-       __u8 *end = mpb->sig + MAX_SIGNATURE_LENGTH;
-       char major[] = { 0, 0, 0 };
-       char minor[] = { 0 ,0, 0 };
-       char patch[] = { 0, 0, 0 };
-       char *ver_parse[] = { major, minor, patch };
-       int i, j;
-
-       i = j = 0;
-       while (*v != '\0' && v < end) {
-               if (*v != '.' && j < 2)
-                       ver_parse[i][j++] = *v;
-               else {
-                       i++;
-                       j = 0;
-               }
-               v++;
-       }
-
-       *m = strtol(minor, NULL, 0);
-       *p = strtol(patch, NULL, 0);
-}
-#endif
-
 static __u32 migr_strip_blocks_resync(struct imsm_dev *dev)
 {
        /* migr_strip_size when repairing or initializing parity */
index 1da71b98d29eb3503a72df96afee849dbe20c50f..dfde4629508b1354dba59e719ccc5050cd88032b 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -544,26 +544,6 @@ static void examine_super1(struct supertype *st, char *homehost)
                break;
        }
        printf("\n");
-#if 0
-       /* This turns out to just be confusing */
-       printf("    Array Slot : %d (", __le32_to_cpu(sb->dev_number));
-       for (i = __le32_to_cpu(sb->max_dev); i > 0 ; i--)
-               if (__le16_to_cpu(sb->dev_roles[i-1]) != MD_DISK_ROLE_SPARE)
-                       break;
-       for (d = 0; d < i; d++) {
-               int role = __le16_to_cpu(sb->dev_roles[d]);
-               if (d)
-                       printf(", ");
-               if (role == MD_DISK_ROLE_SPARE)
-                       printf("empty");
-               else
-                       if(role == MD_DISK_ROLE_FAULTY)
-                               printf("failed");
-                       else
-                               printf("%d", role);
-       }
-       printf(")\n");
-#endif
        printf("   Device Role : ");
        role = role_from_sb(sb);
        if (role >= MD_DISK_ROLE_FAULTY)
diff --git a/sysfs.c b/sysfs.c
index 94d02f53a768e64b883ab76f07d1ee9729ea54af..decb02b8d80f08b2c7e7f3e409c64e094c283472 100644 (file)
--- a/sysfs.c
+++ b/sysfs.c
@@ -803,72 +803,6 @@ int sysfs_add_disk(struct mdinfo *sra, struct mdinfo *sd, int resume)
        return rv;
 }
 
-#if 0
-int sysfs_disk_to_sg(int fd)
-{
-       /* from an open block device, try find and open its corresponding
-        * scsi_generic interface
-        */
-       struct stat st;
-       char path[256];
-       char sg_path[256];
-       char sg_major_minor[10];
-       char *c;
-       DIR *dir;
-       struct dirent *de;
-       int major, minor, rv;
-
-       if (fstat(fd, &st))
-               return -1;
-
-       snprintf(path, sizeof(path), "/sys/dev/block/%d:%d/device",
-                major(st.st_rdev), minor(st.st_rdev));
-
-       dir = opendir(path);
-       if (!dir)
-               return -1;
-
-       de = readdir(dir);
-       while (de) {
-               if (strncmp("scsi_generic:", de->d_name,
-                           strlen("scsi_generic:")) == 0)
-                       break;
-               de = readdir(dir);
-       }
-       closedir(dir);
-
-       if (!de)
-               return -1;
-
-       snprintf(sg_path, sizeof(sg_path), "%s/%s/dev", path, de->d_name);
-       fd = open(sg_path, O_RDONLY);
-       if (fd < 0)
-               return fd;
-
-       rv = read(fd, sg_major_minor, sizeof(sg_major_minor));
-       close(fd);
-       if (rv < 0 || rv == sizeof(sg_major_minor))
-               return -1;
-       else
-               sg_major_minor[rv - 1] = '\0';
-
-       c = strchr(sg_major_minor, ':');
-       *c = '\0';
-       c++;
-       major = strtol(sg_major_minor, NULL, 10);
-       minor = strtol(c, NULL, 10);
-       snprintf(path, sizeof(path), "/dev/.tmp.md.%d:%d:%d",
-                (int) getpid(), major, minor);
-       if (mknod(path, S_IFCHR|0600, makedev(major, minor))==0) {
-                       fd = open(path, O_RDONLY);
-                       unlink(path);
-                       return fd;
-       }
-
-       return -1;
-}
-#endif
-
 int sysfs_disk_to_scsi_id(int fd, __u32 *id)
 {
        /* from an open block device, try to retrieve it scsi_id */