[sheepdog] [PATCH 2/3] sheep: use a non-atomic version of set_bit()

Liu Yuan namei.unix at gmail.com
Wed May 16 09:52:54 CEST 2012


From: Liu Yuan <tailai.ly at taobao.com>

We are in the main thread, so no need for atomic bit ops.

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 sheep/farm/farm.c    |    2 +-
 sheep/ops.c          |    2 +-
 sheep/sdnet.c        |    4 ++--
 sheep/simple_store.c |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/sheep/farm/farm.c b/sheep/farm/farm.c
index 19b8945..0f5fdaa 100644
--- a/sheep/farm/farm.c
+++ b/sheep/farm/farm.c
@@ -302,7 +302,7 @@ static int init_sys_vdi_bitmap(char *path)
 
 		vprintf(SDOG_DEBUG, "found the VDI object %" PRIx64 "\n", oid);
 
-		set_bit(oid_to_vid(oid), sys->vdi_inuse);
+		__set_bit(oid_to_vid(oid), sys->vdi_inuse);
 	}
 	closedir(dir);
 
diff --git a/sheep/ops.c b/sheep/ops.c
index ee704c6..e46b2de 100644
--- a/sheep/ops.c
+++ b/sheep/ops.c
@@ -146,7 +146,7 @@ static int post_cluster_new_vdi(const struct sd_req *req, struct sd_rsp *rsp,
 	int ret = vdi_rsp->result;
 
 	vprintf(SDOG_INFO, "done %d %ld\n", ret, nr);
-	set_bit(nr, sys->vdi_inuse);
+	__set_bit(nr, sys->vdi_inuse);
 
 	return SD_RES_SUCCESS;
 }
diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index bba023e..25d27fe 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -64,7 +64,7 @@ static void check_object_consistency(struct sd_obj_req *hdr)
 	list_for_each_entry_safe(bmap, n, &sys->consistent_obj_list, list) {
 		nr_bmaps++;
 		if (bmap->vdi_id == vdi_id) {
-			set_bit(data_oid_to_idx(hdr->oid), bmap->dobjs);
+			__set_bit(data_oid_to_idx(hdr->oid), bmap->dobjs);
 			list_del(&bmap->list);
 			list_add_tail(&bmap->list, &sys->consistent_obj_list);
 			return;
@@ -81,7 +81,7 @@ static void check_object_consistency(struct sd_obj_req *hdr)
 
 	bmap->vdi_id = vdi_id;
 	list_add_tail(&bmap->list, &sys->consistent_obj_list);
-	set_bit(data_oid_to_idx(hdr->oid), bmap->dobjs);
+	__set_bit(data_oid_to_idx(hdr->oid), bmap->dobjs);
 	if (nr_bmaps >= MAX_DATA_OBJECT_BMAPS) {
 		/* the first entry is the least recently used one */
 		bmap = list_first_entry(&sys->consistent_obj_list,
diff --git a/sheep/simple_store.c b/sheep/simple_store.c
index d165f28..625b493 100644
--- a/sheep/simple_store.c
+++ b/sheep/simple_store.c
@@ -68,7 +68,7 @@ static int simple_store_init(char *path)
 
 			vprintf(SDOG_DEBUG, "found the VDI object %" PRIx64 "\n", oid);
 
-			set_bit(oid_to_vid(oid), sys->vdi_inuse);
+			__set_bit(oid_to_vid(oid), sys->vdi_inuse);
 		}
 		closedir(dir);
 	}
-- 
1.7.8.2




More information about the sheepdog mailing list