[Sheepdog] [PATCH v6 7/8] collie: read the cached objects if any for collie operation
Liu Yuan
namei.unix at gmail.com
Mon Mar 26 15:48:29 CEST 2012
From: Liu Yuan <tailai.ly at taobao.com>
Collie operation such 'vdi list' or 'vdi object' need to read the lateset
VDI object, it might be cached in the object cache. We can't pass
SD_FLAG_CMD_CACHE to sheep because collie doesn't know if the cache mode is
enbled.
So we rely on the assumption that the cached object is freshest.
Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
sheep/store.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/sheep/store.c b/sheep/store.c
index c192aeb..4d84350 100644
--- a/sheep/store.c
+++ b/sheep/store.c
@@ -784,6 +784,14 @@ static int bypass_object_cache(struct sd_obj_req *hdr)
{
uint64_t oid = hdr->oid;
+ /*
+ * We assume the cached object is freshest, donot break it ever.
+ * This assumption is useful for non-cache requests from collie,
+ * which tries hard to get the newest data.
+ */
+ if (object_is_cached(oid))
+ return 0;
+
if (!(hdr->flags & SD_FLAG_CMD_CACHE))
return 1;
--
1.7.8.2
More information about the sheepdog
mailing list