
1. When generating cas_blk_rq_append_bio, check whether a version with double pointer compiles successfully. This is a better criteria than the version with single pointer since the latter may compile successfully regardless of kernel blk_rq_append_bio prototype. 2. Always provide single pointer to cas_blk_rq_append_bio macro - its up to cas_blk_rq_append_bio implementation to decide whether extra level of indirection is needed. This fixes compilation with kernel 4.14.98. Signed-off-by: Adam Rutkowski <adam.j.rutkowski@intel.com>
40 lines
925 B
Bash
40 lines
925 B
Bash
#!/bin/bash
|
|
#
|
|
# Copyright(c) 2012-2019 Intel Corporation
|
|
# SPDX-License-Identifier: BSD-3-Clause-Clear
|
|
#
|
|
|
|
. `dirname $0`/conf_framework
|
|
|
|
if compile_module "blk_make_request(NULL, NULL, 0)" "linux/blkdev.h"
|
|
then
|
|
add_function "
|
|
static inline struct request *cas_blk_make_request(struct request_queue *q,
|
|
struct bio *bio, gfp_t gfp_mask)
|
|
{
|
|
return blk_make_request(q, bio, gfp_mask);
|
|
}"
|
|
else
|
|
add_function "
|
|
static inline struct request *cas_blk_make_request(struct request_queue *q,
|
|
struct bio *bio, gfp_t gfp_mask)
|
|
{
|
|
struct request *rq = blk_get_request(q, bio_data_dir(bio), gfp_mask);
|
|
if (IS_ERR(rq))
|
|
return rq;
|
|
cas_blk_rq_set_block_pc(rq);
|
|
rq->q = q;
|
|
for_each_bio(bio) {
|
|
struct bio *bounce_bio = bio;
|
|
int ret;
|
|
cas_blk_queue_bounce(q, &bounce_bio);
|
|
ret = cas_blk_rq_append_bio(rq, bounce_bio);
|
|
if (unlikely(ret)) {
|
|
blk_put_request(rq);
|
|
return ERR_PTR(ret);
|
|
}
|
|
}
|
|
return rq;
|
|
}"
|
|
fi
|