]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Monitor/check_array: Declate mdinfo instance globally
authorJes Sorensen <jsorensen@fb.com>
Tue, 9 May 2017 20:41:06 +0000 (16:41 -0400)
committerJes Sorensen <jsorensen@fb.com>
Tue, 9 May 2017 20:41:06 +0000 (16:41 -0400)
We can pull in more information from sysfs earlier, so move sra to the top.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Monitor.c

index c5198775ef17311b6bf7915b9f01a44f024f6454..bb3a2c4b4865917b911bf308d3d41326ae63eb31 100644 (file)
--- a/Monitor.c
+++ b/Monitor.c
@@ -451,6 +451,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
         * '1' if the array is degraded, or '0' if it is optimal (or dead).
         */
        struct { int state, major, minor; } info[MAX_DISKS];
+       struct mdinfo *sra;
        mdu_array_info_t array;
        struct mdstat_ent *mse = NULL, *mse2;
        char *dev = st->devname;
@@ -556,8 +557,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
                 * If there is a number in /mismatch_cnt,
                 * we should report that.
                 */
-               struct mdinfo *sra =
-                       sysfs_read(-1, st->devnm, GET_MISMATCH);
+               sra = sysfs_read(-1, st->devnm, GET_MISMATCH);
                if (sra && sra->mismatch_cnt > 0) {
                        char cnt[80];
                        snprintf(cnt, sizeof(cnt),