summaryrefslogtreecommitdiffstats
path: root/drivers/md/bitmap.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-22 13:55:13 +1000
committerNeilBrown <neilb@suse.de>2012-05-22 13:55:13 +1000
commitedbb79df6731bb1e99c15f5a519a864d488f4808 (patch)
tree3f2cff223d63a8ec5be507fb991cea083c2b8c7a /drivers/md/bitmap.c
parentbc9891a8853842a19c33dda0ba02fbacf7da067f (diff)
downloadlinux-edbb79df6731bb1e99c15f5a519a864d488f4808.tar.bz2
md/bitmap: remove bitmap_mask_state
This function isn't really needed. It sets or clears a flag in both bitmap->flags and sb->state. However both times it is called, bitmap_update_sb is called soon afterwards which copies bitmap->flags to sb->state. So just make changes to bitmap->flags, and open-code those rather than hiding in a function. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/bitmap.c')
-rw-r--r--drivers/md/bitmap.c37
1 files changed, 3 insertions, 34 deletions
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c
index 1a93ed1fb8df..2d25f3aebd4e 100644
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -640,38 +640,6 @@ out_no_sb:
return err;
}
-enum bitmap_mask_op {
- MASK_SET,
- MASK_UNSET
-};
-
-/* record the state of the bitmap in the superblock. Return the old value */
-static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits,
- enum bitmap_mask_op op)
-{
- bitmap_super_t *sb;
- int old;
-
- if (!bitmap->storage.sb_page) /* can't set the state */
- return 0;
- sb = kmap_atomic(bitmap->storage.sb_page);
- old = le32_to_cpu(sb->state) & bits;
- switch (op) {
- case MASK_SET:
- sb->state |= cpu_to_le32(bits);
- bitmap->flags |= bits;
- break;
- case MASK_UNSET:
- sb->state &= cpu_to_le32(~bits);
- bitmap->flags &= ~bits;
- break;
- default:
- BUG();
- }
- kunmap_atomic(sb);
- return old;
-}
-
/*
* general bitmap file operations
*/
@@ -828,7 +796,8 @@ static void bitmap_file_kick(struct bitmap *bitmap)
{
char *path, *ptr = NULL;
- if (bitmap_mask_state(bitmap, BITMAP_STALE, MASK_SET) == 0) {
+ if (!(bitmap->flags & BITMAP_STALE)) {
+ bitmap->flags |= BITMAP_STALE;
bitmap_update_sb(bitmap);
if (bitmap->storage.file) {
@@ -1830,7 +1799,7 @@ int bitmap_load(struct mddev *mddev)
if (err)
goto out;
- bitmap_mask_state(bitmap, BITMAP_STALE, MASK_UNSET);
+ bitmap->flags &= ~BITMAP_STALE;
/* Kick recovery in case any bits were set */
set_bit(MD_RECOVERY_NEEDED, &bitmap->mddev->recovery);