open-cas-linux/configure.d/2_queue_write.conf
Michal Mielewczyk 42f981918d Force ordering in configure script
To prevent using macros before they are defined, enfoce calling them in an
appropriate order.

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
2019-06-03 08:34:32 -04:00

39 lines
1.0 KiB
Bash

#!/bin/bash
#
# Copyright(c) 2012-2019 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
. `dirname $0`/conf_framework
if compile_module "blk_queue_write_cache(NULL, 0, 0)" "linux/blkdev.h"
then
add_define "CAS_CHECK_QUEUE_FLUSH(q) \\
test_bit(QUEUE_FLAG_WC, &(q)->queue_flags)"
add_define "CAS_CHECK_QUEUE_FUA(q) \\
test_bit(QUEUE_FLAG_FUA, &(q)->queue_flags)"
add_function "
static inline void cas_set_queue_flush_fua(struct request_queue *q,
bool flush, bool fua)
{
blk_queue_write_cache(q, flush, fua);
}"
elif compile_module "struct request_queue rq;rq.flush_flags" "linux/blkdev.h"
then
add_define "CAS_CHECK_QUEUE_FLUSH(q) \\
((q)->flush_flags & CAS_REQ_FLUSH)"
add_define "CAS_CHECK_QUEUE_FUA(q) \\
((q)->flush_flags & REQ_FUA)"
add_function "static inline void cas_set_queue_flush_fua(struct request_queue *q,
bool flush, bool fua)
{
unsigned int flags = 0;
if (flush)
flags |= CAS_REQ_FLUSH;
if (fua)
flags |= REQ_FUA;
if (flags)
blk_queue_flush(q, flags);
}"
fi