aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-snap-persistent.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2011-05-29 08:03:09 -0400
committerAlasdair G Kergon <agk@redhat.com>2011-05-29 08:03:09 -0400
commitbda8efec5c706a672e0714d341a342e811f0262a (patch)
tree7daf7b505723f5ed2767353dc3fe53b939c46d87 /drivers/md/dm-snap-persistent.c
parentd04714580f12379fcf7a0f799e86c92b96dd4e1f (diff)
dm io: use fixed initial mempool size
Replace the arbitrary calculation of an initial io struct mempool size with a constant. The code calculated the number of reserved structures based on the request size and used a "magic" multiplication constant of 4. This patch changes it to reserve a fixed number - itself still chosen quite arbitrarily. Further testing might show if there is a better number to choose. Note that if there is no memory pressure, we can still allocate an arbitrary number of "struct io" structures. One structure is enough to process the whole request. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-snap-persistent.c')
-rw-r--r--drivers/md/dm-snap-persistent.c13
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/md/dm-snap-persistent.c b/drivers/md/dm-snap-persistent.c
index 95891dfcbca0..135c2f1fdbfc 100644
--- a/drivers/md/dm-snap-persistent.c
+++ b/drivers/md/dm-snap-persistent.c
@@ -154,11 +154,6 @@ struct pstore {
154 struct workqueue_struct *metadata_wq; 154 struct workqueue_struct *metadata_wq;
155}; 155};
156 156
157static unsigned sectors_to_pages(unsigned sectors)
158{
159 return DIV_ROUND_UP(sectors, PAGE_SIZE >> 9);
160}
161
162static int alloc_area(struct pstore *ps) 157static int alloc_area(struct pstore *ps)
163{ 158{
164 int r = -ENOMEM; 159 int r = -ENOMEM;
@@ -318,8 +313,7 @@ static int read_header(struct pstore *ps, int *new_snapshot)
318 chunk_size_supplied = 0; 313 chunk_size_supplied = 0;
319 } 314 }
320 315
321 ps->io_client = dm_io_client_create(sectors_to_pages(ps->store-> 316 ps->io_client = dm_io_client_create();
322 chunk_size));
323 if (IS_ERR(ps->io_client)) 317 if (IS_ERR(ps->io_client))
324 return PTR_ERR(ps->io_client); 318 return PTR_ERR(ps->io_client);
325 319
@@ -368,11 +362,6 @@ static int read_header(struct pstore *ps, int *new_snapshot)
368 return r; 362 return r;
369 } 363 }
370 364
371 r = dm_io_client_resize(sectors_to_pages(ps->store->chunk_size),
372 ps->io_client);
373 if (r)
374 return r;
375
376 r = alloc_area(ps); 365 r = alloc_area(ps);
377 return r; 366 return r;
378 367