From dc50fd2c544d1fa67b1c48ede2bf216877c36fb5 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sun, 5 Jan 2003 03:46:02 -0800 Subject: [PATCH] md: Record location of incomplete resync at shutdown and restart from there. Add a new field to the md superblock, in an used area, to record where resync was up-to on a clean shutdown while resync is active. Restart from this point. The extra field is verified by having a second copy of the event counter. If the second event counter is wrong, we ignore the extra field. This patch thanks to Angus Sawyer --- include/linux/raid/md_k.h | 5 ++++- include/linux/raid/md_p.h | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'include/linux/raid') diff --git a/include/linux/raid/md_k.h b/include/linux/raid/md_k.h index f658735d28b2..d6f2928fc8c7 100644 --- a/include/linux/raid/md_k.h +++ b/include/linux/raid/md_k.h @@ -28,6 +28,8 @@ #define LEVEL_MULTIPATH (-4) #define LEVEL_LINEAR (-1) +#define MaxSector (~(sector_t)0) + static inline int pers_to_level (int pers) { switch (pers) { @@ -198,7 +200,6 @@ struct mddev_s int level, layout; int raid_disks; int max_disks; - unsigned long state; sector_t size; /* used size of component devices */ __u64 events; @@ -215,6 +216,7 @@ struct mddev_s * it can only be set > 0 under reconfig_sem */ int recovery_running; + int recovery_error; /* error from recovery write */ int in_sync; /* know to not need resync */ struct semaphore reconfig_sem; atomic_t active; @@ -226,6 +228,7 @@ struct mddev_s atomic_t recovery_active; /* blocks scheduled, but not written */ wait_queue_head_t recovery_wait; + sector_t recovery_cp; request_queue_t queue; /* for plugging ... */ diff --git a/include/linux/raid/md_p.h b/include/linux/raid/md_p.h index d6bb37a810b3..cb002ba3556f 100644 --- a/include/linux/raid/md_p.h +++ b/include/linux/raid/md_p.h @@ -131,11 +131,16 @@ typedef struct mdp_superblock_s { #ifdef __BIG_ENDIAN __u32 events_hi; /* 7 high-order of superblock update count */ __u32 events_lo; /* 8 low-order of superblock update count */ + __u32 cp_events_hi; /* 9 high-order of checkpoint update count */ + __u32 cp_events_lo; /* 10 low-order of checkpoint update count */ #else __u32 events_lo; /* 7 low-order of superblock update count */ __u32 events_hi; /* 8 high-order of superblock update count */ + __u32 cp_events_lo; /* 9 low-order of checkpoint update count */ + __u32 cp_events_hi; /* 10 high-order of checkpoint update count */ #endif - __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 9]; + __u32 recovery_cp; /* 11 recovery checkpoint sector count */ + __u32 gstate_sreserved[MD_SB_GENERIC_STATE_WORDS - 12]; /* * Personality information -- cgit v1.2.3