From 5498da896a6e042178f20a5894e49578835fc6c5 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Wed, 30 Jan 2013 08:59:20 -0500 Subject: [PATCH] LU-2642 osd-ldiskfs: use struct fs_disk_quota for quotas Commit b9b2dd36 modified ->get_dqblk to use struct fs_disk_quota. (v2.6.34) Signed-off-by: James Simmons Signed-off-by: Jeff Mahoney Change-Id: Ifb8a79db37e3f88046c00eb906b8e7264005481b Reviewed-on: http://review.whamcloud.com/5118 Tested-by: Hudson Tested-by: Maloo Reviewed-by: Niu Yawei Reviewed-by: Johann Lombardi --- lustre/autoconf/lustre-core.m4 | 24 ++++++++++++++++++++++++ lustre/osd-ldiskfs/osd_internal.h | 4 ++++ lustre/osd-ldiskfs/osd_quota.c | 9 +++++++++ 3 files changed, 37 insertions(+) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index bbecaf8..afc03fa 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1114,6 +1114,27 @@ LB_LINUX_TRY_COMPILE([ ]) ]) +# 2.6.34 has quotactl_ops->[sg]et_dqblk that take struct fs_disk_quota +AC_DEFUN([LC_HAVE_DQUOT_FS_DISK_QUOTA], +tmp_flags="$EXTRA_KCFLAGS" +EXTRA_KCFLAGS="-Werror" +[AC_MSG_CHECKING([if quotactl_ops.set_dqblk takes struct fs_disk_quota]) +LB_LINUX_TRY_COMPILE([ + #include + #include +],[ + struct quotactl_ops qops = {}; + struct fs_disk_quota fdq; + qops.set_dqblk(NULL, 0, 0, &fdq); +],[ + AC_DEFINE(HAVE_DQUOT_FS_DISK_QUOTA, 1, [quotactl_ops.set_dqblk takes struct fs_disk_quota]) + AC_MSG_RESULT([yes]) +],[ + AC_MSG_RESULT([no]) +]) +EXTRA_KCFLAGS="$tmp_flags" +]) + # LC_LOCK_MAP_ACQUIRE # after 2.6.27 lock_map_acquire replaces lock_acquire AC_DEFUN([LC_LOCK_MAP_ACQUIRE], @@ -2278,6 +2299,9 @@ AC_DEFUN([LC_PROG_LINUX], LC_EXPORT_ACCESS_PROCESS_VM LC_VFS_INODE_NEWSIZE_OK + # 2.6.34 + LC_HAVE_DQUOT_FS_DISK_QUOTA + # 2.6.35, 3.0.0 LC_FILE_FSYNC LC_EXPORT_SIMPLE_SETATTR diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index ea2a1c0..60cf124 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -575,7 +575,11 @@ struct osd_thread_info { /* used by quota code */ union { +#ifdef HAVE_DQUOT_FS_DISK_QUOTA + struct fs_disk_quota oti_fdq; +#else struct if_dqblk oti_dqblk; +#endif struct if_dqinfo oti_dqinfo; }; struct lquota_id_info oti_qi; diff --git a/lustre/osd-ldiskfs/osd_quota.c b/lustre/osd-ldiskfs/osd_quota.c index 4e911e3..741516b 100644 --- a/lustre/osd-ldiskfs/osd_quota.c +++ b/lustre/osd-ldiskfs/osd_quota.c @@ -100,7 +100,11 @@ static int osd_acct_index_lookup(const struct lu_env *env, struct lustre_capa *capa) { struct osd_thread_info *info = osd_oti_get(env); +#ifdef HAVE_DQUOT_FS_DISK_QUOTA + struct fs_disk_quota *dqblk = &info->oti_fdq; +#else struct if_dqblk *dqblk = &info->oti_dqblk; +#endif struct super_block *sb = osd_sb(osd_obj2dev(osd_dt_obj(dtobj))); struct lquota_acct_rec *rec = (struct lquota_acct_rec *)dtrec; __u64 id = *((__u64 *)dtkey); @@ -112,8 +116,13 @@ static int osd_acct_index_lookup(const struct lu_env *env, rc = sb->s_qcop->get_dqblk(sb, obj2type(dtobj), (qid_t) id, dqblk); if (rc) RETURN(rc); +#ifdef HAVE_DQUOT_FS_DISK_QUOTA + rec->bspace = dqblk->d_bcount; + rec->ispace = dqblk->d_icount; +#else rec->bspace = dqblk->dqb_curspace; rec->ispace = dqblk->dqb_curinodes; +#endif RETURN(+1); } -- 1.8.3.1