forked from Minki/linux
drbd: use clear_bit_unlock() where appropriate
Some open-coded clear_bit(); smp_mb__after_clear_bit(); should in fact have been smp_mb__before_clear_bit(); clear_bit(); Instead, use clear_bit_unlock() to annotate the intention, and have it do the right thing. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
This commit is contained in:
parent
61610420f7
commit
4738fa1690
@ -219,8 +219,7 @@ static void bm_page_unlock_io(struct drbd_conf *mdev, int page_nr)
|
|||||||
{
|
{
|
||||||
struct drbd_bitmap *b = mdev->bitmap;
|
struct drbd_bitmap *b = mdev->bitmap;
|
||||||
void *addr = &page_private(b->bm_pages[page_nr]);
|
void *addr = &page_private(b->bm_pages[page_nr]);
|
||||||
clear_bit(BM_PAGE_IO_LOCK, addr);
|
clear_bit_unlock(BM_PAGE_IO_LOCK, addr);
|
||||||
smp_mb__after_clear_bit();
|
|
||||||
wake_up(&mdev->bitmap->bm_io_wait);
|
wake_up(&mdev->bitmap->bm_io_wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2818,8 +2818,7 @@ static int w_bitmap_io(struct drbd_work *w, int unused)
|
|||||||
put_ldev(mdev);
|
put_ldev(mdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_bit(BITMAP_IO, &mdev->flags);
|
clear_bit_unlock(BITMAP_IO, &mdev->flags);
|
||||||
smp_mb__after_clear_bit();
|
|
||||||
wake_up(&mdev->misc_wait);
|
wake_up(&mdev->misc_wait);
|
||||||
|
|
||||||
if (work->done)
|
if (work->done)
|
||||||
|
@ -275,8 +275,7 @@ static inline int lc_try_lock(struct lru_cache *lc)
|
|||||||
*/
|
*/
|
||||||
static inline void lc_unlock(struct lru_cache *lc)
|
static inline void lc_unlock(struct lru_cache *lc)
|
||||||
{
|
{
|
||||||
clear_bit(__LC_DIRTY, &lc->flags);
|
clear_bit_unlock(__LC_DIRTY, &lc->flags);
|
||||||
smp_mb__after_clear_bit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int lc_is_used(struct lru_cache *lc, unsigned int enr)
|
static inline int lc_is_used(struct lru_cache *lc, unsigned int enr)
|
||||||
|
@ -44,8 +44,8 @@ MODULE_LICENSE("GPL");
|
|||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define RETURN(x...) do { \
|
#define RETURN(x...) do { \
|
||||||
clear_bit(__LC_PARANOIA, &lc->flags); \
|
clear_bit_unlock(__LC_PARANOIA, &lc->flags); \
|
||||||
smp_mb__after_clear_bit(); return x ; } while (0)
|
return x ; } while (0)
|
||||||
|
|
||||||
/* BUG() if e is not one of the elements tracked by lc */
|
/* BUG() if e is not one of the elements tracked by lc */
|
||||||
#define PARANOIA_LC_ELEMENT(lc, e) do { \
|
#define PARANOIA_LC_ELEMENT(lc, e) do { \
|
||||||
@ -438,8 +438,7 @@ void lc_changed(struct lru_cache *lc, struct lc_element *e)
|
|||||||
hlist_add_head(&e->colision, lc_hash_slot(lc, lc->new_number));
|
hlist_add_head(&e->colision, lc_hash_slot(lc, lc->new_number));
|
||||||
lc->changing_element = NULL;
|
lc->changing_element = NULL;
|
||||||
lc->new_number = LC_FREE;
|
lc->new_number = LC_FREE;
|
||||||
clear_bit(__LC_DIRTY, &lc->flags);
|
clear_bit_unlock(__LC_DIRTY, &lc->flags);
|
||||||
smp_mb__after_clear_bit();
|
|
||||||
RETURN();
|
RETURN();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,8 +462,7 @@ unsigned int lc_put(struct lru_cache *lc, struct lc_element *e)
|
|||||||
/* move it to the front of LRU. */
|
/* move it to the front of LRU. */
|
||||||
list_move(&e->list, &lc->lru);
|
list_move(&e->list, &lc->lru);
|
||||||
lc->used--;
|
lc->used--;
|
||||||
clear_bit(__LC_STARVING, &lc->flags);
|
clear_bit_unlock(__LC_STARVING, &lc->flags);
|
||||||
smp_mb__after_clear_bit();
|
|
||||||
}
|
}
|
||||||
RETURN(e->refcnt);
|
RETURN(e->refcnt);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user