diff options
author | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:13 -0400 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-05-21 23:55:13 -0400 |
commit | edbb79df6731bb1e99c15f5a519a864d488f4808 (patch) | |
tree | 3f2cff223d63a8ec5be507fb991cea083c2b8c7a /drivers/md/bitmap.c | |
parent | bc9891a8853842a19c33dda0ba02fbacf7da067f (diff) |
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.c | 37 |
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: | |||
640 | return err; | 640 | return err; |
641 | } | 641 | } |
642 | 642 | ||
643 | enum bitmap_mask_op { | ||
644 | MASK_SET, | ||
645 | MASK_UNSET | ||
646 | }; | ||
647 | |||
648 | /* record the state of the bitmap in the superblock. Return the old value */ | ||
649 | static int bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, | ||
650 | enum bitmap_mask_op op) | ||
651 | { | ||
652 | bitmap_super_t *sb; | ||
653 | int old; | ||
654 | |||
655 | if (!bitmap->storage.sb_page) /* can't set the state */ | ||
656 | return 0; | ||
657 | sb = kmap_atomic(bitmap->storage.sb_page); | ||
658 | old = le32_to_cpu(sb->state) & bits; | ||
659 | switch (op) { | ||
660 | case MASK_SET: | ||
661 | sb->state |= cpu_to_le32(bits); | ||
662 | bitmap->flags |= bits; | ||
663 | break; | ||
664 | case MASK_UNSET: | ||
665 | sb->state &= cpu_to_le32(~bits); | ||
666 | bitmap->flags &= ~bits; | ||
667 | break; | ||
668 | default: | ||
669 | BUG(); | ||
670 | } | ||
671 | kunmap_atomic(sb); | ||
672 | return old; | ||
673 | } | ||
674 | |||
675 | /* | 643 | /* |
676 | * general bitmap file operations | 644 | * general bitmap file operations |
677 | */ | 645 | */ |
@@ -828,7 +796,8 @@ static void bitmap_file_kick(struct bitmap *bitmap) | |||
828 | { | 796 | { |
829 | char *path, *ptr = NULL; | 797 | char *path, *ptr = NULL; |
830 | 798 | ||
831 | if (bitmap_mask_state(bitmap, BITMAP_STALE, MASK_SET) == 0) { | 799 | if (!(bitmap->flags & BITMAP_STALE)) { |
800 | bitmap->flags |= BITMAP_STALE; | ||
832 | bitmap_update_sb(bitmap); | 801 | bitmap_update_sb(bitmap); |
833 | 802 | ||
834 | if (bitmap->storage.file) { | 803 | if (bitmap->storage.file) { |
@@ -1830,7 +1799,7 @@ int bitmap_load(struct mddev *mddev) | |||
1830 | 1799 | ||
1831 | if (err) | 1800 | if (err) |
1832 | goto out; | 1801 | goto out; |
1833 | bitmap_mask_state(bitmap, BITMAP_STALE, MASK_UNSET); | 1802 | bitmap->flags &= ~BITMAP_STALE; |
1834 | 1803 | ||
1835 | /* Kick recovery in case any bits were set */ | 1804 | /* Kick recovery in case any bits were set */ |
1836 | set_bit(MD_RECOVERY_NEEDED, &bitmap->mddev->recovery); | 1805 | set_bit(MD_RECOVERY_NEEDED, &bitmap->mddev->recovery); |