From: yangsheng Date: Wed, 5 Dec 2012 19:50:39 +0000 (+0800) Subject: LU-1994 kernel: 3.4 kmap_atomic has one argument X-Git-Tag: 2.3.58~67 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=615b53dd36fcb205960799b7f3d7d1a21c3ce755 LU-1994 kernel: 3.4 kmap_atomic has one argument kernel 3.4 kmap_atomic removes second argument by commit 1ec9c5ddc17. Signed-off-by: Peng Tao Signed-off-by: yang sheng Change-Id: I6471291fd881c9e76833654602fa4b18fd1f1028 Reviewed-on: http://review.whamcloud.com/4384 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Yang Sheng Reviewed-by: Andreas Dilger --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 5163de2..44c72d9 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2009,6 +2009,24 @@ LB_LINUX_TRY_COMPILE([ EXTRA_KCFLAGS="$tmp_flags" ]) +# 3.4 kmap_atomic removes second argument +# see kernel commit 1ec9c5ddc17aa398f05646abfcbaf315b544e62f +# +AC_DEFUN([LC_KMAP_ATOMIC_HAS_1ARG], +[AC_MSG_CHECKING([if kmap_atomic has only 1 argument]) +LB_LINUX_TRY_COMPILE([ + #include +],[ + kmap_atomic(NULL); +],[ + AC_DEFINE(HAVE_KMAP_ATOMIC_HAS_1ARG, 1, + [have kmap_atomic has only 1 argument]) + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) +]) +]) + # # 3.4 switchs touch_atime to struct path # see kernel commit 68ac1234fb949b66941d94dce4157742799fc581 @@ -2210,6 +2228,7 @@ AC_DEFUN([LC_PROG_LINUX], # 3.4 LC_TOUCH_ATIME_1ARG LC_HAVE_D_MAKE_ROOT + LC_KMAP_ATOMIC_HAS_1ARG # if test x$enable_server = xyes ; then diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h index 600fa73..a0cdf31 100644 --- a/lustre/include/linux/lustre_compat25.h +++ b/lustre/include/linux/lustre_compat25.h @@ -625,6 +625,14 @@ static inline int ll_quota_off(struct super_block *sb, int off, int remount) #define queue_max_hw_segments(rq) queue_max_segments(rq) #endif +#ifdef HAVE_KMAP_ATOMIC_HAS_1ARG +#define ll_kmap_atomic(a, b) kmap_atomic(a) +#define ll_kunmap_atomic(a, b) kunmap_atomic(a) +#else +#define ll_kmap_atomic(a, b) kmap_atomic(a, b) +#define ll_kunmap_atomic(a, b) kunmap_atomic(a, b) +#endif + #ifndef HAVE_BI_HW_SEGMENTS #define bio_hw_segments(q, bio) 0 diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index 731b5f2..a06dfcb 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -289,11 +289,11 @@ ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, src_page = (rw == WRITE) ? pages[i] : vmpage; dst_page = (rw == WRITE) ? vmpage : pages[i]; - src = kmap_atomic(src_page, KM_USER0); - dst = kmap_atomic(dst_page, KM_USER1); + src = ll_kmap_atomic(src_page, KM_USER0); + dst = ll_kmap_atomic(dst_page, KM_USER1); memcpy(dst, src, min(page_size, size)); - kunmap_atomic(dst, KM_USER1); - kunmap_atomic(src, KM_USER0); + ll_kunmap_atomic(dst, KM_USER1); + ll_kunmap_atomic(src, KM_USER0); /* make sure page will be added to the transfer by * cl_io_submit()->...->vvp_page_prep_write(). */ diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c index ce492f7..a02c20e 100644 --- a/lustre/llite/vvp_io.c +++ b/lustre/llite/vvp_io.c @@ -931,10 +931,10 @@ static int vvp_io_prepare_partial(const struct lu_env *env, struct cl_io *io, * purposes here we can treat it like i_size. */ if (attr->cat_kms <= offset) { - char *kaddr = kmap_atomic(cp->cpg_page, KM_USER0); + char *kaddr = ll_kmap_atomic(cp->cpg_page, KM_USER0); memset(kaddr, 0, cl_page_size(obj)); - kunmap_atomic(kaddr, KM_USER0); + ll_kunmap_atomic(kaddr, KM_USER0); } else if (cp->cpg_defer_uptodate) cp->cpg_ra_used = 1; else