Just call read_cache_object directly instead of going through the effort
of finding a cache object and faking up a request first.

Signed-off-by: Christoph Hellwig <[email protected]>

---
 sheep/object_cache.c |   24 +-----------------------
 1 file changed, 1 insertion(+), 23 deletions(-)

Index: sheepdog/sheep/object_cache.c
===================================================================
--- sheepdog.orig/sheep/object_cache.c  2012-07-16 10:48:32.023467435 +0200
+++ sheepdog/sheep/object_cache.c       2012-07-16 10:48:35.683467491 +0200
@@ -818,32 +818,10 @@ int object_cache_write(uint64_t oid, cha
 int object_cache_read(uint64_t oid, char *data, unsigned int datalen,
                      uint64_t offset)
 {
-       int ret;
-       struct request *req;
        uint32_t vid = oid_to_vid(oid);
        uint32_t idx = object_cache_oid_to_idx(oid);
-       struct object_cache *cache;
 
-       cache = find_object_cache(vid, 0);
-
-       req = zalloc(sizeof(*req));
-       if (!req)
-               return SD_RES_NO_MEM;
-
-       sd_init_req(&req->rq, SD_OP_READ_OBJ);
-       req->rq.data_length = datalen;
-
-       req->rq.obj.oid = oid;
-       req->rq.obj.offset = offset;
-
-       req->data = data;
-       req->op = get_sd_op(req->rq.opcode);
-
-       ret = object_cache_rw(cache, idx, req);
-
-       free(req);
-
-       return ret;
+       return read_cache_object(vid, idx, data, datalen, offset);
 }
 
 int object_cache_flush_vdi(struct request *req)

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to