Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 197511
b: refs/heads/master
c: a8707c0
h: refs/heads/master
i:
  197509: 6b8c5d7
  197507: d7a1951
  197503: b1632ee
v: v3
  • Loading branch information
NeilBrown committed May 18, 2010
1 parent fb30c68 commit 52ca884
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 7b0bb5368a7195606eca475d9f4e291ab7227052
refs/heads/master: a8707c08f4f718bb0ed65499d3f43201f6e41455
26 changes: 6 additions & 20 deletions trunk/drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -2088,7 +2088,6 @@ static void sync_sbs(mddev_t * mddev, int nospares)
if (rdev->sb_events == mddev->events ||
(nospares &&
rdev->raid_disk < 0 &&
(rdev->sb_events&1)==0 &&
rdev->sb_events+1 == mddev->events)) {
/* Don't update this superblock */
rdev->sb_loaded = 2;
Expand Down Expand Up @@ -2141,28 +2140,14 @@ static void md_update_sb(mddev_t * mddev, int force_change)
* and 'events' is odd, we can roll back to the previous clean state */
if (nospares
&& (mddev->in_sync && mddev->recovery_cp == MaxSector)
&& (mddev->events & 1)
&& mddev->events != 1)
&& mddev->can_decrease_events
&& mddev->events != 1) {
mddev->events--;
else {
mddev->can_decrease_events = 0;
} else {
/* otherwise we have to go forward and ... */
mddev->events ++;
if (!mddev->in_sync || mddev->recovery_cp != MaxSector) { /* not clean */
/* .. if the array isn't clean, an 'even' event must also go
* to spares. */
if ((mddev->events&1)==0) {
nospares = 0;
sync_req = 2; /* force a second update to get the
* even/odd in sync */
}
} else {
/* otherwise an 'odd' event must go to spares */
if ((mddev->events&1)) {
nospares = 0;
sync_req = 2; /* force a second update to get the
* even/odd in sync */
}
}
mddev->can_decrease_events = nospares;
}

if (!mddev->events) {
Expand Down Expand Up @@ -4606,6 +4591,7 @@ static void md_clean(mddev_t *mddev)
mddev->layout = 0;
mddev->max_disks = 0;
mddev->events = 0;
mddev->can_decrease_events = 0;
mddev->delta_disks = 0;
mddev->new_level = LEVEL_NONE;
mddev->new_layout = 0;
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/md/md.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,12 @@ struct mddev_s
int external_size; /* size managed
* externally */
__u64 events;
/* If the last 'event' was simply a clean->dirty transition, and
* we didn't write it to the spares, then it is safe and simple
* to just decrement the event count on a dirty->clean transition.
* So we record that possibility here.
*/
int can_decrease_events;

char uuid[16];

Expand Down

0 comments on commit 52ca884

Please sign in to comment.