From: Shaohua Li Date: Wed, 2 Sep 2015 20:49:50 +0000 (-0700) Subject: md: skip resync for raid array with journal X-Git-Tag: firefly_0821_release~176^2~806^2~25 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=bd18f6462f3d167a9b3ec27851c98f82694b2adf;p=firefly-linux-kernel-4.4.55.git md: skip resync for raid array with journal If a raid array has journal, the journal can guarantee the consistency, we can skip resync after a unclean shutdown. The exception is raid creation or user initiated resync, which we still do a raid resync. Signed-off-by: Shaohua Li Signed-off-by: NeilBrown --- diff --git a/drivers/md/md.c b/drivers/md/md.c index 3592beb6931e..89149acd8a5e 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -1647,6 +1647,8 @@ static int super_1_validate(struct mddev *mddev, struct md_rdev *rdev) } set_bit(Journal, &rdev->flags); rdev->journal_tail = le64_to_cpu(sb->journal_tail); + if (mddev->recovery_cp == MaxSector) + set_bit(MD_JOURNAL_CLEAN, &mddev->flags); break; default: rdev->saved_raid_disk = role; @@ -1689,6 +1691,8 @@ static void super_1_sync(struct mddev *mddev, struct md_rdev *rdev) sb->events = cpu_to_le64(mddev->events); if (mddev->in_sync) sb->resync_offset = cpu_to_le64(mddev->recovery_cp); + else if (test_bit(MD_JOURNAL_CLEAN, &mddev->flags)) + sb->resync_offset = cpu_to_le64(MaxSector); else sb->resync_offset = cpu_to_le64(0); diff --git a/drivers/md/md.h b/drivers/md/md.h index 2b0f62fb6146..e14e667a20e9 100644 --- a/drivers/md/md.h +++ b/drivers/md/md.h @@ -232,6 +232,7 @@ struct mddev { #define MD_STILL_CLOSED 4 /* If set, then array has not been opened since * md_ioctl checked on it. */ +#define MD_JOURNAL_CLEAN 5 /* A raid with journal is already clean */ int suspended; atomic_t active_io;