From 6e9079307b12abefe2e21461fd3a7be305d467a7 Mon Sep 17 00:00:00 2001 From: fanyong <fanyong> Date: Tue, 18 Dec 2007 04:27:30 +0000 Subject: [PATCH] Branch HEAD b=13814 i=oleg.drokin i=sheng.yang (1) Difine some macros and variables if "disable-server" when configure. (2) Support to compile patchless client on HEAD. (3) Comment for some code copy issue. --- lustre/autoconf/lustre-core.m4 | 1 + lustre/include/linux/lustre_acl.h | 6 ++++-- lustre/include/linux/obd.h | 3 +++ lustre/include/linux/obd_class.h | 27 +++++++++++++++++++++++++++ lustre/obdclass/hash.c | 14 +++++++++++--- lustre/obdclass/mea.c | 5 +++-- lustre/tests/statmany.c | 3 --- 7 files changed, 49 insertions(+), 10 deletions(-) diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index 5f789c1872..37cb83682e 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -1350,6 +1350,7 @@ CFLAGS="$tmp_flags" AC_DEFUN([LC_PROG_LINUX], [LC_LUSTRE_VERSION_H if test x$enable_server = xyes ; then + AC_DEFINE(HAVE_SERVER_SUPPORT, 1, [support server]) LC_CONFIG_BACKINGFS fi LC_CONFIG_PINGER diff --git a/lustre/include/linux/lustre_acl.h b/lustre/include/linux/lustre_acl.h index bbf6471aca..0583ea48f3 100644 --- a/lustre/include/linux/lustre_acl.h +++ b/lustre/include/linux/lustre_acl.h @@ -32,8 +32,10 @@ # define MDS_XATTR_NAME_ACL_ACCESS XATTR_NAME_ACL_ACCESS # define mds_xattr_acl_size(entry) xattr_acl_size(entry) # else /* HAVE_XATTR_ACL */ -# define MDS_XATTR_NAME_ACL_ACCESS POSIX_ACL_XATTR_ACCESS -# define mds_xattr_acl_size(entry) posix_acl_xattr_size(entry) +# ifdef HAVE_LINUX_POSIX_ACL_XATTR_H +# define MDS_XATTR_NAME_ACL_ACCESS POSIX_ACL_XATTR_ACCESS +# define mds_xattr_acl_size(entry) posix_acl_xattr_size(entry) +# endif /* HAVE_LINUX_POSIX_ACL_XATTR_H */ # endif /* HAVE_XATTR_ACL */ # define LUSTRE_POSIX_ACL_MAX_ENTRIES (32) diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index ba0d89e6af..5bc3c47169 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -17,6 +17,9 @@ # include <linux/smp_lock.h> # include <linux/proc_fs.h> # include <linux/mount.h> +# ifndef HAVE_VFS_INTENT_PATCHES +# include <linux/lustre_intent.h> +# endif #endif typedef spinlock_t client_obd_lock_t; diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 550d5b57b6..c7869cce37 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -39,6 +39,33 @@ #include <linux/timer.h> #endif +#ifdef __KERNEL__ +# ifndef HAVE_SERVER_SUPPORT + +/* hash info structure used by the directory hash */ +# define LDISKFS_DX_HASH_LEGACY 0 +# define LDISKFS_DX_HASH_HALF_MD4 1 +# define LDISKFS_DX_HASH_TEA 2 +# define LDISKFS_DX_HASH_R5 3 +# define LDISKFS_DX_HASH_SAME 4 +# define LDISKFS_DX_HASH_MAX 4 + +/* hash info structure used by the directory hash */ +struct ldiskfs_dx_hash_info +{ + u32 hash; + u32 minor_hash; + int hash_version; + u32 *seed; +}; + +# define LDISKFS_HTREE_EOF 0x7fffffff + +int ldiskfsfs_dirhash(const char *name, int len, struct ldiskfs_dx_hash_info *hinfo); + +# endif /* HAVE_SERVER_SUPPORT */ +#endif /* __KERNEL__ */ + void obd_zombie_impexp_init(void); void obd_zombie_impexp_cull(void); extern void (*obd_zombie_impexp_notify)(void); diff --git a/lustre/obdclass/hash.c b/lustre/obdclass/hash.c index 4775939e4e..5165e7c6ca 100644 --- a/lustre/obdclass/hash.c +++ b/lustre/obdclass/hash.c @@ -1,6 +1,4 @@ /* - * linux/fs/ldiskfs/hash.c - * * Copyright (C) 2002 by Theodore Ts'o * * This file is released under the GPL v2. @@ -9,10 +7,20 @@ * License. */ +/* + * obdclass/hash.c is copied from ldiskfs/hash.c. + * ldiskfs is used by server only. + * obdclass is shared by both client and server, it should not depend on ldiskfs. + */ + #include <linux/fs.h> #include <linux/jbd.h> #include <linux/sched.h> -#include <linux/ldiskfs_fs.h> +#ifdef HAVE_SERVER_SUPPORT +# include <linux/ldiskfs_fs.h> +#else +# include <obd_class.h> +#endif #define DELTA 0x9E3779B9 diff --git a/lustre/obdclass/mea.c b/lustre/obdclass/mea.c index 10ab6ca19f..15f15d895c 100644 --- a/lustre/obdclass/mea.c +++ b/lustre/obdclass/mea.c @@ -20,16 +20,15 @@ */ #define DEBUG_SUBSYSTEM S_CLASS +#include <obd_class.h> #ifdef __KERNEL__ #include <linux/kmod.h> /* for request_module() */ #include <linux/module.h> -#include <obd_class.h> #include <linux/random.h> #include <linux/slab.h> #include <linux/pagemap.h> #else #include <liblustre.h> -#include <obd_class.h> #include <obd.h> #endif #include <lprocfs_status.h> @@ -37,9 +36,11 @@ #ifdef __KERNEL__ #include <linux/jbd.h> +#ifdef HAVE_SERVER_SUPPORT /* LDISKFS_SB() */ #include <linux/ldiskfs_fs.h> #endif +#endif static int mea_last_char_hash(int count, char *name, int namelen) { unsigned int c; diff --git a/lustre/tests/statmany.c b/lustre/tests/statmany.c index 63a13adf77..476aed9c73 100644 --- a/lustre/tests/statmany.c +++ b/lustre/tests/statmany.c @@ -11,9 +11,6 @@ #include <limits.h> #include <sys/ioctl.h> -#if 0 -#include <linux/ldiskfs_fs.h> -#endif #include <liblustre.h> #include <lustre_lib.h> #include <obd.h> -- GitLab