]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - Incremental.c
mdadm: set journal_clean after scanning all disks
[thirdparty/mdadm.git] / Incremental.c
index 6cf217420e8e0e01c8a9e18a6751db322b96bf18..91301eb5e60997a18333f523bd48fd979e069b8e 100644 (file)
@@ -684,6 +684,7 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
        int cnt = 0;
        int replcnt = 0;
        __u64 max_events = 0;
+       __u64 max_journal_events = 0;
        char *avail = NULL;
        int *best = NULL;
        char *devmap = NULL;
@@ -714,8 +715,9 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
 
                info.array.raid_disks = raid_disks;
                st->ss->getinfo_super(st, &info, devmap + raid_disks * devnum);
-               if (info.disk.raid_disk == MD_DISK_ROLE_JOURNAL)
-                       bestinfo->journal_clean = 1;
+               if (info.disk.raid_disk == MD_DISK_ROLE_JOURNAL &&
+                   info.events > max_journal_events)
+                       max_journal_events = info.events;
                if (!avail) {
                        raid_disks = info.array.raid_disks;
                        avail = xcalloc(raid_disks, 1);
@@ -765,6 +767,8 @@ static int count_active(struct supertype *st, struct mdinfo *sra,
                        replcnt++;
                st->ss->free_super(st);
        }
+       if (max_journal_events >= max_events - 1)
+               bestinfo->journal_clean = 1;
 
        if (!avail)
                return 0;