Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 251219
b: refs/heads/master
c: 464fb41
h: refs/heads/master
i:
  251217: b04a0f8
  251215: a2e826e
v: v3
  • Loading branch information
Konrad Rzeszutek Wilk committed Apr 14, 2011
1 parent 4ea6055 commit 5855276
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 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: c35950bfa9abaaf16548a287a8d5d782a361414f
refs/heads/master: 464fb419e17083a18b636c9f4714fc49ef6857d2
23 changes: 16 additions & 7 deletions trunk/drivers/xen/blkback/blkback.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,18 +637,23 @@ static int __init blkif_init(void)

blkbk->pending_reqs = kmalloc(sizeof(blkbk->pending_reqs[0]) *
blkif_reqs, GFP_KERNEL);
blkbk->pending_grant_handles = kmalloc(sizeof(blkbk->pending_grant_handles[0]) *
mmap_pages, GFP_KERNEL);
blkbk->pending_pages = alloc_empty_pages_and_pagevec(mmap_pages);
blkbk->pending_grant_handles = vzalloc(sizeof(blkbk->pending_grant_handles[0]) *
mmap_pages);
blkbk->pending_pages = vzalloc(sizeof(blkbk->pending_pages[0]) * mmap_pages);

if (!blkbk->pending_reqs || !blkbk->pending_grant_handles || !blkbk->pending_pages) {
rc = -ENOMEM;
goto out_of_memory;
}

for (i = 0; i < mmap_pages; i++)
for (i = 0; i < mmap_pages; i++) {
blkbk->pending_grant_handles[i] = BLKBACK_INVALID_HANDLE;

blkbk->pending_pages[i] = alloc_page(GFP_KERNEL | __GFP_HIGHMEM);
if (blkbk->pending_pages[i] == NULL) {
rc = -ENOMEM;
goto out_of_memory;
}
}
rc = blkif_interface_init();
if (rc)
goto failed_init;
Expand All @@ -672,8 +677,12 @@ static int __init blkif_init(void)
printk(KERN_ERR "%s: out of memory\n", __func__);
failed_init:
kfree(blkbk->pending_reqs);
kfree(blkbk->pending_grant_handles);
free_empty_pages_and_pagevec(blkbk->pending_pages, mmap_pages);
vfree(blkbk->pending_grant_handles);
for (i = 0; i < mmap_pages; i++) {
if (blkbk->pending_pages[i])
__free_page(blkbk->pending_pages[i]);
}
vfree(blkbk->pending_pages);
vfree(blkbk);
blkbk = NULL;
return rc;
Expand Down

0 comments on commit 5855276

Please sign in to comment.