mm: move MAP_SYNC to asm-generic/mman-common.h
[linux-2.6-block.git] / lib / sbitmap.c
index 54f57cd117c67274508d7b19726f6a23867665aa..969e5400a61533f988e81267786e19947e0b7f43 100644 (file)
@@ -26,9 +26,7 @@ static inline bool sbitmap_deferred_clear(struct sbitmap *sb, int index)
        /*
         * First get a stable cleared mask, setting the old mask to 0.
         */
-       do {
-               mask = sb->map[index].cleared;
-       } while (cmpxchg(&sb->map[index].cleared, mask, 0) != mask);
+       mask = xchg(&sb->map[index].cleared, 0);
 
        /*
         * Now clear the masked bits in our free word
@@ -516,10 +514,8 @@ static struct sbq_wait_state *sbq_wake_ptr(struct sbitmap_queue *sbq)
                struct sbq_wait_state *ws = &sbq->ws[wake_index];
 
                if (waitqueue_active(&ws->wait)) {
-                       int o = atomic_read(&sbq->wake_index);
-
-                       if (wake_index != o)
-                               atomic_cmpxchg(&sbq->wake_index, o, wake_index);
+                       if (wake_index != atomic_read(&sbq->wake_index))
+                               atomic_set(&sbq->wake_index, wake_index);
                        return ws;
                }