verity: use atomic_set instead of atomic_cmpxchg in read_completed

When moving from the PENDING to READY state it is sufficient to use
an atomic_set since we know the previous state MUST have been
PENDING. In addition, there is a BUG_ON which verifies this.

BUG=9752
TEST=Ran tests in verity.git. Ran platform_DMVerityCorruption on H/W.

Signed-off-by: Mandeep Singh Baines <msb@chromium.org>
kernel.git Review URL: http://codereview.chromium.org/6677048

TBRing. Already LGTMed and committed to kernel.git

Change-Id: I1a199fc8f27f315bd98baa98f5fca0bb0fb4a556

R=wad@chromium.org,taysom@chromium.org,ups@chromium.org

Review URL: http://codereview.chromium.org/6721019
diff --git a/dm-bht.c b/dm-bht.c
index 38849d6..71e3b04 100644
--- a/dm-bht.c
+++ b/dm-bht.c
@@ -441,7 +441,6 @@
  */
 void dm_bht_read_completed(struct dm_bht_entry *entry, int status)
 {
-	int state;
 	if (status) {
 		/* TODO(wad) add retry support */
 		DMCRIT("an I/O error occurred while reading entry");
@@ -449,13 +448,8 @@
 		/* entry->nodes will be freed later */
 		return;
 	}
-	state = atomic_cmpxchg(&entry->state,
-				   DM_BHT_ENTRY_PENDING,
-				   DM_BHT_ENTRY_READY);
-	if (state != DM_BHT_ENTRY_PENDING) {
-		DMCRIT("state changed on entry out from under io");
-		BUG();
-	}
+	BUG_ON(atomic_read(&entry->state) != DM_BHT_ENTRY_PENDING);
+	atomic_set(&entry->state, DM_BHT_ENTRY_READY);
 }
 EXPORT_SYMBOL(dm_bht_read_completed);