Revert "if: remove obsolete merge_bvec_fn()"

This reverts commit d96b6e3fbf.

Altough newer kernels don't have this anymore, old kernels
need it.

Make it dependend from the kernel version.
This commit is contained in:
Thomas Schoebel-Theuer 2016-10-23 11:54:01 +02:00
parent 94d396524a
commit b6ef899ded
1 changed files with 15 additions and 1 deletions

View File

@ -46,7 +46,7 @@
#define USE_SEGMENT_BOUNDARY (PAGE_SIZE-1) #define USE_SEGMENT_BOUNDARY (PAGE_SIZE-1)
#define USE_CONGESTED_FN #define USE_CONGESTED_FN
// end_remove_this #define USE_MERGE_BVEC
//#define DENY_READA //#define DENY_READA
#include <linux/kernel.h> #include <linux/kernel.h>
@ -853,6 +853,16 @@ int mars_congested(void *data, int bdi_bits)
return ret; return ret;
} }
static
int mars_merge_bvec(struct request_queue *q, struct bvec_merge_data *bvm, struct bio_vec *bvec)
{
unsigned int bio_size = bvm->bi_size;
if (!bio_size) {
return bvec->bv_len;
}
return 128;
}
static static
loff_t if_get_capacity(struct if_brick *brick) loff_t if_get_capacity(struct if_brick *brick)
{ {
@ -1010,6 +1020,10 @@ static int if_switch(struct if_brick *brick)
q->backing_dev_info.congested_fn = mars_congested; q->backing_dev_info.congested_fn = mars_congested;
q->backing_dev_info.congested_data = input; q->backing_dev_info.congested_data = input;
#endif #endif
#ifdef USE_MERGE_BVEC
MARS_DBG("blk_queue_merge_bvec()\n");
blk_queue_merge_bvec(q, mars_merge_bvec);
#endif
// point of no return // point of no return
MARS_DBG("add_disk()\n"); MARS_DBG("add_disk()\n");