From dd070524bb3c42dd6dbb90519fe292a68a69b636 Mon Sep 17 00:00:00 2001 From: Yang Sheng Date: Wed, 14 Mar 2018 17:36:48 +0800 Subject: [PATCH] LU-10565 osd: bi_error, pagevec_init, PAGE_CACHE_SHIFT changes - bi_error replace to bi_status in bio - pagevec_init takes one parameter - PAGE_CACHE_SHIFT be removed Signed-off-by: Yang Sheng Change-Id: Ia04124d6d636d132550a63e1f8144c26cab39f8e Reviewed-on: https://review.whamcloud.com/31644 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Dmitry Eremin Reviewed-by: John L. Hammond Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 38 ++++++++++++++++++++++++++++++++++++++ lustre/include/lustre_idmap.h | 2 ++ lustre/osd-ldiskfs/osd_io.c | 12 ++++++++++-- 3 files changed, 50 insertions(+), 2 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 6ef83ff..3836357 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -2752,6 +2752,40 @@ super_setup_bdi_name, [ ]) # LC_SUPER_SETUP_BDI_NAME # +# LC_BI_STATUS +# +# 4.12 replace bi_error to bi_status +# +AC_DEFUN([LC_BI_STATUS], [ +LB_CHECK_COMPILE([if 'bi_status' exist], +bi_status, [ + #include +],[ + ((struct bio *)0)->bi_status = 0; +],[ + AC_DEFINE(HAVE_BI_STATUS, 1, + ['bi_status' is available]) +]) +]) # LC_BI_STATUS + +# +# LC_PAGEVEC_INIT_ONE_PARAM +# +# 4.14 pagevec_init takes one parameter +# +AC_DEFUN([LC_PAGEVEC_INIT_ONE_PARAM], [ +LB_CHECK_COMPILE([if 'pagevec_init' takes one parameter], +pagevec_init, [ + #include +],[ + pagevec_init(NULL); +],[ + AC_DEFINE(HAVE_PAGEVEC_INIT_ONE_PARAM, 1, + ['pagevec_init' takes one parameter]) +]) +]) # LC_PAGEVEC_INIT_ONE_PARAM + +# # LC_PROG_LINUX # # Lustre linux kernel checks @@ -2977,6 +3011,10 @@ AC_DEFUN([LC_PROG_LINUX], [ # 4.12 LC_CURRENT_TIME LC_SUPER_SETUP_BDI_NAME + LC_BI_STATUS + + # 4.14 + LC_PAGEVEC_INIT_ONE_PARAM # AS_IF([test "x$enable_server" != xno], [ diff --git a/lustre/include/lustre_idmap.h b/lustre/include/lustre_idmap.h index 363e448..a8c5a21 100644 --- a/lustre/include/lustre_idmap.h +++ b/lustre/include/lustre_idmap.h @@ -58,6 +58,8 @@ #endif /* HAVE_GROUP_INFO_GID */ +#include + struct lu_ucred; extern void lustre_groups_from_list(struct group_info *ginfo, gid_t *glist); diff --git a/lustre/osd-ldiskfs/osd_io.c b/lustre/osd-ldiskfs/osd_io.c index 1d0303a..914c934 100644 --- a/lustre/osd-ldiskfs/osd_io.c +++ b/lustre/osd-ldiskfs/osd_io.c @@ -140,7 +140,11 @@ void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf) #ifdef HAVE_BIO_ENDIO_USES_ONE_ARG static void dio_complete_routine(struct bio *bio) { +# ifdef HAVE_BI_STATUS + int error = bio->bi_status; +# else int error = bio->bi_error; +# endif #else static void dio_complete_routine(struct bio *bio, int error) { @@ -493,7 +497,11 @@ static int osd_bufs_put(const struct lu_env *env, struct dt_object *dt, struct pagevec pvec; int i; +#ifdef HAVE_PAGEVEC_INIT_ONE_PARAM + pagevec_init(&pvec); +#else pagevec_init(&pvec, 0); +#endif for (i = 0; i < npages; i++) { if (lnb[i].lnb_page == NULL) @@ -2008,8 +2016,8 @@ static int osd_ladvise(const struct lu_env *env, struct dt_object *dt, if (end == 0) break; invalidate_mapping_pages(inode->i_mapping, - start >> PAGE_CACHE_SHIFT, - (end - 1) >> PAGE_CACHE_SHIFT); + start >> PAGE_SHIFT, + (end - 1) >> PAGE_SHIFT); break; default: rc = -ENOTSUPP; -- 1.8.3.1