Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 104233
b: refs/heads/master
c: a0da84f
h: refs/heads/master
i:
  104231: fcdcea1
v: v3
  • Loading branch information
Neil Brown committed Jun 27, 2008
1 parent ceba2bf commit 6a5b31c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 6 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: 0e13fe23a00ad88c737d91d94a050707c6139ce4
refs/heads/master: a0da84f35b25875870270d16b6eccda4884d61a7
29 changes: 24 additions & 5 deletions trunk/drivers/md/bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,11 @@ void bitmap_update_sb(struct bitmap *bitmap)
spin_unlock_irqrestore(&bitmap->lock, flags);
sb = (bitmap_super_t *)kmap_atomic(bitmap->sb_page, KM_USER0);
sb->events = cpu_to_le64(bitmap->mddev->events);
if (!bitmap->mddev->degraded)
sb->events_cleared = cpu_to_le64(bitmap->mddev->events);
if (bitmap->mddev->events < bitmap->events_cleared) {
/* rocking back to read-only */
bitmap->events_cleared = bitmap->mddev->events;
sb->events_cleared = cpu_to_le64(bitmap->events_cleared);
}
kunmap_atomic(sb, KM_USER0);
write_page(bitmap, bitmap->sb_page, 1);
}
Expand Down Expand Up @@ -1085,9 +1088,19 @@ void bitmap_daemon_work(struct bitmap *bitmap)
} else
spin_unlock_irqrestore(&bitmap->lock, flags);
lastpage = page;
/*
printk("bitmap clean at page %lu\n", j);
*/

/* We are possibly going to clear some bits, so make
* sure that events_cleared is up-to-date.
*/
if (bitmap->need_sync) {
bitmap_super_t *sb;
bitmap->need_sync = 0;
sb = kmap_atomic(bitmap->sb_page, KM_USER0);
sb->events_cleared =
cpu_to_le64(bitmap->events_cleared);
kunmap_atomic(sb, KM_USER0);
write_page(bitmap, bitmap->sb_page, 1);
}
spin_lock_irqsave(&bitmap->lock, flags);
clear_page_attr(bitmap, page, BITMAP_PAGE_CLEAN);
}
Expand Down Expand Up @@ -1257,6 +1270,12 @@ void bitmap_endwrite(struct bitmap *bitmap, sector_t offset, unsigned long secto
return;
}

if (success &&
bitmap->events_cleared < bitmap->mddev->events) {
bitmap->events_cleared = bitmap->mddev->events;
bitmap->need_sync = 1;
}

if (!success && ! (*bmc & NEEDED_MASK))
*bmc |= NEEDED_MASK;

Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/raid/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ struct bitmap {
unsigned long syncchunk;

__u64 events_cleared;
int need_sync;

/* bitmap spinlock */
spinlock_t lock;
Expand Down

0 comments on commit 6a5b31c

Please sign in to comment.