Merge branch 'for-linus' of git://git.kernel.dk/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/linux-2.6-block: (37 commits)
splice: fix generic_file_splice_read() race with page invalidation
ramfs: enable splice write
drivers/block/pktcdvd.c: avoid useless memset
cdrom: revert commit 22a9189
(cdrom: use kmalloced buffers instead of buffers on stack)
scsi: sr avoids useless buffer allocation
block: blk_rq_map_kern uses the bounce buffers for stack buffers
block: add blk_queue_update_dma_pad
DAC960: push down BKL
pktcdvd: push BKL down into driver
paride: push ioctl down into driver
block: use get_unaligned_* helpers
block: extend queue_flag bitops
block: request_module(): use format string
Add bvec_merge_data to handle stacked devices and ->merge_bvec()
block: integrity flags can't use bit ops on unsigned short
cmdfilter: extend default read filter
sg: fix odd style (extra parenthesis) introduced by cmd filter patch
block: add bounce support to blk_rq_map_user_iov
cfq-iosched: get rid of enable_idle being unused warning
allow userspace to modify scsi command filter on per device basis
...
This commit is contained in:
@@ -50,17 +50,19 @@ static inline dev_info_t *which_dev(mddev_t *mddev, sector_t sector)
|
||||
/**
|
||||
* linear_mergeable_bvec -- tell bio layer if two requests can be merged
|
||||
* @q: request queue
|
||||
* @bio: the buffer head that's been built up so far
|
||||
* @bvm: properties of new bio
|
||||
* @biovec: the request that could be merged to it.
|
||||
*
|
||||
* Return amount of bytes we can take at this offset
|
||||
*/
|
||||
static int linear_mergeable_bvec(struct request_queue *q, struct bio *bio, struct bio_vec *biovec)
|
||||
static int linear_mergeable_bvec(struct request_queue *q,
|
||||
struct bvec_merge_data *bvm,
|
||||
struct bio_vec *biovec)
|
||||
{
|
||||
mddev_t *mddev = q->queuedata;
|
||||
dev_info_t *dev0;
|
||||
unsigned long maxsectors, bio_sectors = bio->bi_size >> 9;
|
||||
sector_t sector = bio->bi_sector + get_start_sect(bio->bi_bdev);
|
||||
unsigned long maxsectors, bio_sectors = bvm->bi_size >> 9;
|
||||
sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
|
||||
|
||||
dev0 = which_dev(mddev, sector);
|
||||
maxsectors = (dev0->size << 1) - (sector - (dev0->offset<<1));
|
||||
|
@@ -241,18 +241,20 @@ static int create_strip_zones (mddev_t *mddev)
|
||||
/**
|
||||
* raid0_mergeable_bvec -- tell bio layer if a two requests can be merged
|
||||
* @q: request queue
|
||||
* @bio: the buffer head that's been built up so far
|
||||
* @bvm: properties of new bio
|
||||
* @biovec: the request that could be merged to it.
|
||||
*
|
||||
* Return amount of bytes we can accept at this offset
|
||||
*/
|
||||
static int raid0_mergeable_bvec(struct request_queue *q, struct bio *bio, struct bio_vec *biovec)
|
||||
static int raid0_mergeable_bvec(struct request_queue *q,
|
||||
struct bvec_merge_data *bvm,
|
||||
struct bio_vec *biovec)
|
||||
{
|
||||
mddev_t *mddev = q->queuedata;
|
||||
sector_t sector = bio->bi_sector + get_start_sect(bio->bi_bdev);
|
||||
sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
|
||||
int max;
|
||||
unsigned int chunk_sectors = mddev->chunk_size >> 9;
|
||||
unsigned int bio_sectors = bio->bi_size >> 9;
|
||||
unsigned int bio_sectors = bvm->bi_size >> 9;
|
||||
|
||||
max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9;
|
||||
if (max < 0) max = 0; /* bio_add cannot handle a negative return */
|
||||
|
@@ -439,26 +439,27 @@ static sector_t raid10_find_virt(conf_t *conf, sector_t sector, int dev)
|
||||
/**
|
||||
* raid10_mergeable_bvec -- tell bio layer if a two requests can be merged
|
||||
* @q: request queue
|
||||
* @bio: the buffer head that's been built up so far
|
||||
* @bvm: properties of new bio
|
||||
* @biovec: the request that could be merged to it.
|
||||
*
|
||||
* Return amount of bytes we can accept at this offset
|
||||
* If near_copies == raid_disk, there are no striping issues,
|
||||
* but in that case, the function isn't called at all.
|
||||
*/
|
||||
static int raid10_mergeable_bvec(struct request_queue *q, struct bio *bio,
|
||||
struct bio_vec *bio_vec)
|
||||
static int raid10_mergeable_bvec(struct request_queue *q,
|
||||
struct bvec_merge_data *bvm,
|
||||
struct bio_vec *biovec)
|
||||
{
|
||||
mddev_t *mddev = q->queuedata;
|
||||
sector_t sector = bio->bi_sector + get_start_sect(bio->bi_bdev);
|
||||
sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
|
||||
int max;
|
||||
unsigned int chunk_sectors = mddev->chunk_size >> 9;
|
||||
unsigned int bio_sectors = bio->bi_size >> 9;
|
||||
unsigned int bio_sectors = bvm->bi_size >> 9;
|
||||
|
||||
max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9;
|
||||
if (max < 0) max = 0; /* bio_add cannot handle a negative return */
|
||||
if (max <= bio_vec->bv_len && bio_sectors == 0)
|
||||
return bio_vec->bv_len;
|
||||
if (max <= biovec->bv_len && bio_sectors == 0)
|
||||
return biovec->bv_len;
|
||||
else
|
||||
return max;
|
||||
}
|
||||
|
@@ -3314,15 +3314,17 @@ static int raid5_congested(void *data, int bits)
|
||||
/* We want read requests to align with chunks where possible,
|
||||
* but write requests don't need to.
|
||||
*/
|
||||
static int raid5_mergeable_bvec(struct request_queue *q, struct bio *bio, struct bio_vec *biovec)
|
||||
static int raid5_mergeable_bvec(struct request_queue *q,
|
||||
struct bvec_merge_data *bvm,
|
||||
struct bio_vec *biovec)
|
||||
{
|
||||
mddev_t *mddev = q->queuedata;
|
||||
sector_t sector = bio->bi_sector + get_start_sect(bio->bi_bdev);
|
||||
sector_t sector = bvm->bi_sector + get_start_sect(bvm->bi_bdev);
|
||||
int max;
|
||||
unsigned int chunk_sectors = mddev->chunk_size >> 9;
|
||||
unsigned int bio_sectors = bio->bi_size >> 9;
|
||||
unsigned int bio_sectors = bvm->bi_size >> 9;
|
||||
|
||||
if (bio_data_dir(bio) == WRITE)
|
||||
if ((bvm->bi_rw & 1) == WRITE)
|
||||
return biovec->bv_len; /* always allow writes to be mergeable */
|
||||
|
||||
max = (chunk_sectors - ((sector & (chunk_sectors - 1)) + bio_sectors)) << 9;
|
||||
|
Reference in New Issue
Block a user