From dd30f316f25ac70dba8891406d2a107dbcfcd75a Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Thu, 15 Oct 2015 12:27:21 -0400 Subject: [PATCH] LU-7311 osd: quotactl_ops has changed in kernel 3.19 The kernel 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk. Added in kernel commit 14bf61ffe. Signed-off-by: frank zago Change-Id: Ie9943d2537c137ececa03040151059e34850f5de Reviewed-on: http://review.whamcloud.com/16893 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: John L. Hammond Reviewed-by: Yang Sheng Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/autoconf/lustre-core.m4 | 25 +++++++++++++++++++++++++ lustre/osd-ldiskfs/osd_internal.h | 4 +++- lustre/osd-ldiskfs/osd_quota.c | 9 +++++++-- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 365727e..41048be 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1851,6 +1851,30 @@ ki_nbytes, [ ]) # LC_KIOCB_HAS_NBYTES # +# LC_HAVE_DQUOT_QC_DQBLK +# +# 3.19 has quotactl_ops->[sg]et_dqblk that take struct kqid and qc_dqblk +# Added in commit 14bf61ffe +# +AC_DEFUN([LC_HAVE_DQUOT_QC_DQBLK], [ +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +LB_CHECK_COMPILE([if 'quotactl_ops.set_dqblk' takes struct qc_dqblk], +qc_dqblk, [ + #include + #include +],[ + ((struct quotactl_ops *)0)->set_dqblk(NULL, *((struct kqid*)0), (struct qc_dqblk*)0); +],[ + AC_DEFINE(HAVE_DQUOT_QC_DQBLK, 1, + [quotactl_ops.set_dqblk takes struct qc_dqblk]) + AC_DEFINE(HAVE_DQUOT_KQID, 1, + [quotactl_ops.set_dqblk takes struct kqid]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) # LC_HAVE_DQUOT_QC_DQBLK + +# # LC_BACKING_DEV_INFO_REMOVAL # # 3.20 kernel removed backing_dev_info from address_space @@ -2291,6 +2315,7 @@ AC_DEFUN([LC_PROG_LINUX], [ # 3.19 LC_KIOCB_HAS_NBYTES + LC_HAVE_DQUOT_QC_DQBLK # 3.20 LC_BACKING_DEV_INFO_REMOVAL diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index 1280721..d44e389 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -607,7 +607,9 @@ struct osd_thread_info { /* used by quota code */ union { -#ifdef HAVE_DQUOT_FS_DISK_QUOTA +#if defined(HAVE_DQUOT_QC_DQBLK) + struct qc_dqblk oti_qdq; +#elif defined(HAVE_DQUOT_FS_DISK_QUOTA) struct fs_disk_quota oti_fdq; #else struct if_dqblk oti_dqblk; diff --git a/lustre/osd-ldiskfs/osd_quota.c b/lustre/osd-ldiskfs/osd_quota.c index 57b7733..e426b43 100644 --- a/lustre/osd-ldiskfs/osd_quota.c +++ b/lustre/osd-ldiskfs/osd_quota.c @@ -102,7 +102,9 @@ static int osd_acct_index_lookup(const struct lu_env *env, const struct dt_key *dtkey) { struct osd_thread_info *info = osd_oti_get(env); -#ifdef HAVE_DQUOT_FS_DISK_QUOTA +#if defined(HAVE_DQUOT_QC_DQBLK) + struct qc_dqblk *dqblk = &info->oti_qdq; +#elif defined(HAVE_DQUOT_FS_DISK_QUOTA) struct fs_disk_quota *dqblk = &info->oti_fdq; #else struct if_dqblk *dqblk = &info->oti_dqblk; @@ -126,7 +128,10 @@ static int osd_acct_index_lookup(const struct lu_env *env, #endif if (rc) RETURN(rc); -#ifdef HAVE_DQUOT_FS_DISK_QUOTA +#if defined(HAVE_DQUOT_QC_DQBLK) + rec->bspace = dqblk->d_space; + rec->ispace = dqblk->d_ino_count; +#elif defined(HAVE_DQUOT_FS_DISK_QUOTA) rec->bspace = dqblk->d_bcount; rec->ispace = dqblk->d_icount; #else -- 1.8.3.1