Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 373545
b: refs/heads/master
c: 868311b
h: refs/heads/master
i:
  373543: a90f3dd
v: v3
  • Loading branch information
Alex Elder committed May 2, 2013
1 parent d238b65 commit c9b1193
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f907ad55967fec6bc6ec5ee84021070c49cf0bb1
refs/heads/master: 868311b1ebc9b203bae0d6d1f012ea5cbdadca03
23 changes: 20 additions & 3 deletions trunk/drivers/block/rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ static LIST_HEAD(rbd_client_list); /* clients */
static DEFINE_SPINLOCK(rbd_client_list_lock);

static struct kmem_cache *rbd_img_request_cache;
static struct kmem_cache *rbd_obj_request_cache;

static int rbd_img_request_submit(struct rbd_img_request *img_request);

Expand Down Expand Up @@ -1762,7 +1763,7 @@ static struct rbd_obj_request *rbd_obj_request_create(const char *object_name,
if (!name)
return NULL;

obj_request = kzalloc(sizeof (*obj_request), GFP_KERNEL);
obj_request = kmem_cache_zalloc(rbd_obj_request_cache, GFP_KERNEL);
if (!obj_request) {
kfree(name);
return NULL;
Expand Down Expand Up @@ -1814,7 +1815,8 @@ static void rbd_obj_request_destroy(struct kref *kref)
}

kfree(obj_request->object_name);
kfree(obj_request);
obj_request->object_name = NULL;
kmem_cache_free(rbd_obj_request_cache, obj_request);
}

/*
Expand Down Expand Up @@ -5008,14 +5010,29 @@ static int rbd_slab_init(void)
sizeof (struct rbd_img_request),
__alignof__(struct rbd_img_request),
0, NULL);
if (rbd_img_request_cache)
if (!rbd_img_request_cache)
return -ENOMEM;

rbd_assert(!rbd_obj_request_cache);
rbd_obj_request_cache = kmem_cache_create("rbd_obj_request",
sizeof (struct rbd_obj_request),
__alignof__(struct rbd_obj_request),
0, NULL);
if (rbd_obj_request_cache)
return 0;

kmem_cache_destroy(rbd_img_request_cache);
rbd_img_request_cache = NULL;

return -ENOMEM;
}

static void rbd_slab_exit(void)
{
rbd_assert(rbd_obj_request_cache);
kmem_cache_destroy(rbd_obj_request_cache);
rbd_obj_request_cache = NULL;

rbd_assert(rbd_img_request_cache);
kmem_cache_destroy(rbd_img_request_cache);
rbd_img_request_cache = NULL;
Expand Down

0 comments on commit c9b1193

Please sign in to comment.