~ubuntu-branches/debian/experimental/linux-2.6/experimental

« back to all changes in this revision

Viewing changes to drivers/md/dm-io.c

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings, Ben Hutchings
  • Date: 2012-03-21 03:08:36 UTC
  • mfrom: (1.2.34)
  • Revision ID: package-import@ubuntu.com-20120321030836-rvavg03lkz15wj2q
Tags: 3.3-1~experimental.1
* New upstream release: http://kernelnewbies.org/Linux_3.3

[ Ben Hutchings ]
* [x86] crypto: Enable CRYPTO_SERPENT_SSE2_586, CRYPTO_SERPENT_SSE2_X86_64
* aufs: Update to aufs3.x-rcN-20120312
* IB: Enable INFINIBAND_SRPT as module (Closes: #663041)

Show diffs side-by-side

added added

removed removed

Lines of Context:
296
296
        unsigned offset;
297
297
        unsigned num_bvecs;
298
298
        sector_t remaining = where->count;
 
299
        struct request_queue *q = bdev_get_queue(where->bdev);
 
300
        sector_t discard_sectors;
299
301
 
300
302
        /*
301
303
         * where->count may be zero if rw holds a flush and we need to
305
307
                /*
306
308
                 * Allocate a suitably sized-bio.
307
309
                 */
308
 
                num_bvecs = dm_sector_div_up(remaining,
309
 
                                             (PAGE_SIZE >> SECTOR_SHIFT));
310
 
                num_bvecs = min_t(int, bio_get_nr_vecs(where->bdev), num_bvecs);
 
310
                if (rw & REQ_DISCARD)
 
311
                        num_bvecs = 1;
 
312
                else
 
313
                        num_bvecs = min_t(int, bio_get_nr_vecs(where->bdev),
 
314
                                          dm_sector_div_up(remaining, (PAGE_SIZE >> SECTOR_SHIFT)));
 
315
 
311
316
                bio = bio_alloc_bioset(GFP_NOIO, num_bvecs, io->client->bios);
312
317
                bio->bi_sector = where->sector + (where->count - remaining);
313
318
                bio->bi_bdev = where->bdev;
315
320
                bio->bi_destructor = dm_bio_destructor;
316
321
                store_io_and_region_in_bio(bio, io, region);
317
322
 
318
 
                /*
319
 
                 * Try and add as many pages as possible.
320
 
                 */
321
 
                while (remaining) {
 
323
                if (rw & REQ_DISCARD) {
 
324
                        discard_sectors = min_t(sector_t, q->limits.max_discard_sectors, remaining);
 
325
                        bio->bi_size = discard_sectors << SECTOR_SHIFT;
 
326
                        remaining -= discard_sectors;
 
327
                } else while (remaining) {
 
328
                        /*
 
329
                         * Try and add as many pages as possible.
 
330
                         */
322
331
                        dp->get_page(dp, &page, &len, &offset);
323
332
                        len = min(len, to_bytes(remaining));
324
333
                        if (!bio_add_page(bio, page, len, offset))