Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75106
b: refs/heads/master
c: 91e1062
h: refs/heads/master
v: v3
  • Loading branch information
Milan Broz authored and Alasdair G Kergon committed Dec 20, 2007
1 parent 6f6191d commit 2752d5c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 14 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: 91212507f93778c09d4c1335207b6f4b995f5ad1
refs/heads/master: 91e106259214b40e992a58fb9417da46868e19b2
24 changes: 11 additions & 13 deletions trunk/drivers/md/dm-crypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,8 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
struct bio *clone;
unsigned int nr_iovecs = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
gfp_t gfp_mask = GFP_NOIO | __GFP_HIGHMEM;
unsigned int i;
unsigned i, len;
struct page *page;

clone = bio_alloc_bioset(GFP_NOIO, nr_iovecs, cc->bs);
if (!clone)
Expand All @@ -407,10 +408,8 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
clone_init(io, clone);

for (i = 0; i < nr_iovecs; i++) {
struct bio_vec *bv = bio_iovec_idx(clone, i);

bv->bv_page = mempool_alloc(cc->page_pool, gfp_mask);
if (!bv->bv_page)
page = mempool_alloc(cc->page_pool, gfp_mask);
if (!page)
break;

/*
Expand All @@ -421,15 +420,14 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned size)
if (i == (MIN_BIO_PAGES - 1))
gfp_mask = (gfp_mask | __GFP_NOWARN) & ~__GFP_WAIT;

bv->bv_offset = 0;
if (size > PAGE_SIZE)
bv->bv_len = PAGE_SIZE;
else
bv->bv_len = size;
len = (size > PAGE_SIZE) ? PAGE_SIZE : size;

if (!bio_add_page(clone, page, len, 0)) {
mempool_free(page, cc->page_pool);
break;
}

clone->bi_size += bv->bv_len;
clone->bi_vcnt++;
size -= bv->bv_len;
size -= len;
}

if (!clone->bi_size) {
Expand Down

0 comments on commit 2752d5c

Please sign in to comment.