From b6ef899ded3848f44e637802cf348e26af57fcc2 Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Sun, 23 Oct 2016 11:54:01 +0200 Subject: [PATCH] Revert "if: remove obsolete merge_bvec_fn()" This reverts commit d96b6e3fbf23a1428629cd38942eef55d94925d4. Altough newer kernels don't have this anymore, old kernels need it. Make it dependend from the kernel version. --- kernel/mars_if.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/kernel/mars_if.c b/kernel/mars_if.c index ae854716..6fbf4a48 100644 --- a/kernel/mars_if.c +++ b/kernel/mars_if.c @@ -46,7 +46,7 @@ #define USE_SEGMENT_BOUNDARY (PAGE_SIZE-1) #define USE_CONGESTED_FN -// end_remove_this +#define USE_MERGE_BVEC //#define DENY_READA #include @@ -853,6 +853,16 @@ int mars_congested(void *data, int bdi_bits) 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 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_data = input; #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 MARS_DBG("add_disk()\n");