Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252800
b: refs/heads/master
c: 4cc1b4c
h: refs/heads/master
v: v3
  • Loading branch information
Mikulas Patocka authored and Alasdair G Kergon committed May 29, 2011
1 parent fe87ed7 commit 9820903
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 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: c6ea41fbbe08f270a8edef99dc369faf809d1bd6
refs/heads/master: 4cc1b4cffd187a5c5d6264c8d766c49b3c57fb05
11 changes: 1 addition & 10 deletions trunk/drivers/md/dm-kcopyd.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
* pages for kcopyd io.
*---------------------------------------------------------------*/
struct dm_kcopyd_client {
spinlock_t lock;
struct page_list *pages;
unsigned int nr_pages;
unsigned int nr_free_pages;
Expand Down Expand Up @@ -99,11 +98,8 @@ static int kcopyd_get_pages(struct dm_kcopyd_client *kc,
{
struct page_list *pl;

spin_lock(&kc->lock);
if (kc->nr_free_pages < nr) {
spin_unlock(&kc->lock);
if (kc->nr_free_pages < nr)
return -ENOMEM;
}

kc->nr_free_pages -= nr;
for (*pages = pl = kc->pages; --nr; pl = pl->next)
Expand All @@ -112,23 +108,19 @@ static int kcopyd_get_pages(struct dm_kcopyd_client *kc,
kc->pages = pl->next;
pl->next = NULL;

spin_unlock(&kc->lock);

return 0;
}

static void kcopyd_put_pages(struct dm_kcopyd_client *kc, struct page_list *pl)
{
struct page_list *cursor;

spin_lock(&kc->lock);
for (cursor = pl; cursor->next; cursor = cursor->next)
kc->nr_free_pages++;

kc->nr_free_pages++;
cursor->next = kc->pages;
kc->pages = pl;
spin_unlock(&kc->lock);
}

/*
Expand Down Expand Up @@ -625,7 +617,6 @@ int dm_kcopyd_client_create(unsigned int nr_pages,
if (!kc)
return -ENOMEM;

spin_lock_init(&kc->lock);
spin_lock_init(&kc->job_lock);
INIT_LIST_HEAD(&kc->complete_jobs);
INIT_LIST_HEAD(&kc->io_jobs);
Expand Down

0 comments on commit 9820903

Please sign in to comment.