Whamcloud - gitweb
LU-1337 llite: kernel 3.2 make_request_fn returns void
authorLiu Xuezhao <xuezhao.liu@emc.com>
Tue, 30 Oct 2012 08:59:11 +0000 (16:59 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 7 Nov 2012 04:24:16 +0000 (23:24 -0500)
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 <xuezhao.liu@emc.com>
Change-Id: I49a27873c1754addc9fef7c5f50cbf84592adf05
Reviewed-on: http://review.whamcloud.com/3576
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Yang Sheng <yang.sheng@intel.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/autoconf/lustre-core.m4
lustre/include/linux/lustre_compat25.h
lustre/llite/lloop.c

index 02c3f10..6c94657 100644 (file)
@@ -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 <linux/blkdev.h>
+],[
+       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
index 6670041..5c1467e 100644 (file)
@@ -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 */
index 5f4dec3..59814e6 100644 (file)
@@ -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