[sheepdog] [PATCH 1/5] object cache: remove file lock in create_cache_object()
Liu Yuan
namei.unix at gmail.com
Sat Aug 4 10:11:28 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
For now the entry access is protected by get/put_object_entry(), when object
is not added to the object list, other threads can't access it.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/object_cache.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/sheep/object_cache.c b/sheep/object_cache.c
index 814b528..d6b5604 100644
--- a/sheep/object_cache.c
+++ b/sheep/object_cache.c
@@ -717,18 +717,7 @@ static int create_cache_object(struct object_cache *oc, uint32_t idx,
goto out;
}
- if (flock(fd, LOCK_EX) < 0) {
- ret = SD_RES_EIO;
- eprintf("%m\n");
- goto out_close;
- }
ret = xpwrite(fd, buffer, buf_size, 0);
- if (flock(fd, LOCK_UN) < 0) {
- ret = SD_RES_EIO;
- eprintf("%m\n");
- goto out_close;
- }
-
if (ret != buf_size) {
ret = SD_RES_EIO;
eprintf("failed, vid %"PRIx32", idx %"PRIx32"\n", oc->vid, idx);
@@ -743,7 +732,6 @@ out:
return ret;
}
-
/* Fetch the object, cache it in success */
static int object_cache_pull(struct object_cache *oc, uint32_t idx)
{
--
1.7.10.2
More information about the sheepdog
mailing list