From 5d57988013882e6690cc22ada148a7f215df64db Mon Sep 17 00:00:00 2001 From: Liu Xuezhao Date: Tue, 30 Oct 2012 16:59:11 +0800 Subject: [PATCH] LU-1337 llite: kernel 3.2 make_request_fn returns void 3.2 request_queue.make_request_fn defined as function returns void. (kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f) Add LC_HAVE_VOID_MAKE_REQUEST_FN/HAVE_VOID_MAKE_REQUEST_FN for check. Signed-off-by: Liu Xuezhao Change-Id: I49a27873c1754addc9fef7c5f50cbf84592adf05 Reviewed-on: http://review.whamcloud.com/3576 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 24 ++++++++++++++++++++++++ lustre/include/linux/lustre_compat25.h | 8 ++++++++ lustre/llite/lloop.c | 9 +++++---- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 02c3f10..6c94657 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1875,6 +1875,27 @@ LB_LINUX_TRY_COMPILE([ ]) # +# 3.2 request_queue.make_request_fn defined as function returns with void +# see kernel commit 5a7bbad27a410350e64a2d7f5ec18fc73836c14f +# +AC_DEFUN([LC_HAVE_VOID_MAKE_REQUEST_FN], +[AC_MSG_CHECKING([if request_queue.make_request_fn returns void but not int]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + int ret; + make_request_fn *mrf; + ret = mrf(NULL, NULL); +],[ + AC_MSG_RESULT([no]) +],[ + AC_DEFINE(HAVE_VOID_MAKE_REQUEST_FN, 1, + [request_queue.make_request_fn returns void but not int]) + AC_MSG_RESULT([yes]) +]) +]) + +# # 3.3 introduces migrate_mode.h and migratepage has 4 args # AC_DEFUN([LC_HAVE_MIGRATE_HEADER], @@ -2062,6 +2083,9 @@ AC_DEFUN([LC_PROG_LINUX], # 3.1.1 LC_BLOCKS_FOR_TRUNCATE + # 3.2 + LC_HAVE_VOID_MAKE_REQUEST_FN + # 3.3 LC_HAVE_MIGRATE_HEADER LC_MIGRATEPAGE_4ARGS diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 6670041..5c1467e 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -706,4 +706,12 @@ static inline int ll_namei_to_lookup_intent_flag(int flag) return flag; } +#ifdef HAVE_VOID_MAKE_REQUEST_FN +# define ll_mrf_ret void +# define LL_MRF_RETURN(rc) +#else +# define ll_mrf_ret int +# define LL_MRF_RETURN(rc) RETURN(rc) +#endif + #endif /* _COMPAT25_H */ diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c index 5f4dec3..59814e6 100644 --- a/lustre/llite/lloop.c +++ b/lustre/llite/lloop.c @@ -338,7 +338,8 @@ static unsigned int loop_get_bio(struct lloop_device *lo, struct bio **req) return count; } -static int loop_make_request(struct request_queue *q, struct bio *old_bio) +static ll_mrf_ret +loop_make_request(struct request_queue *q, struct bio *old_bio) { struct lloop_device *lo = q->queuedata; int rw = bio_rw(old_bio); @@ -366,10 +367,10 @@ static int loop_make_request(struct request_queue *q, struct bio *old_bio) goto err; } loop_add_bio(lo, old_bio); - return 0; + LL_MRF_RETURN(0); err: - cfs_bio_io_error(old_bio, old_bio->bi_size); - return 0; + cfs_bio_io_error(old_bio, old_bio->bi_size); + LL_MRF_RETURN(0); } #ifdef HAVE_REQUEST_QUEUE_UNPLUG_FN -- 1.8.3.1