From 1f1d3a376d488d715dd1b0c94d5b66ea05c1e6ca Mon Sep 17 00:00:00 2001 From: "John L. Hammond" Date: Fri, 15 Aug 2014 09:45:09 -0500 Subject: [PATCH] LU-2675 build: assume __linux__ and __KERNEL__ Assume that __linux__is defined everywhere and that __KERNEL__ is defined in most of lustre/. Signed-off-by: John L. Hammond Change-Id: Ia04e7ed4c3ab3e8ca205e14eaa1824536aedd1e3 Reviewed-on: http://review.whamcloud.com/11437 Reviewed-by: Bob Glossman Tested-by: Jenkins Reviewed-by: Oleg Drokin Tested-by: Oleg Drokin --- libcfs/include/libcfs/bitmap.h | 4 +- libcfs/include/libcfs/err.h | 2 +- libcfs/include/libcfs/libcfs.h | 16 +- libcfs/include/libcfs/libcfs_cpu.h | 4 +- libcfs/include/libcfs/libcfs_debug.h | 4 - libcfs/include/libcfs/libcfs_hash.h | 36 ++-- libcfs/include/libcfs/libcfs_private.h | 5 - libcfs/include/libcfs/list.h | 10 +- libcfs/include/libcfs/posix/libcfs.h | 96 +++++----- libcfs/include/libcfs/util/platform.h | 25 --- libcfs/libcfs/tracefile.h | 12 +- libcfs/libcfs/user-prim.c | 12 -- lnet/include/lnet/api-support.h | 4 - lnet/include/lnet/lib-lnet.h | 4 - lnet/include/lnet/lib-types.h | 4 - lnet/include/lnet/lnet.h | 4 - lnet/klnds/socklnd/socklnd.h | 4 - lnet/utils/debug.c | 4 - lustre/fld/fld_cache.c | 12 +- lustre/fld/fld_index.c | 9 +- lustre/fld/fld_internal.h | 2 - lustre/fld/fld_request.c | 25 +-- lustre/fld/lproc_fld.c | 9 +- lustre/include/cl_object.h | 9 +- lustre/include/linux/lustre_debug.h | 6 - lustre/include/linux/lustre_dlm.h | 8 +- lustre/include/linux/lustre_handles.h | 2 - lustre/include/linux/lustre_lib.h | 21 +-- lustre/include/linux/lustre_lite.h | 10 -- lustre/include/linux/lustre_net.h | 7 - lustre/include/linux/lustre_quota.h | 2 - lustre/include/linux/lvfs.h | 6 - lustre/include/linux/obd.h | 26 ++- lustre/include/linux/obd_class.h | 8 - lustre/include/lprocfs_status.h | 7 - lustre/include/lustre/lustre_user.h | 4 - lustre/include/lustre_acl.h | 2 - lustre/include/lustre_capa.h | 6 - lustre/include/lustre_debug.h | 4 - lustre/include/lustre_dlm.h | 4 - lustre/include/lustre_handles.h | 9 - lustre/include/lustre_lib.h | 58 ------ lustre/include/lustre_lite.h | 11 -- lustre/include/lustre_log.h | 4 - lustre/include/lustre_mdc.h | 14 +- lustre/include/lustre_net.h | 70 ++------ lustre/include/lustre_nrs_tbf.h | 2 - lustre/include/lustre_quota.h | 2 - lustre/include/lvfs.h | 4 - lustre/include/obd.h | 7 - lustre/include/obd_cache.h | 2 - lustre/include/obd_class.h | 11 -- lustre/include/obd_support.h | 4 - lustre/ldlm/l_lock.c | 4 - lustre/ldlm/ldlm_extent.c | 6 +- lustre/ldlm/ldlm_flock.c | 5 - lustre/ldlm/ldlm_inodebits.c | 3 - lustre/ldlm/ldlm_lib.c | 16 +- lustre/ldlm/ldlm_lock.c | 11 +- lustre/ldlm/ldlm_lockd.c | 67 ++----- lustre/ldlm/ldlm_plain.c | 4 - lustre/ldlm/ldlm_pool.c | 22 +-- lustre/ldlm/ldlm_request.c | 21 +-- lustre/ldlm/ldlm_resource.c | 7 +- lustre/mdc/mdc_internal.h | 2 - lustre/mdc/mdc_lib.c | 14 -- lustre/mdc/mdc_locks.c | 11 +- lustre/mdc/mdc_reint.c | 8 +- lustre/mdc/mdc_request.c | 64 +------ lustre/mdt/mdt_internal.h | 2 - lustre/mgc/mgc_request.c | 2 - lustre/mgs/mgs_nids.c | 2 - lustre/obdclass/capa.c | 8 - lustre/obdclass/cl_io.c | 11 +- lustre/obdclass/class_obd.c | 39 +---- lustre/obdclass/debug.c | 3 - lustre/obdclass/genops.c | 41 ----- lustre/obdclass/linux/linux-module.c | 14 -- lustre/obdclass/llog.c | 12 -- lustre/obdclass/llog_cat.c | 3 - lustre/obdclass/llog_obd.c | 3 - lustre/obdclass/llog_swab.c | 3 - lustre/obdclass/lprocfs_counters.c | 4 - lustre/obdclass/lprocfs_jobstats.c | 3 - lustre/obdclass/lprocfs_status.c | 3 - lustre/obdclass/lprocfs_status_server.c | 3 - lustre/obdclass/lu_object.c | 11 +- lustre/obdclass/lu_ref.c | 19 +- lustre/obdclass/lustre_handles.c | 12 -- lustre/obdclass/lustre_peer.c | 3 - lustre/obdclass/obd_config.c | 29 +-- lustre/obdclass/obdo.c | 6 - lustre/obdclass/statfs_pack.c | 3 - lustre/obdclass/uuid.c | 8 +- lustre/obdecho/echo_client.c | 6 - lustre/obdecho/echo_internal.h | 12 +- lustre/osc/osc_cl_internal.h | 7 +- lustre/osc/osc_io.c | 10 -- lustre/osc/osc_lock.c | 8 +- lustre/osc/osc_quota.c | 3 - lustre/osc/osc_request.c | 10 -- lustre/osd-ldiskfs/osd_dynlocks.c | 2 - lustre/osd-ldiskfs/osd_iam.h | 2 - lustre/osd-ldiskfs/osd_internal.h | 2 - lustre/osd-ldiskfs/osd_oi.h | 2 - lustre/ptlrpc/client.c | 7 - lustre/ptlrpc/connection.c | 4 - lustre/ptlrpc/errno.c | 4 - lustre/ptlrpc/events.c | 195 +-------------------- lustre/ptlrpc/gss/gss_bulk.c | 4 - lustre/ptlrpc/gss/gss_cli_upcall.c | 4 - lustre/ptlrpc/gss/gss_generic_token.c | 4 - lustre/ptlrpc/gss/gss_keyring.c | 4 - lustre/ptlrpc/gss/gss_krb5_mech.c | 4 - lustre/ptlrpc/gss/gss_mech_switch.c | 4 - lustre/ptlrpc/gss/gss_null_mech.c | 4 - lustre/ptlrpc/gss/gss_pipefs.c | 4 - lustre/ptlrpc/gss/gss_sk_mech.c | 4 - lustre/ptlrpc/gss/gss_svc_upcall.c | 4 - lustre/ptlrpc/gss/lproc_gss.c | 4 - lustre/ptlrpc/gss/sec_gss.c | 4 - lustre/ptlrpc/import.c | 24 --- lustre/ptlrpc/layout.c | 4 - lustre/ptlrpc/llog_client.c | 4 - lustre/ptlrpc/llog_net.c | 4 - lustre/ptlrpc/llog_server.c | 40 ----- lustre/ptlrpc/lproc_ptlrpc.c | 3 - lustre/ptlrpc/niobuf.c | 5 - lustre/ptlrpc/nrs.c | 11 +- lustre/ptlrpc/nrs_crr.c | 3 - lustre/ptlrpc/nrs_fifo.c | 3 - lustre/ptlrpc/nrs_tbf.c | 3 - lustre/ptlrpc/pack_generic.c | 3 - lustre/ptlrpc/pers.c | 56 ------ lustre/ptlrpc/pinger.c | 301 -------------------------------- lustre/ptlrpc/ptlrpc_internal.h | 10 +- lustre/ptlrpc/ptlrpc_module.c | 5 - lustre/ptlrpc/ptlrpcd.c | 98 +---------- lustre/ptlrpc/recover.c | 7 +- lustre/ptlrpc/sec.c | 11 -- lustre/ptlrpc/sec_bulk.c | 26 --- lustre/ptlrpc/sec_config.c | 9 - lustre/ptlrpc/sec_ctx.c | 2 - lustre/ptlrpc/sec_gc.c | 22 --- lustre/ptlrpc/sec_lproc.c | 23 --- lustre/ptlrpc/sec_null.c | 3 - lustre/ptlrpc/sec_plain.c | 22 --- lustre/ptlrpc/service.c | 114 ------------ lustre/ptlrpc/wirehdr.c | 13 +- lustre/ptlrpc/wiretest.c | 18 +- lustre/tests/checkfiemap.c | 6 +- lustre/utils/mount_utils_ldiskfs.c | 2 - lustre/utils/wiretest.c | 4 +- snmp/lustre-snmp-trap.c | 2 - snmp/lustre-snmp-util.c | 2 - 155 files changed, 212 insertions(+), 2122 deletions(-) diff --git a/libcfs/include/libcfs/bitmap.h b/libcfs/include/libcfs/bitmap.h index c74726b..94fa75d 100644 --- a/libcfs/include/libcfs/bitmap.h +++ b/libcfs/include/libcfs/bitmap.h @@ -36,13 +36,13 @@ #ifndef _LIBCFS_BITMAP_H_ #define _LIBCFS_BITMAP_H_ -#if !defined(__linux__) || !defined(__KERNEL__) +#ifndef __KERNEL__ #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, 8 * sizeof(long)) #define DECLARE_BITMAP(name, bits) \ unsigned long name[BITS_TO_LONGS(bits)] -#endif +#endif /* !__KERNEL__ */ typedef struct { unsigned int size; diff --git a/libcfs/include/libcfs/err.h b/libcfs/include/libcfs/err.h index 3d24510..36e9dc6 100644 --- a/libcfs/include/libcfs/err.h +++ b/libcfs/include/libcfs/err.h @@ -26,7 +26,7 @@ #ifndef LIBCFS_ERR_H_ #define LIBCFS_ERR_H_ -#if defined(__linux__) && defined(__KERNEL__) +#ifdef __KERNEL__ # include #else /* __KERNEL__ */ diff --git a/libcfs/include/libcfs/libcfs.h b/libcfs/include/libcfs/libcfs.h index e8395f1..76117da 100644 --- a/libcfs/include/libcfs/libcfs.h +++ b/libcfs/include/libcfs/libcfs.h @@ -37,19 +37,13 @@ #ifndef __LIBCFS_LIBCFS_H__ #define __LIBCFS_LIBCFS_H__ -#if !__GNUC__ -#define __attribute__(x) -#endif - #include -#if !defined(__KERNEL__) -#include -#elif defined(__linux__) -#include -#else -#error Unsupported operating system. -#endif +#ifdef __KERNEL__ +# include +#else /* __KERNEL__ */ +# include +#endif /* !__KERNEL__ */ #include "curproc.h" diff --git a/libcfs/include/libcfs/libcfs_cpu.h b/libcfs/include/libcfs/libcfs_cpu.h index 891fc21..9751069 100644 --- a/libcfs/include/libcfs/libcfs_cpu.h +++ b/libcfs/include/libcfs/libcfs_cpu.h @@ -77,7 +77,7 @@ #ifndef HAVE_LIBCFS_CPT -#if !defined(__linux__) || !defined(__KERNEL__) +#ifndef __KERNEL__ typedef struct nodemask { DECLARE_BITMAP(bits, 1); } nodemask_t; typedef struct cpumask { DECLARE_BITMAP(bits, 1); } cpumask_t; @@ -86,7 +86,7 @@ static __always_inline void __node_set(int node, nodemask_t *dstp) { set_bit(node, dstp->bits); } -#endif +#endif /* __KERNEL__ */ struct cfs_cpt_table { /* # of CPU partitions */ diff --git a/libcfs/include/libcfs/libcfs_debug.h b/libcfs/include/libcfs/libcfs_debug.h index 009e63a..745236e 100644 --- a/libcfs/include/libcfs/libcfs_debug.h +++ b/libcfs/include/libcfs/libcfs_debug.h @@ -299,7 +299,6 @@ do { \ goto label; \ } while (0) -#if defined(__GNUC__) long libcfs_log_return(struct libcfs_debug_msg_data *, long rc); #if BITS_PER_LONG > 32 @@ -334,9 +333,6 @@ do { \ } while (0) #endif /* BITS_PER_LONG > 32 */ -#else -# error "Unkown compiler" -#endif /* __GNUC__ */ #define ENTRY \ ENTRY_NESTING; \ diff --git a/libcfs/include/libcfs/libcfs_hash.h b/libcfs/include/libcfs/libcfs_hash.h index 444053d..3104173 100644 --- a/libcfs/include/libcfs/libcfs_hash.h +++ b/libcfs/include/libcfs/libcfs_hash.h @@ -63,27 +63,27 @@ * we'll need to move the functions to archi specific headers. */ -#if (defined __linux__ && defined __KERNEL__) -#include -#else +#ifdef __KERNEL__ +# include +#else /* __KERNEL__ */ /* Fast hashing routine for a long. (C) 2002 William Lee Irwin III, IBM */ -#if BITS_PER_LONG == 32 +# if BITS_PER_LONG == 32 /* 2^31 + 2^29 - 2^25 + 2^22 - 2^19 - 2^16 + 1 */ -#define CFS_GOLDEN_RATIO_PRIME CFS_GOLDEN_RATIO_PRIME_32 -#elif BITS_PER_LONG == 64 +# define CFS_GOLDEN_RATIO_PRIME CFS_GOLDEN_RATIO_PRIME_32 +# elif BITS_PER_LONG == 64 /* 2^63 + 2^61 - 2^57 + 2^54 - 2^51 - 2^18 + 1 */ -#define CFS_GOLDEN_RATIO_PRIME CFS_GOLDEN_RATIO_PRIME_64 -#else -#error Define CFS_GOLDEN_RATIO_PRIME for your wordsize. -#endif +# define CFS_GOLDEN_RATIO_PRIME CFS_GOLDEN_RATIO_PRIME_64 +# else +# error Define CFS_GOLDEN_RATIO_PRIME for your wordsize. +# endif /* BITS_PER_LONG == 64 */ static inline unsigned long hash_long(unsigned long val, unsigned int bits) { unsigned long hash = val; -#if BITS_PER_LONG == 64 +# if BITS_PER_LONG == 64 /* Sigh, gcc can't optimise this alone like it does for 32 bits. */ unsigned long n = hash; n <<= 18; @@ -98,23 +98,15 @@ static inline unsigned long hash_long(unsigned long val, unsigned int bits) hash += n; n <<= 2; hash += n; -#else +# else /* BITS_PER_LONG == 64 */ /* On some cpus multiply is faster, on others gcc will do shifts */ hash *= CFS_GOLDEN_RATIO_PRIME; -#endif +# endif /* BITS_PER_LONG != 64 */ /* High bits are more random, so use them. */ return hash >> (BITS_PER_LONG - bits); } -#if 0 -static inline unsigned long hash_ptr(void *ptr, unsigned int bits) -{ - return hash_long((unsigned long)ptr, bits); -} -#endif - -/* !(__linux__ && __KERNEL__) */ -#endif +#endif /* !__KERNEL__ */ /** disable debug */ #define CFS_HASH_DEBUG_NONE 0 diff --git a/libcfs/include/libcfs/libcfs_private.h b/libcfs/include/libcfs/libcfs_private.h index 8245c5b..0673b40 100644 --- a/libcfs/include/libcfs/libcfs_private.h +++ b/libcfs/include/libcfs/libcfs_private.h @@ -311,13 +311,8 @@ int libcfs_debug_cleanup(void); * build go below this comment. Actual compiler/compiler version * specific implementations come from the above header files */ -#ifdef __GNUC__ #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) -#else -#define likely(x) (!!(x)) -#define unlikely(x) (!!(x)) -#endif /* !__KERNEL__ */ #endif diff --git a/libcfs/include/libcfs/list.h b/libcfs/include/libcfs/list.h index 6dca9ad..8419796 100644 --- a/libcfs/include/libcfs/list.h +++ b/libcfs/include/libcfs/list.h @@ -23,11 +23,9 @@ #ifndef __LIBCFS_LIST_H__ #define __LIBCFS_LIST_H__ -#if defined (__linux__) && defined(__KERNEL__) - -#include - -#else /* !defined (__linux__) || !defined(__KERNEL__) */ +#ifdef __KERNEL__ +# include +#else /* __KERNEL__ */ /* * Simple doubly linked list implementation. @@ -443,7 +441,7 @@ static inline void hlist_add_after(struct hlist_node *n, /* @} */ -#endif /* __linux__ && __KERNEL__ */ +#endif /* __KERNEL__ */ #ifndef list_for_each_prev /** diff --git a/libcfs/include/libcfs/posix/libcfs.h b/libcfs/include/libcfs/posix/libcfs.h index d19d12f..6dec16b 100644 --- a/libcfs/include/libcfs/posix/libcfs.h +++ b/libcfs/include/libcfs/posix/libcfs.h @@ -105,69 +105,61 @@ #include #include -# define do_gettimeofday(tv) gettimeofday(tv, NULL); +#define do_gettimeofday(tv) gettimeofday(tv, NULL); typedef unsigned long long cfs_cycles_t; /* this goes in posix-fs.h */ #include -#ifdef __linux__ #include -#endif #define fget(x) NULL #define fput(f) do {} while (0) -#ifdef __linux__ /* Userpace byte flipping */ -# include -# include -# define __swab16(x) bswap_16(x) -# define __swab32(x) bswap_32(x) -# define __swab64(x) bswap_64(x) -# define __swab16s(x) do {*(x) = bswap_16(*(x));} while (0) -# define __swab32s(x) do {*(x) = bswap_32(*(x));} while (0) -# define __swab64s(x) do {*(x) = bswap_64(*(x));} while (0) -# if __BYTE_ORDER == __LITTLE_ENDIAN -# define le16_to_cpu(x) (x) -# define cpu_to_le16(x) (x) -# define le32_to_cpu(x) (x) -# define cpu_to_le32(x) (x) -# define le64_to_cpu(x) (x) -# define cpu_to_le64(x) (x) - -# define be16_to_cpu(x) bswap_16(x) -# define cpu_to_be16(x) bswap_16(x) -# define be32_to_cpu(x) bswap_32(x) -# define cpu_to_be32(x) bswap_32(x) -# define be64_to_cpu(x) (__u64)bswap_64(x) -# define cpu_to_be64(x) (__u64)bswap_64(x) -# else -# if __BYTE_ORDER == __BIG_ENDIAN -# define le16_to_cpu(x) bswap_16(x) -# define cpu_to_le16(x) bswap_16(x) -# define le32_to_cpu(x) bswap_32(x) -# define cpu_to_le32(x) bswap_32(x) -# define le64_to_cpu(x) (__u64)bswap_64(x) -# define cpu_to_le64(x) (__u64)bswap_64(x) - -# define be16_to_cpu(x) (x) -# define cpu_to_be16(x) (x) -# define be32_to_cpu(x) (x) -# define cpu_to_be32(x) (x) -# define be64_to_cpu(x) (x) -# define cpu_to_be64(x) (x) - -# else -# error "Unknown byte order" -# endif /* __BIG_ENDIAN */ -# endif /* __LITTLE_ENDIAN */ -#endif - -# ifndef THREAD_SIZE /* x86_64 linux has THREAD_SIZE in userspace */ -# define THREAD_SIZE 8192 -# else -# endif +#include +#include +#define __swab16(x) bswap_16(x) +#define __swab32(x) bswap_32(x) +#define __swab64(x) bswap_64(x) +#define __swab16s(x) do {*(x) = bswap_16(*(x));} while (0) +#define __swab32s(x) do {*(x) = bswap_32(*(x));} while (0) +#define __swab64s(x) do {*(x) = bswap_64(*(x));} while (0) +#if __BYTE_ORDER == __LITTLE_ENDIAN +# define le16_to_cpu(x) (x) +# define cpu_to_le16(x) (x) +# define le32_to_cpu(x) (x) +# define cpu_to_le32(x) (x) +# define le64_to_cpu(x) (x) +# define cpu_to_le64(x) (x) + +# define be16_to_cpu(x) bswap_16(x) +# define cpu_to_be16(x) bswap_16(x) +# define be32_to_cpu(x) bswap_32(x) +# define cpu_to_be32(x) bswap_32(x) +# define be64_to_cpu(x) ((__u64)bswap_64(x)) +# define cpu_to_be64(x) ((__u64)bswap_64(x)) +#elif __BYTE_ORDER == __BIG_ENDIAN +# define le16_to_cpu(x) bswap_16(x) +# define cpu_to_le16(x) bswap_16(x) +# define le32_to_cpu(x) bswap_32(x) +# define cpu_to_le32(x) bswap_32(x) +# define le64_to_cpu(x) ((__u64)bswap_64(x)) +# define cpu_to_le64(x) ((__u64)bswap_64(x)) + +# define be16_to_cpu(x) (x) +# define cpu_to_be16(x) (x) +# define be32_to_cpu(x) (x) +# define cpu_to_be32(x) (x) +# define be64_to_cpu(x) (x) +# define cpu_to_be64(x) (x) +#else /* __BYTE_ORDER == __BIG_ENDIAN */ +# error "Unknown byte order" +#endif /* __BYTE_ORDER != __BIG_ENDIAN */ + +#ifndef THREAD_SIZE /* x86_64 linux has THREAD_SIZE in userspace */ +# define THREAD_SIZE 8192 +#endif /* THREAD_SIZE */ #define CFS_CHECK_STACK(msgdata, mask, cdls) do {} while(0) #define CDEBUG_STACK() (0L) diff --git a/libcfs/include/libcfs/util/platform.h b/libcfs/include/libcfs/util/platform.h index c2154e1..62aaf3f 100644 --- a/libcfs/include/libcfs/util/platform.h +++ b/libcfs/include/libcfs/util/platform.h @@ -40,7 +40,6 @@ #ifndef __LUSTRE_UTILS_PLATFORM_H #define __LUSTRE_UTILS_PLATFORM_H -#ifdef __linux__ #ifdef HAVE_LIBREADLINE #define READLINE_LIBRARY @@ -73,29 +72,5 @@ typedef pthread_cond_t l_cond_t; #define l_cond_wait(c, s) pthread_cond_wait(c, s) #endif -#else /* other platform */ - -#ifdef HAVE_LIBREADLINE -#define READLINE_LIBRARY -#include -#endif /* HAVE_LIBREADLINE */ -#include -#include -#if HAVE_LIBPTHREAD -#include -#include -#include - -typedef pthread_mutex_t l_mutex_t; -typedef pthread_cond_t l_cond_t; -#define l_mutex_init(s) pthread_mutex_init(s, NULL) -#define l_mutex_lock(s) pthread_mutex_lock(s) -#define l_mutex_unlock(s) pthread_mutex_unlock(s) -#define l_cond_init(c) pthread_cond_init(c, NULL) -#define l_cond_broadcast(c) pthread_cond_broadcast(c) -#define l_cond_wait(c, s) pthread_cond_wait(c, s) -#endif /* HAVE_LIBPTHREAD */ - -#endif /* __linux__ */ #endif diff --git a/libcfs/libcfs/tracefile.h b/libcfs/libcfs/tracefile.h index 9ba2ff7..ca7f904 100644 --- a/libcfs/libcfs/tracefile.h +++ b/libcfs/libcfs/tracefile.h @@ -40,14 +40,10 @@ #include #ifdef __KERNEL__ -#if defined(__linux__) -#include "linux/linux-tracefile.h" -#else -#error Unsupported operating system. -#endif -#else -#include "posix/posix-tracefile.h" -#endif +# include "linux/linux-tracefile.h" +#else /* __KERNEL__ */ +# include "posix/posix-tracefile.h" +#endif /* !__KERNEL__ */ /* trace file lock routines */ #define TRACEFILE_NAME_SIZE 1024 diff --git a/libcfs/libcfs/user-prim.c b/libcfs/libcfs/user-prim.c index a912c94..2066499 100644 --- a/libcfs/libcfs/user-prim.c +++ b/libcfs/libcfs/user-prim.c @@ -362,7 +362,6 @@ void cfs_clear_sigpending(void) return; } -#ifdef __linux__ /* * In glibc (NOT in Linux, so check above is not right), implement @@ -383,17 +382,6 @@ void *cfs_stack_trace_frame(struct cfs_stack_trace *trace, int frame_no) return NULL; } -#else - -void cfs_stack_trace_fill(struct cfs_stack_trace *trace) -{} -void *cfs_stack_trace_frame(struct cfs_stack_trace *trace, int frame_no) -{ - return NULL; -} - -/* __linux__ */ -#endif void lbug_with_loc(struct libcfs_debug_msg_data *msgdata) { diff --git a/lnet/include/lnet/api-support.h b/lnet/include/lnet/api-support.h index 650435c..bdd4ff0 100644 --- a/lnet/include/lnet/api-support.h +++ b/lnet/include/lnet/api-support.h @@ -35,11 +35,7 @@ #ifndef __LNET_API_SUPPORT_H__ #define __LNET_API_SUPPORT_H__ -#if defined(__linux__) #include -#else -#error Unsupported Operating System -#endif #include #include diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index 49f3fa7..5c5a30d 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -41,11 +41,7 @@ #ifndef __LNET_LIB_LNET_H__ #define __LNET_LIB_LNET_H__ -#if defined(__linux__) #include -#else -#error Unsupported Operating System -#endif #include #include diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index f65d90c..21d2636 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -42,11 +42,7 @@ #ifndef __LNET_LIB_TYPES_H__ #define __LNET_LIB_TYPES_H__ -#if defined(__linux__) #include -#else -#error Unsupported Operating System -#endif #include #include diff --git a/lnet/include/lnet/lnet.h b/lnet/include/lnet/lnet.h index 8b07c24..85eb9d6 100644 --- a/lnet/include/lnet/lnet.h +++ b/lnet/include/lnet/lnet.h @@ -40,11 +40,7 @@ * * User application interface file */ -#if defined(__linux__) #include -#else -#error Unsupported Operating System -#endif #include #include diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h index c67f717..a795a96e 100644 --- a/lnet/klnds/socklnd/socklnd.h +++ b/lnet/klnds/socklnd/socklnd.h @@ -28,11 +28,7 @@ #define DEBUG_PORTAL_ALLOC #define DEBUG_SUBSYSTEM S_LND -#if defined(__linux__) #include "socklnd_lib-linux.h" -#else -#error Unsupported Operating System -#endif #include #include diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index 8702818..b87b43c 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -59,7 +59,6 @@ static int debug_mask = ~0; static const char *libcfs_debug_subsystems[] = LIBCFS_DEBUG_SUBSYS_NAMES; static const char *libcfs_debug_masks[] = LIBCFS_DEBUG_MASKS_NAMES; -#ifdef __linux__ #define DAEMON_CTL_NAME "/proc/sys/lnet/daemon_file" #define SUBSYS_DEBUG_CTL_NAME "/proc/sys/lnet/subsystem_debug" @@ -93,9 +92,6 @@ dbg_write_cmd(int fd, char *str, int len) return (rc == len ? 0 : 1); } -#else -#error - Unknown sysctl convention. -#endif static int do_debug_mask(char *name, int enable) { diff --git a/lustre/fld/fld_cache.c b/lustre/fld/fld_cache.c index bb42482..9d8c52f 100644 --- a/lustre/fld/fld_cache.c +++ b/lustre/fld/fld_cache.c @@ -43,15 +43,9 @@ #define DEBUG_SUBSYSTEM S_FLD -#ifdef __KERNEL__ -# include -# include -# include -#else /* __KERNEL__ */ -# include -# include -#endif - +#include +#include +#include #include #include #include "fld_internal.h" diff --git a/lustre/fld/fld_index.c b/lustre/fld/fld_index.c index 48b00d0..0d04fc2 100644 --- a/lustre/fld/fld_index.c +++ b/lustre/fld/fld_index.c @@ -41,13 +41,8 @@ #define DEBUG_SUBSYSTEM S_FLD -#ifdef __KERNEL__ -# include -# include -#else /* __KERNEL__ */ -# include -#endif - +#include +#include #include #include #include diff --git a/lustre/fld/fld_internal.h b/lustre/fld/fld_internal.h index 9267937..43b2f5b 100644 --- a/lustre/fld/fld_internal.h +++ b/lustre/fld/fld_internal.h @@ -148,7 +148,6 @@ enum { extern struct lu_fld_hash fld_hash[]; -#ifdef __KERNEL__ #ifdef LPROCFS extern struct proc_dir_entry *fld_type_proc_dir; @@ -198,7 +197,6 @@ extern struct lprocfs_seq_vars fld_server_proc_list[]; int fld_client_rpc(struct obd_export *exp, struct lu_seq_range *range, __u32 fld_op, struct ptlrpc_request **reqp); -#endif /* __KERNEL__ */ struct fld_cache *fld_cache_init(const char *name, int cache_size, int cache_threshold); diff --git a/lustre/fld/fld_request.c b/lustre/fld/fld_request.c index 832d1f8..33c5f97 100644 --- a/lustre/fld/fld_request.c +++ b/lustre/fld/fld_request.c @@ -42,14 +42,9 @@ #define DEBUG_SUBSYSTEM S_FLD -#ifdef __KERNEL__ -# include -# include -# include -#else /* __KERNEL__ */ -# include -# include -#endif +#include +#include +#include #include #include @@ -275,7 +270,7 @@ void fld_client_proc_fini(struct lu_client_fld *fld) } EXIT; } -#else +#else /* LPROCFS */ static int fld_client_proc_init(struct lu_client_fld *fld) { return 0; @@ -285,7 +280,7 @@ void fld_client_proc_fini(struct lu_client_fld *fld) { return; } -#endif +#endif /* !LPROCFS */ EXPORT_SYMBOL(fld_client_proc_fini); @@ -494,12 +489,12 @@ int fld_client_lookup(struct lu_client_fld *fld, u64 seq, u32 *mds, res.lsr_start = seq; fld_range_set_type(&res, flags); -#if defined(__KERNEL__) && defined(HAVE_SERVER_SUPPORT) +#ifdef HAVE_SERVER_SUPPORT if (target->ft_srv != NULL) { LASSERT(env != NULL); rc = fld_server_lookup(env, target->ft_srv, seq, &res); } else -#endif +#endif /* HAVE_SERVER_SUPPORT */ { rc = fld_client_rpc(target->ft_exp, &res, FLD_QUERY, NULL); } @@ -519,7 +514,6 @@ void fld_client_flush(struct lu_client_fld *fld) } EXPORT_SYMBOL(fld_client_flush); -#ifdef __KERNEL__ struct proc_dir_entry *fld_type_proc_dir; @@ -533,7 +527,7 @@ static int __init fld_mod_init(void) #ifdef HAVE_SERVER_SUPPORT fld_server_mod_init(); -#endif +#endif /* HAVE_SERVER_SUPPORT */ return 0; } @@ -542,7 +536,7 @@ static void __exit fld_mod_exit(void) { #ifdef HAVE_SERVER_SUPPORT fld_server_mod_exit(); -#endif +#endif /* HAVE_SERVER_SUPPORT */ if (fld_type_proc_dir != NULL && !IS_ERR(fld_type_proc_dir)) { lprocfs_remove(&fld_type_proc_dir); @@ -555,4 +549,3 @@ MODULE_DESCRIPTION("Lustre FLD"); MODULE_LICENSE("GPL"); cfs_module(mdd, LUSTRE_VERSION_STRING, fld_mod_init, fld_mod_exit); -#endif /* __KERNEL__ */ diff --git a/lustre/fld/lproc_fld.c b/lustre/fld/lproc_fld.c index 873fa23..fd8ddf3 100644 --- a/lustre/fld/lproc_fld.c +++ b/lustre/fld/lproc_fld.c @@ -43,13 +43,8 @@ #define DEBUG_SUBSYSTEM S_FLD -#ifdef __KERNEL__ -# include -# include -#else /* __KERNEL__ */ -# include -#endif - +#include +#include #include #include #include diff --git a/lustre/include/cl_object.h b/lustre/include/cl_object.h index 1c214a8..59791bf 100644 --- a/lustre/include/cl_object.h +++ b/lustre/include/cl_object.h @@ -99,13 +99,8 @@ */ #include #include - -#ifdef __KERNEL__ -# include -# include -#else -# include -#endif +#include +#include struct inode; diff --git a/lustre/include/linux/lustre_debug.h b/lustre/include/linux/lustre_debug.h index 5a43eba..bc334be 100644 --- a/lustre/include/linux/lustre_debug.h +++ b/lustre/include/linux/lustre_debug.h @@ -39,15 +39,9 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ #define LL_CDEBUG_PAGE(mask, page, fmt, arg...) \ CDEBUG(mask, "page %p map %p index %lu flags %lx count %u priv %0lx: "\ fmt, page, page->mapping, page->index, (long)page->flags, \ page_count(page), page_private(page), ## arg) -#else -#define LL_CDEBUG_PAGE(mask, page, fmt, arg...) \ - CDEBUG(mask, "page %p index %lu priv %0lx: "\ - fmt, page, page->index, page_private(page), ## arg) -#endif #endif diff --git a/lustre/include/linux/lustre_dlm.h b/lustre/include/linux/lustre_dlm.h index ff4ddc4..4160dc9 100644 --- a/lustre/include/linux/lustre_dlm.h +++ b/lustre/include/linux/lustre_dlm.h @@ -39,10 +39,8 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ -# include -# include -# include -#endif +#include +#include +#include #endif diff --git a/lustre/include/linux/lustre_handles.h b/lustre/include/linux/lustre_handles.h index 365010b..ecf1840 100644 --- a/lustre/include/linux/lustre_handles.h +++ b/lustre/include/linux/lustre_handles.h @@ -39,7 +39,6 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ #include #include #include @@ -50,6 +49,5 @@ #include /* for rcu_head{} */ typedef struct rcu_head cfs_rcu_head_t; -#endif /* ifdef __KERNEL__ */ #endif diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 2110b3a..6a09018 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -45,17 +45,12 @@ #error Do not #include this file directly. #include instead #endif -#ifndef __KERNEL__ -# include -# include -#else -# include -# include -# include -# include -# include -# include -#endif +#include +#include +#include +#include +#include +#include #ifndef LP_POISON #if BITS_PER_LONG > 32 @@ -73,7 +68,6 @@ sigmask(SIGTERM) | sigmask(SIGQUIT) | \ sigmask(SIGALRM)) -#ifdef __KERNEL__ /* initialize ost_lvb according to inode */ static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb) { @@ -83,8 +77,5 @@ static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb) lvb->lvb_atime = LTIME_S(inode->i_atime); lvb->lvb_ctime = LTIME_S(inode->i_ctime); } -#else -/* defined in liblustre/llite_lib.h */ -#endif #endif /* _LUSTRE_LIB_H */ diff --git a/lustre/include/linux/lustre_lite.h b/lustre/include/linux/lustre_lite.h index 37bcd2f..6978c24 100644 --- a/lustre/include/linux/lustre_lite.h +++ b/lustre/include/linux/lustre_lite.h @@ -39,20 +39,14 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ - #include - #include - #include #include #include - #include #include #include - #include #include #include @@ -98,8 +92,4 @@ enum { LPROC_LL_FILE_OPCODES }; -#else -#include -#endif /* __KERNEL__ */ - #endif diff --git a/lustre/include/linux/lustre_net.h b/lustre/include/linux/lustre_net.h index 7ec0a0d..6dbd3b5 100644 --- a/lustre/include/linux/lustre_net.h +++ b/lustre/include/linux/lustre_net.h @@ -39,14 +39,7 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ #include #include -#endif - -/* XXX Liang: should be moved to other header instead of here */ -#ifndef WITH_GROUP_INFO -#define WITH_GROUP_INFO -#endif #endif diff --git a/lustre/include/linux/lustre_quota.h b/lustre/include/linux/lustre_quota.h index 9e6357a..421866b 100644 --- a/lustre/include/linux/lustre_quota.h +++ b/lustre/include/linux/lustre_quota.h @@ -39,11 +39,9 @@ #error Do not #include this file directly. #include instead #endif -#ifdef __KERNEL__ #include #include #include #include -#endif #endif /* _LUSTRE_QUOTA_H */ diff --git a/lustre/include/linux/lvfs.h b/lustre/include/linux/lvfs.h index f13bf58..d240ac4 100644 --- a/lustre/include/linux/lvfs.h +++ b/lustre/include/linux/lvfs.h @@ -45,13 +45,9 @@ #error Do not #include this file directly. #include instead #endif -#if defined __KERNEL__ #include #include #include -#else -#include -#endif #define OBD_RUN_CTXT_MAGIC 0xC0FFEEAA #define OBD_CTXT_DEBUG /* development-only debugging */ @@ -75,7 +71,6 @@ struct lvfs_run_ctxt { #define OBD_SET_CTXT_MAGIC(ctxt) do {} while(0) #endif -#ifdef __KERNEL__ /* We need to hold the inode semaphore over the dcache lookup itself, or we * run the risk of entering the filesystem lookup path concurrently on SMP @@ -104,6 +99,5 @@ static inline struct dentry *ll_lookup_one_len(const char *fid_name, return dchild; } -#endif #endif diff --git a/lustre/include/linux/obd.h b/lustre/include/linux/obd.h index cfd0bf5..2b78cec 100644 --- a/lustre/include/linux/obd.h +++ b/lustre/include/linux/obd.h @@ -43,23 +43,19 @@ #include -#ifdef __KERNEL__ -# include -# include -# include /* for struct task_struct, for current.h */ -# include -# include -# include -#endif +#include +#include +#include /* for struct task_struct, for current.h */ +#include +#include +#include struct ll_iattr { struct iattr iattr; unsigned int ia_attr_flags; }; -#ifdef __KERNEL__ #define CLIENT_OBD_LIST_LOCK_DEBUG 1 -#endif typedef struct { spinlock_t lock; @@ -123,7 +119,7 @@ static inline void client_obd_list_unlock(client_obd_lock_t *lock) spin_unlock(&lock->lock); } -#else /* ifdef CLIENT_OBD_LIST_LOCK_DEBUG */ +#else /* CLIENT_OBD_LIST_LOCK_DEBUG */ static inline void client_obd_list_lock(client_obd_lock_t *lock) { spin_lock(&lock->lock); @@ -134,7 +130,7 @@ static inline void client_obd_list_unlock(client_obd_lock_t *lock) spin_unlock(&lock->lock); } -#endif /* ifdef CLIENT_OBD_LIST_LOCK_DEBUG */ +#endif /* !CLIENT_OBD_LIST_LOCK_DEBUG */ static inline void client_obd_list_lock_init(client_obd_lock_t *lock) { @@ -144,8 +140,8 @@ static inline void client_obd_list_lock_init(client_obd_lock_t *lock) static inline void client_obd_list_lock_done(client_obd_lock_t *lock) {} -#if defined(__KERNEL__) && !defined(HAVE_ADLER) +#ifndef HAVE_ADLER /* zlib_adler() is an inline function defined in zutil.h */ -#define HAVE_ADLER -#endif +# define HAVE_ADLER +#endif /* !HAVE_ADLER */ #endif /* __LINUX_OBD_H */ diff --git a/lustre/include/linux/obd_class.h b/lustre/include/linux/obd_class.h index 60dfe3f..2c7588c 100644 --- a/lustre/include/linux/obd_class.h +++ b/lustre/include/linux/obd_class.h @@ -41,25 +41,17 @@ #error Do not #include this file directly. #include instead #endif -#ifndef __KERNEL__ -#include -#include -#else #include #include #include #include #include -#endif /* obdo.c */ -#ifdef __KERNEL__ void obdo_from_la(struct obdo *dst, const struct lu_attr *la, __u64 valid); void la_from_obdo(struct lu_attr *la, const struct obdo *dst, obd_flag valid); void obdo_refresh_inode(struct inode *dst, const struct obdo *src, obd_flag valid); #define ll_inode_flags(inode) (inode->i_flags) -#endif - #endif /* __LINUX_OBD_CLASS_H */ diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h index a72ae4b..de920dc 100644 --- a/lustre/include/lprocfs_status.h +++ b/lustre/include/lprocfs_status.h @@ -42,11 +42,7 @@ #ifndef _LPROCFS_SNMP_H #define _LPROCFS_SNMP_H -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #include #include @@ -178,9 +174,6 @@ struct lprocfs_counter { #define lc_sum_irq lc_array_sum[1] struct lprocfs_percpu { -#ifndef __GNUC__ - __s64 pad; -#endif struct lprocfs_counter lp_cntr[0]; }; diff --git a/lustre/include/lustre/lustre_user.h b/lustre/include/lustre/lustre_user.h index 1b41dc3..e016d59 100644 --- a/lustre/include/lustre/lustre_user.h +++ b/lustre/include/lustre/lustre_user.h @@ -54,11 +54,7 @@ # include /* snprintf() */ #endif #include -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #define LUSTRE_EOF 0xffffffffffffffffULL diff --git a/lustre/include/lustre_acl.h b/lustre/include/lustre_acl.h index fcca1fc..5cfb87b 100644 --- a/lustre/include/lustre_acl.h +++ b/lustre/include/lustre_acl.h @@ -37,8 +37,6 @@ #ifndef _LUSTRE_ACL_H #define _LUSTRE_ACL_H -#if defined(__linux__) #include -#endif #endif diff --git a/lustre/include/lustre_capa.h b/lustre/include/lustre_capa.h index ac713d0..0b2118b 100644 --- a/lustre/include/lustre_capa.h +++ b/lustre/include/lustre_capa.h @@ -49,9 +49,7 @@ /* * capability */ -#ifdef __KERNEL__ #include -#endif #include #define CAPA_TIMEOUT 1800 /* sec, == 30 min */ @@ -195,7 +193,6 @@ int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen); void capa_cpy(void *dst, struct obd_capa *ocapa); static inline struct obd_capa *alloc_capa(int site) { -#ifdef __KERNEL__ struct obd_capa *ocapa; if (unlikely(site != CAPA_SITE_CLIENT && site != CAPA_SITE_SERVER)) @@ -215,9 +212,6 @@ static inline struct obd_capa *alloc_capa(int site) INIT_HLIST_NODE(&ocapa->u.tgt.c_hash); return ocapa; -#else - return ERR_PTR(-EOPNOTSUPP); -#endif } static inline struct obd_capa *capa_get(struct obd_capa *ocapa) diff --git a/lustre/include/lustre_debug.h b/lustre/include/lustre_debug.h index a1a879c..0bfb7c6 100644 --- a/lustre/include/lustre_debug.h +++ b/lustre/include/lustre_debug.h @@ -45,11 +45,7 @@ #include #include -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #define ASSERT_MAX_SIZE_MB 60000ULL #define ASSERT_PAGE_INDEX(index, OP) \ diff --git a/lustre/include/lustre_dlm.h b/lustre/include/lustre_dlm.h index 74a62b8..2c7b079 100644 --- a/lustre/include/lustre_dlm.h +++ b/lustre/include/lustre_dlm.h @@ -48,11 +48,7 @@ #ifndef _LUSTRE_DLM_H__ #define _LUSTRE_DLM_H__ -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #include #include diff --git a/lustre/include/lustre_handles.h b/lustre/include/lustre_handles.h index 5b6f30f..a3c16f6 100644 --- a/lustre/include/lustre_handles.h +++ b/lustre/include/lustre_handles.h @@ -42,19 +42,10 @@ * @{ */ -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #include -#ifndef __KERNEL__ -typedef struct { - int foo; -} cfs_rcu_head_t; -#endif struct portals_handle_ops { void (*hop_addref)(void *object); diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index f829172..d9c2816 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -50,11 +50,7 @@ #include #include #include -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif /* target.c */ struct ptlrpc_request; @@ -245,7 +241,6 @@ struct l_wait_info { #define LWI_INTR(cb, data) LWI_TIMEOUT_INTR(0, NULL, cb, data) -#ifdef __KERNEL__ /* * wait for @condition to become true, but no longer than timeout, specified @@ -334,53 +329,6 @@ do { \ remove_wait_queue(&wq, &__wait); \ } while (0) -#else /* !__KERNEL__ */ - -#define __l_wait_event(wq, condition, info, ret, l_add_wait) \ -do { \ - long __timeout = info->lwi_timeout; \ - long __now; \ - long __then = 0; \ - int __timed_out = 0; \ - int __interval = obd_timeout; \ - \ - ret = 0; \ - if (condition) \ - break; \ - \ - if (__timeout != 0) \ - __then = time(NULL); \ - \ - if (__timeout && __timeout < __interval) \ - __interval = __timeout; \ - if (info->lwi_interval && info->lwi_interval < __interval) \ - __interval = info->lwi_interval; \ - \ - while (!(condition)) { \ - liblustre_wait_event(__interval); \ - if (condition) \ - break; \ - \ - if (!__timed_out && info->lwi_timeout != 0) { \ - __now = time(NULL); \ - __timeout -= __now - __then; \ - __then = __now; \ - \ - if (__timeout > 0) \ - continue; \ - \ - __timeout = 0; \ - __timed_out = 1; \ - if (info->lwi_on_timeout == NULL || \ - info->lwi_on_timeout(info->lwi_cb_data)) { \ - ret = -ETIMEDOUT; \ - break; \ - } \ - } \ - } \ -} while (0) - -#endif /* __KERNEL__ */ #define l_wait_event(wq, condition, info) \ @@ -431,12 +379,6 @@ do { \ l_wait_event_exclusive_head(wq, condition, &lwi); \ }) -#ifdef __KERNEL__ -#define LIBLUSTRE_CLIENT (0) -#else -#define LIBLUSTRE_CLIENT (1) -#endif - /** @} lib */ #endif /* _LUSTRE_LIB_H */ diff --git a/lustre/include/lustre_lite.h b/lustre/include/lustre_lite.h index 666855a..f6c0d30 100644 --- a/lustre/include/lustre_lite.h +++ b/lustre/include/lustre_lite.h @@ -42,11 +42,7 @@ * @{ */ -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #include #include @@ -87,13 +83,6 @@ static inline void lustre_build_lock_params(int cmd, unsigned long open_flags, if (cmd == OBD_BRW_WRITE && (open_flags & O_APPEND)) { params->lrp_policy.l_extent.start = 0; params->lrp_policy.l_extent.end = OBD_OBJECT_EOF; - } else if (LIBLUSTRE_CLIENT && (connect_flags & OBD_CONNECT_SRVLOCK)) { - /* - * liblustre: OST-side locking for all non-O_APPEND - * reads/writes. - */ - params->lrp_lock_mode = LCK_NL; - params->lrp_brw_flags = OBD_BRW_SRVLOCK; } else { /* * nothing special for the kernel. In the future llite may use diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h index 3ea5be1..eb986f9 100644 --- a/lustre/include/lustre_log.h +++ b/lustre/include/lustre_log.h @@ -56,11 +56,7 @@ * @{ */ -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #include #include diff --git a/lustre/include/lustre_mdc.h b/lustre/include/lustre_mdc.h index 9067b6a..85f3f31 100644 --- a/lustre/include/lustre_mdc.h +++ b/lustre/include/lustre_mdc.h @@ -48,14 +48,12 @@ * @{ */ -#ifdef __KERNEL__ -# include -# include -# ifdef CONFIG_FS_POSIX_ACL -# include -# endif /* CONFIG_FS_POSIX_ACL */ -# include -#endif /* __KERNEL__ */ +#include +#include +#ifdef CONFIG_FS_POSIX_ACL +# include +#endif /* CONFIG_FS_POSIX_ACL */ +#include #include #include #include diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index 80541df..556284b 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -55,14 +55,8 @@ * @{ */ -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif - #include -// #include #include #include #include @@ -71,7 +65,6 @@ #include #include #include - #include #include @@ -114,20 +107,18 @@ #define OFD_MAX_BRW_SIZE (1 << LNET_MTU_BITS) /* When PAGE_SIZE is a constant, we can check our arithmetic here with cpp! */ -#ifdef __KERNEL__ -# if ((PTLRPC_MAX_BRW_PAGES & (PTLRPC_MAX_BRW_PAGES - 1)) != 0) -# error "PTLRPC_MAX_BRW_PAGES isn't a power of two" -# endif -# if (PTLRPC_MAX_BRW_SIZE != (PTLRPC_MAX_BRW_PAGES * PAGE_CACHE_SIZE)) -# error "PTLRPC_MAX_BRW_SIZE isn't PTLRPC_MAX_BRW_PAGES * PAGE_CACHE_SIZE" -# endif -# if (PTLRPC_MAX_BRW_SIZE > LNET_MTU * PTLRPC_BULK_OPS_COUNT) -# error "PTLRPC_MAX_BRW_SIZE too big" -# endif -# if (PTLRPC_MAX_BRW_PAGES > LNET_MAX_IOV * PTLRPC_BULK_OPS_COUNT) -# error "PTLRPC_MAX_BRW_PAGES too big" -# endif -#endif /* __KERNEL__ */ +#if ((PTLRPC_MAX_BRW_PAGES & (PTLRPC_MAX_BRW_PAGES - 1)) != 0) +# error "PTLRPC_MAX_BRW_PAGES isn't a power of two" +#endif +#if (PTLRPC_MAX_BRW_SIZE != (PTLRPC_MAX_BRW_PAGES * PAGE_CACHE_SIZE)) +# error "PTLRPC_MAX_BRW_SIZE isn't PTLRPC_MAX_BRW_PAGES * PAGE_CACHE_SIZE" +#endif +#if (PTLRPC_MAX_BRW_SIZE > LNET_MTU * PTLRPC_BULK_OPS_COUNT) +# error "PTLRPC_MAX_BRW_SIZE too big" +#endif +#if (PTLRPC_MAX_BRW_PAGES > LNET_MAX_IOV * PTLRPC_BULK_OPS_COUNT) +# error "PTLRPC_MAX_BRW_PAGES too big" +#endif #define PTLRPC_NTHRS_INIT 2 @@ -2303,16 +2294,12 @@ struct ptlrpc_bulk_desc { /** array of associated MDs */ lnet_handle_md_t bd_mds[PTLRPC_BULK_OPS_COUNT]; -#if defined(__KERNEL__) /* * encrypt iov, size is either 0 or bd_iov_count. */ lnet_kiov_t *bd_enc_iov; lnet_kiov_t bd_iov[0]; -#else - lnet_md_iovec_t bd_iov[0]; -#endif }; enum { @@ -2671,10 +2658,6 @@ struct ptlrpc_service_part { spinlock_t scp_rep_lock __cfs_cacheline_aligned; /** all the active replies */ struct list_head scp_rep_active; -#ifndef __KERNEL__ - /** replies waiting for service */ - struct list_head scp_rep_queue; -#endif /** List of free reply_states */ struct list_head scp_rep_idle; /** waitq to run, when adding stuff to srv_free_rs_list */ @@ -2737,25 +2720,6 @@ struct ptlrpcd_ctl { * Record the partner index to be processed next. */ int pc_cursor; -#ifndef __KERNEL__ - /** - * Async rpcs flag to make sure that ptlrpcd_check() is called only - * once. - */ - int pc_recurred; - /** - * Currently not used. - */ - void *pc_callback; - /** - * User-space async rpcs callback. - */ - void *pc_wait_callback; - /** - * User-space check idle rpcs callback. - */ - void *pc_idle_callback; -#endif }; /* Bits for pc_flags */ @@ -3114,13 +3078,8 @@ void ptlrpc_request_change_export(struct ptlrpc_request *req, struct obd_export *export); void ptlrpc_update_export_timer(struct obd_export *exp, long extra_delay); -#ifdef __KERNEL__ int ptlrpc_hr_init(void); void ptlrpc_hr_fini(void); -#else -# define ptlrpc_hr_init() (0) -# define ptlrpc_hr_fini() do {} while(0) -#endif /** @} */ @@ -3481,13 +3440,8 @@ int ptlrpc_del_timeout_client(struct list_head *obd_list, enum timeout_event event); struct ptlrpc_request * ptlrpc_prep_ping(struct obd_import *imp); int ptlrpc_obd_ping(struct obd_device *obd); -#ifdef __KERNEL__ void ping_evictor_start(void); void ping_evictor_stop(void); -#else -#define ping_evictor_start() do {} while (0) -#define ping_evictor_stop() do {} while (0) -#endif void ptlrpc_pinger_ir_up(void); void ptlrpc_pinger_ir_down(void); /** @} */ diff --git a/lustre/include/lustre_nrs_tbf.h b/lustre/include/lustre_nrs_tbf.h index 02ebfd4..df80599 100644 --- a/lustre/include/lustre_nrs_tbf.h +++ b/lustre/include/lustre_nrs_tbf.h @@ -185,9 +185,7 @@ struct nrs_tbf_head { /** * Timer for next token. */ -#if defined(__KERNEL__) && defined(__linux__) struct hrtimer th_timer; -#endif /** * Deadline of the timer. */ diff --git a/lustre/include/lustre_quota.h b/lustre/include/lustre_quota.h index 7c6121c..aa87843 100644 --- a/lustre/include/lustre_quota.h +++ b/lustre/include/lustre_quota.h @@ -32,9 +32,7 @@ * */ -#if defined(__linux__) #include -#endif #include #include diff --git a/lustre/include/lvfs.h b/lustre/include/lvfs.h index a1ae6de..e03840c 100644 --- a/lustre/include/lvfs.h +++ b/lustre/include/lvfs.h @@ -41,11 +41,7 @@ #include -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif /* ptlrpc_sec_ctx.c */ void push_ctxt(struct lvfs_run_ctxt *save, struct lvfs_run_ctxt *new_ctx); diff --git a/lustre/include/obd.h b/lustre/include/obd.h index 1e39945..4303c3c 100644 --- a/lustre/include/obd.h +++ b/lustre/include/obd.h @@ -36,15 +36,8 @@ #ifndef __OBD_H #define __OBD_H -#ifndef __KERNEL__ -# error "userspace should not include " -#endif -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #include #include diff --git a/lustre/include/obd_cache.h b/lustre/include/obd_cache.h index 626a514..c8249fb 100644 --- a/lustre/include/obd_cache.h +++ b/lustre/include/obd_cache.h @@ -35,7 +35,5 @@ #ifndef _OBD_CACHE_H__ #define _OBD_CACHE_H__ -#ifdef __KERNEL__ #endif -#endif diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 12784c9..0154671 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -36,9 +36,6 @@ #ifndef __CLASS_OBD_H #define __CLASS_OBD_H -#ifndef __KERNEL__ -# include -#endif #include #include @@ -48,11 +45,7 @@ #include #include -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif #define OBD_STATFS_NODELAY 0x0001 /* requests should be send without delay * and resends for avoid deadlocks */ @@ -1943,10 +1936,6 @@ struct root_squash_info { struct rw_semaphore rsi_sem; }; -#ifdef __KERNEL__ int server_name2index(const char *svname, __u32 *idx, const char **endptr); -#else -# define server_name2index(name, idx, ptr) do {} while (0) -#endif #endif /* __LINUX_OBD_CLASS_H */ diff --git a/lustre/include/obd_support.h b/lustre/include/obd_support.h index 6213ddf..cf9a8f5 100644 --- a/lustre/include/obd_support.h +++ b/lustre/include/obd_support.h @@ -40,11 +40,7 @@ #include #include -#if defined(__linux__) #include -#else -#error Unsupported operating system. -#endif /* global variables */ extern struct lprocfs_stats *obd_memory; diff --git a/lustre/ldlm/l_lock.c b/lustre/ldlm/l_lock.c index 904ad30..6f3f859 100644 --- a/lustre/ldlm/l_lock.c +++ b/lustre/ldlm/l_lock.c @@ -35,11 +35,7 @@ */ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ #include -#else -#include -#endif #include #include diff --git a/lustre/ldlm/ldlm_extent.c b/lustre/ldlm/ldlm_extent.c index f2aabd6..25a3319 100644 --- a/lustre/ldlm/ldlm_extent.c +++ b/lustre/ldlm/ldlm_extent.c @@ -50,12 +50,8 @@ */ #define DEBUG_SUBSYSTEM S_LDLM -#ifndef __KERNEL__ -# include -#else -# include -#endif +#include #include #include #include diff --git a/lustre/ldlm/ldlm_flock.c b/lustre/ldlm/ldlm_flock.c index 268617d..238d4be 100644 --- a/lustre/ldlm/ldlm_flock.c +++ b/lustre/ldlm/ldlm_flock.c @@ -56,16 +56,11 @@ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ #include #include #include #include #include -#else -#include -#include -#endif #include "ldlm_internal.h" diff --git a/lustre/ldlm/ldlm_inodebits.c b/lustre/ldlm/ldlm_inodebits.c index b7dc3a9..a0a20bb 100644 --- a/lustre/ldlm/ldlm_inodebits.c +++ b/lustre/ldlm/ldlm_inodebits.c @@ -52,9 +52,6 @@ */ #define DEBUG_SUBSYSTEM S_LDLM -#ifndef __KERNEL__ -# include -#endif #include #include diff --git a/lustre/ldlm/ldlm_lib.c b/lustre/ldlm/ldlm_lib.c index 1c370e6..da8762c 100644 --- a/lustre/ldlm/ldlm_lib.c +++ b/lustre/ldlm/ldlm_lib.c @@ -43,11 +43,7 @@ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ -# include -#else -# include -#endif +#include #include #include #include @@ -758,17 +754,9 @@ void target_client_add_cb(struct obd_device *obd, __u64 transno, void *cb_data, } EXPORT_SYMBOL(target_client_add_cb); -#ifdef __KERNEL__ static void check_and_start_recovery_timer(struct obd_device *obd, struct ptlrpc_request *req, int new_client); -#else -static inline void -check_and_start_recovery_timer(struct obd_device *obd, - struct ptlrpc_request *req, int new_client) -{ -} -#endif int target_handle_connect(struct ptlrpc_request *req) { @@ -1382,7 +1370,6 @@ static void target_exp_dequeue_req_replay(struct ptlrpc_request *req) spin_unlock(&req->rq_export->exp_lock); } -#ifdef __KERNEL__ static void target_finish_recovery(struct obd_device *obd) { ENTRY; @@ -2171,7 +2158,6 @@ void target_recovery_init(struct lu_target *lut, svc_handler_t handler) } EXPORT_SYMBOL(target_recovery_init); -#endif /* __KERNEL__ */ static int target_process_req_flags(struct obd_device *obd, struct ptlrpc_request *req) diff --git a/lustre/ldlm/ldlm_lock.c b/lustre/ldlm/ldlm_lock.c index 588a8a9..599666d6 100644 --- a/lustre/ldlm/ldlm_lock.c +++ b/lustre/ldlm/ldlm_lock.c @@ -41,13 +41,8 @@ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ -# include -# include -#else -# include -#endif - +#include +#include #include #include "ldlm_internal.h" @@ -162,9 +157,7 @@ extern struct kmem_cache *ldlm_lock_slab; static ldlm_processing_policy ldlm_processing_policy_table[] = { [LDLM_PLAIN] = ldlm_process_plain_lock, [LDLM_EXTENT] = ldlm_process_extent_lock, -# ifdef __KERNEL__ [LDLM_FLOCK] = ldlm_process_flock_lock, -# endif [LDLM_IBITS] = ldlm_process_inodebits_lock, }; diff --git a/lustre/ldlm/ldlm_lockd.c b/lustre/ldlm/ldlm_lockd.c index 9562229..ad2f233 100644 --- a/lustre/ldlm/ldlm_lockd.c +++ b/lustre/ldlm/ldlm_lockd.c @@ -41,12 +41,7 @@ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ -# include -#else -# include -#endif - +#include #include #include #include @@ -128,7 +123,7 @@ struct ldlm_bl_work_item { int blwi_mem_pressure; }; -#if defined(HAVE_SERVER_SUPPORT) && defined(__KERNEL__) +#ifdef HAVE_SERVER_SUPPORT /** * Protects both waiting_locks_list and expired_lock_thread. @@ -557,7 +552,7 @@ int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout) } EXPORT_SYMBOL(ldlm_refresh_waiting_lock); -#else /* !HAVE_SERVER_SUPPORT || !__KERNEL__ */ +#else /* HAVE_SERVER_SUPPORT */ int ldlm_del_waiting_lock(struct ldlm_lock *lock) { @@ -569,15 +564,7 @@ int ldlm_refresh_waiting_lock(struct ldlm_lock *lock, int timeout) RETURN(0); } -# ifdef HAVE_SERVER_SUPPORT -static int ldlm_add_waiting_lock(struct ldlm_lock *lock) -{ - LASSERT(ldlm_is_res_locked(lock) && !ldlm_is_cancel_on_block(lock)); - RETURN(1); -} - -# endif -#endif /* HAVE_SERVER_SUPPORT && __KERNEL__ */ +#endif /* !HAVE_SERVER_SUPPORT */ #ifdef HAVE_SERVER_SUPPORT @@ -594,7 +581,6 @@ static void ldlm_failed_ast(struct ldlm_lock *lock, int rc, if (obd_dump_on_timeout) libcfs_debug_dumplog(); -#ifdef __KERNEL__ spin_lock_bh(&waiting_locks_spinlock); if (__ldlm_del_waiting_lock(lock) == 0) /* the lock was not in any list, grab an extra ref before adding @@ -604,9 +590,6 @@ static void ldlm_failed_ast(struct ldlm_lock *lock, int rc, &expired_lock_thread.elt_expired_locks); wake_up(&expired_lock_thread.elt_waitq); spin_unlock_bh(&waiting_locks_spinlock); -#else - class_fail_export(lock->l_export); -#endif } /** @@ -1929,7 +1912,6 @@ static int ldlm_callback_reply(struct ptlrpc_request *req, int rc) return ptlrpc_reply(req); } -#ifdef __KERNEL__ static int __ldlm_bl_to_thread(struct ldlm_bl_work_item *blwi, ldlm_cancel_flags_t cancel_flags) { @@ -2024,27 +2006,18 @@ static int ldlm_bl_to_thread(struct ldlm_namespace *ns, } } -#endif int ldlm_bl_to_thread_lock(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, struct ldlm_lock *lock) { -#ifdef __KERNEL__ return ldlm_bl_to_thread(ns, ld, lock, NULL, 0, LCF_ASYNC); -#else - return -ENOSYS; -#endif } int ldlm_bl_to_thread_list(struct ldlm_namespace *ns, struct ldlm_lock_desc *ld, struct list_head *cancels, int count, ldlm_cancel_flags_t cancel_flags) { -#ifdef __KERNEL__ return ldlm_bl_to_thread(ns, ld, NULL, cancels, count, cancel_flags); -#else - return -ENOSYS; -#endif } /* Setinfo coming from Server (eg MDT) to Client (eg MDC)! */ @@ -2527,7 +2500,6 @@ void ldlm_revoke_export_locks(struct obd_export *exp) EXPORT_SYMBOL(ldlm_revoke_export_locks); #endif /* HAVE_SERVER_SUPPORT */ -#ifdef __KERNEL__ static struct ldlm_bl_work_item *ldlm_bl_get_work(struct ldlm_bl_pool *blp) { struct ldlm_bl_work_item *blwi = NULL; @@ -2669,7 +2641,6 @@ static int ldlm_bl_thread_main(void *arg) RETURN(0); } -#endif static int ldlm_setup(void); static int ldlm_cleanup(void); @@ -2821,12 +2792,10 @@ static int ldlm_setup(void) { static struct ptlrpc_service_conf conf; struct ldlm_bl_pool *blp = NULL; -#ifdef __KERNEL__ -# ifdef HAVE_SERVER_SUPPORT +#ifdef HAVE_SERVER_SUPPORT struct task_struct *task; -# endif +#endif /* HAVE_SERVER_SUPPORT */ int i; -#endif int rc = 0; ENTRY; @@ -2842,7 +2811,7 @@ static int ldlm_setup(void) rc = ldlm_proc_setup(); if (rc != 0) GOTO(out, rc); -#endif +#endif /* LPROCFS */ memset(&conf, 0, sizeof(conf)); conf = (typeof(conf)) { @@ -2924,7 +2893,7 @@ static int ldlm_setup(void) ldlm_state->ldlm_cancel_service = NULL; GOTO(out, rc); } -#endif +#endif /* HAVE_SERVER_SUPPORT */ OBD_ALLOC(blp, sizeof(*blp)); if (blp == NULL) @@ -2938,7 +2907,6 @@ static int ldlm_setup(void) atomic_set(&blp->blp_num_threads, 0); atomic_set(&blp->blp_busy_threads, 0); -#ifdef __KERNEL__ if (ldlm_num_threads == 0) { blp->blp_min_threads = LDLM_NTHRS_INIT; blp->blp_max_threads = LDLM_NTHRS_MAX; @@ -2954,7 +2922,7 @@ static int ldlm_setup(void) GOTO(out, rc); } -# ifdef HAVE_SERVER_SUPPORT +#ifdef HAVE_SERVER_SUPPORT INIT_LIST_HEAD(&expired_lock_thread.elt_expired_locks); expired_lock_thread.elt_state = ELT_STOPPED; init_waitqueue_head(&expired_lock_thread.elt_waitq); @@ -2972,14 +2940,13 @@ static int ldlm_setup(void) wait_event(expired_lock_thread.elt_waitq, expired_lock_thread.elt_state == ELT_READY); -# endif /* HAVE_SERVER_SUPPORT */ +#endif /* HAVE_SERVER_SUPPORT */ rc = ldlm_pools_init(); if (rc) { CERROR("Failed to initialize LDLM pools: %d\n", rc); GOTO(out, rc); } -#endif RETURN(0); out: @@ -2999,7 +2966,6 @@ static int ldlm_cleanup(void) RETURN(-EBUSY); } -#ifdef __KERNEL__ ldlm_pools_fini(); if (ldlm_state->ldlm_bl_pool != NULL) { @@ -3020,27 +2986,24 @@ static int ldlm_cleanup(void) OBD_FREE(blp, sizeof(*blp)); } -#endif /* __KERNEL__ */ if (ldlm_state->ldlm_cb_service != NULL) ptlrpc_unregister_service(ldlm_state->ldlm_cb_service); -# ifdef HAVE_SERVER_SUPPORT +#ifdef HAVE_SERVER_SUPPORT if (ldlm_state->ldlm_cancel_service != NULL) ptlrpc_unregister_service(ldlm_state->ldlm_cancel_service); -# endif +#endif -#ifdef __KERNEL__ ldlm_proc_cleanup(); -# ifdef HAVE_SERVER_SUPPORT +#ifdef HAVE_SERVER_SUPPORT if (expired_lock_thread.elt_state != ELT_STOPPED) { expired_lock_thread.elt_state = ELT_TERMINATE; wake_up(&expired_lock_thread.elt_waitq); wait_event(expired_lock_thread.elt_waitq, expired_lock_thread.elt_state == ELT_STOPPED); } -# endif -#endif /* __KERNEL__ */ +#endif OBD_FREE(ldlm_state, sizeof(*ldlm_state)); ldlm_state = NULL; @@ -3091,12 +3054,10 @@ void ldlm_exit(void) if (ldlm_refcount) CERROR("ldlm_refcount is %d in ldlm_exit!\n", ldlm_refcount); kmem_cache_destroy(ldlm_resource_slab); -#ifdef __KERNEL__ /* ldlm_lock_put() use RCU to call ldlm_lock_free, so need call * synchronize_rcu() to wait a grace period elapsed, so that * ldlm_lock_free() get a chance to be called. */ synchronize_rcu(); -#endif kmem_cache_destroy(ldlm_lock_slab); kmem_cache_destroy(ldlm_interval_slab); } diff --git a/lustre/ldlm/ldlm_plain.c b/lustre/ldlm/ldlm_plain.c index 14a76b6..0cb91e6d 100644 --- a/lustre/ldlm/ldlm_plain.c +++ b/lustre/ldlm/ldlm_plain.c @@ -52,13 +52,9 @@ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ #include #include #include -#else -#include -#endif #include "ldlm_internal.h" diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c index f3c620d..ef15628 100644 --- a/lustre/ldlm/ldlm_pool.c +++ b/lustre/ldlm/ldlm_pool.c @@ -97,14 +97,8 @@ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ -# include -#else -# include -#endif - +#include #include - #include #include #include "ldlm_internal.h" @@ -147,9 +141,7 @@ */ #define LDLM_POOL_SLV_SHIFT (10) -#ifdef __KERNEL__ extern struct proc_dir_entry *ldlm_ns_proc_dir; -#endif static inline __u64 dru(__u64 val, __u32 shift, int round_up) { @@ -559,15 +551,10 @@ static int ldlm_cli_pool_shrink(struct ldlm_pool *pl, unused = ns->ns_nr_unused; spin_unlock(&ns->ns_lock); -#ifdef __KERNEL__ if (nr == 0) return (unused / 100) * sysctl_vfs_cache_pressure; else return ldlm_cancel_lru(ns, nr, LCF_ASYNC, LDLM_CANCEL_SHRINK); -#else - return unused - (nr ? ldlm_cancel_lru(ns, nr, LCF_ASYNC, - LDLM_CANCEL_SHRINK) : 0); -#endif } struct ldlm_pool_ops ldlm_srv_pool_ops = { @@ -668,7 +655,6 @@ int ldlm_pool_setup(struct ldlm_pool *pl, int limit) } EXPORT_SYMBOL(ldlm_pool_setup); -#ifdef __KERNEL__ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused) { int granted, grant_rate, cancel_rate, grant_step; @@ -853,10 +839,6 @@ static void ldlm_pool_proc_fini(struct ldlm_pool *pl) pl->pl_proc_dir = NULL; } } -#else /* !__KERNEL__*/ -#define ldlm_pool_proc_init(pl) (0) -#define ldlm_pool_proc_fini(pl) while (0) {} -#endif int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, int idx, ldlm_side_t client) @@ -1046,7 +1028,6 @@ __u32 ldlm_pool_get_lvf(struct ldlm_pool *pl) } EXPORT_SYMBOL(ldlm_pool_get_lvf); -#ifdef __KERNEL__ static unsigned int ldlm_pool_granted(struct ldlm_pool *pl) { return atomic_read(&pl->pl_granted); @@ -1518,7 +1499,6 @@ void ldlm_pools_fini(void) ldlm_pools_thread_stop(); } EXPORT_SYMBOL(ldlm_pools_fini); -#endif /* __KERNEL__ */ #else /* !HAVE_LRU_RESIZE_SUPPORT */ int ldlm_pool_setup(struct ldlm_pool *pl, int limit) diff --git a/lustre/ldlm/ldlm_request.c b/lustre/ldlm/ldlm_request.c index 079edc8..486ec0c 100644 --- a/lustre/ldlm/ldlm_request.c +++ b/lustre/ldlm/ldlm_request.c @@ -60,10 +60,6 @@ */ #define DEBUG_SUBSYSTEM S_LDLM -#ifndef __KERNEL__ -#include -#include -#endif #include #include @@ -663,11 +659,7 @@ int ldlm_cli_enqueue_fini(struct obd_export *exp, struct ptlrpc_request *req, LDLM_DEBUG(lock,"client-side enqueue, new policy data"); } - if ((*flags) & LDLM_FL_AST_SENT || - /* Cancel extent locks as soon as possible on a liblustre client, - * because it cannot handle asynchronous ASTs robustly (see - * bug 7311). */ - (LIBLUSTRE_CLIENT && type == LDLM_EXTENT)) { + if ((*flags) & LDLM_FL_AST_SENT) { lock_res_and_lock(lock); lock->l_flags |= LDLM_FL_CBPENDING | LDLM_FL_BL_AST; unlock_res_and_lock(lock); @@ -971,14 +963,6 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp, ptlrpc_request_set_replen(req); } - /* - * Liblustre client doesn't get extent locks, except for O_APPEND case - * where [0, OBD_OBJECT_EOF] lock is taken, or truncate, where - * [i_size, OBD_OBJECT_EOF] lock is taken. - */ - LASSERT(ergo(LIBLUSTRE_CLIENT, einfo->ei_type != LDLM_EXTENT || - policy->l_extent.end == OBD_OBJECT_EOF)); - if (async) { LASSERT(reqp != NULL); RETURN(0); @@ -1798,9 +1782,6 @@ int ldlm_cancel_lru(struct ldlm_namespace *ns, int nr, int count, rc; ENTRY; -#ifndef __KERNEL__ - cancel_flags &= ~LCF_ASYNC; /* force to be sync in user space */ -#endif /* Just prepare the list of locks, do not actually cancel them yet. * Locks are cancelled later in a separate thread. */ count = ldlm_prepare_lru_list(ns, &cancels, nr, 0, flags); diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c index a275dbd..f0d1e66 100644 --- a/lustre/ldlm/ldlm_resource.c +++ b/lustre/ldlm/ldlm_resource.c @@ -40,12 +40,7 @@ */ #define DEBUG_SUBSYSTEM S_LDLM -#ifdef __KERNEL__ -# include -#else -# include -#endif - +#include #include #include #include "ldlm_internal.h" diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h index 1769f3e..43e9944 100644 --- a/lustre/mdc/mdc_internal.h +++ b/lustre/mdc/mdc_internal.h @@ -170,10 +170,8 @@ static inline int mdc_prep_elc_req(struct obd_export *exp, static inline unsigned long hash_x_index(__u64 hash, int hash64) { -#ifdef __KERNEL__ if (BITS_PER_LONG == 32 && hash64) hash >>= 32; -#endif /* save hash 0 with hash 1 */ return ~0UL - (hash + !hash); } diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c index 490204b..092ba2b 100644 --- a/lustre/mdc/mdc_lib.c +++ b/lustre/mdc/mdc_lib.c @@ -35,10 +35,6 @@ */ #define DEBUG_SUBSYSTEM S_MDC -#ifndef __KERNEL__ -# include -# include -#endif #include #include #include @@ -47,12 +43,6 @@ #include #include "mdc_internal.h" -#ifndef __KERNEL__ -/* some liblustre hackings here */ -#ifndef O_DIRECTORY -#define O_DIRECTORY 0 -#endif -#endif static void __mdc_pack_body(struct mdt_body *b, __u32 suppgid) { @@ -274,10 +264,6 @@ void mdc_open_pack(struct ptlrpc_request *req, struct md_op_data *op_data, if (op_data->op_bias & MDS_CREATE_VOLATILE) cr_flags |= MDS_OPEN_VOLATILE; } -#ifndef __KERNEL__ - /*XXX a hack for liblustre to set EA (LL_IOC_LOV_SETSTRIPE) */ - rec->cr_fid2 = op_data->op_fid2; -#endif } if (lmm) { diff --git a/lustre/mdc/mdc_locks.c b/lustre/mdc/mdc_locks.c index 95201c4..848048c 100644 --- a/lustre/mdc/mdc_locks.c +++ b/lustre/mdc/mdc_locks.c @@ -36,13 +36,8 @@ #define DEBUG_SUBSYSTEM S_MDC -#ifdef __KERNEL__ -# include -# include -#else -# include -#endif - +#include +#include #include #include #include @@ -118,7 +113,6 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, LASSERT(lock != NULL); lock_res_and_lock(lock); -#ifdef __KERNEL__ if (lock->l_resource->lr_lvb_inode && lock->l_resource->lr_lvb_inode != data) { struct inode *old_inode = lock->l_resource->lr_lvb_inode; @@ -129,7 +123,6 @@ int mdc_set_lock_data(struct obd_export *exp, __u64 *lockh, void *data, old_inode->i_state, new_inode, new_inode->i_ino, new_inode->i_generation); } -#endif lock->l_resource->lr_lvb_inode = new_inode; if (bits) *bits = lock->l_policy_data.l_inodebits.bits; diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c index c9ddfa3..271792f 100644 --- a/lustre/mdc/mdc_reint.c +++ b/lustre/mdc/mdc_reint.c @@ -36,12 +36,8 @@ #define DEBUG_SUBSYSTEM S_MDC -#ifdef __KERNEL__ -# include -# include -#else -# include -#endif +#include +#include #include #include "mdc_internal.h" diff --git a/lustre/mdc/mdc_request.c b/lustre/mdc/mdc_request.c index 9a38ea3..1699d29 100644 --- a/lustre/mdc/mdc_request.c +++ b/lustre/mdc/mdc_request.c @@ -36,15 +36,11 @@ #define DEBUG_SUBSYSTEM S_MDC -#ifdef __KERNEL__ -# include -# include -# include -# include -# include -#else -# include -#endif +#include +#include +#include +#include +#include #include #include @@ -1156,7 +1152,6 @@ restart_bulk: RETURN(0); } -#ifdef __KERNEL__ static void mdc_release_page(struct page *page, int remove) { if (remove) { @@ -1609,53 +1604,6 @@ fail: goto out_unlock; } -#else /* __KERNEL__ */ - -static struct page -*mdc_read_page_remote(struct obd_export *exp, const struct lmv_oinfo *lmo, - const __u64 hash, struct obd_capa *oc) -{ - struct ptlrpc_request *req = NULL; - struct page *page; - int rc; - - OBD_PAGE_ALLOC(page, 0); - if (page == NULL) - return ERR_PTR(-ENOMEM); - - rc = mdc_getpage(exp, &lmo->lmo_fid, hash, oc, &page, 1, &req); - if (req != NULL) - ptlrpc_req_finished(req); - - if (unlikely(rc)) { - OBD_PAGE_FREE(page); - return ERR_PTR(rc); - } - return page; -} - - -static int mdc_read_page(struct obd_export *exp, struct md_op_data *op_data, - struct md_callback *cb_op, __u64 hash_offset, - struct page **ppage) -{ - struct page *page; - struct lmv_oinfo *lmo; - int rc = 0; - - /* No local cache for liblustre, always read entry remotely */ - lmo = &op_data->op_mea1->lsm_md_oinfo[op_data->op_stripe_offset]; - page = mdc_read_page_remote(exp, lmo, hash_offset, - op_data->op_capa1); - if (IS_ERR(page)) - return PTR_ERR(page); - - *ppage = page; - - return rc; -} - -#endif static int mdc_statfs(const struct lu_env *env, struct obd_export *exp, struct obd_statfs *osfs, @@ -3227,7 +3175,6 @@ int __init mdc_init(void) LUSTRE_MDC_NAME, NULL); } -#ifdef __KERNEL__ static void /*__exit*/ mdc_exit(void) { class_unregister_type(LUSTRE_MDC_NAME); @@ -3239,4 +3186,3 @@ MODULE_LICENSE("GPL"); module_init(mdc_init); module_exit(mdc_exit); -#endif diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index fc9a7d3..6dfbe58 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -48,7 +48,6 @@ #ifndef _MDT_INTERNAL_H #define _MDT_INTERNAL_H -#if defined(__KERNEL__) #include #include @@ -1095,5 +1094,4 @@ static inline char *mdt_obd_name(struct mdt_device *mdt) int mds_mod_init(void); void mds_mod_exit(void); -#endif /* __KERNEL__ */ #endif /* _MDT_H */ diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index f279aa5..dbc381e 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -2036,7 +2036,6 @@ int __init mgc_init(void) LUSTRE_MGC_NAME, NULL); } -#ifdef __KERNEL__ static void /*__exit*/ mgc_exit(void) { class_unregister_type(LUSTRE_MGC_NAME); @@ -2048,4 +2047,3 @@ MODULE_LICENSE("GPL"); module_init(mgc_init); module_exit(mgc_exit); -#endif diff --git a/lustre/mgs/mgs_nids.c b/lustre/mgs/mgs_nids.c index 895ad98..54ce929 100644 --- a/lustre/mgs/mgs_nids.c +++ b/lustre/mgs/mgs_nids.c @@ -43,9 +43,7 @@ #define DEBUG_SUBSYSTEM S_MGS #define D_MGS D_CONFIG -#ifdef __KERNEL__ #include -#endif #include #include diff --git a/lustre/obdclass/capa.c b/lustre/obdclass/capa.c index fa9d86a..fa2affd 100644 --- a/lustre/obdclass/capa.c +++ b/lustre/obdclass/capa.c @@ -42,7 +42,6 @@ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -53,9 +52,6 @@ #include #include #include -#else -#include -#endif #include #include @@ -65,7 +61,6 @@ struct kmem_cache *capa_cachep; -#ifdef __KERNEL__ /* lock for capa hash/capa_list/fo_capa_keys */ DEFINE_SPINLOCK(capa_lock); @@ -74,7 +69,6 @@ struct list_head capa_list[CAPA_SITE_MAX]; static struct capa_hmac_alg capa_hmac_algs[] = { DEF_CAPA_HMAC_ALG("sha1", SHA1, 20, 20), }; -#endif /* capa count */ int capa_count[CAPA_SITE_MAX] = { 0, }; @@ -101,7 +95,6 @@ struct hlist_head *init_capa_hash(void) } EXPORT_SYMBOL(init_capa_hash); -#ifdef __KERNEL__ static inline int capa_on_server(struct obd_capa *ocapa) { return ocapa->c_site == CAPA_SITE_SERVER; @@ -387,7 +380,6 @@ out: return rc; } EXPORT_SYMBOL(capa_decrypt_id); -#endif void capa_cpy(void *capa, struct obd_capa *ocapa) { diff --git a/lustre/obdclass/cl_io.c b/lustre/obdclass/cl_io.c index 8878ed8..3f572ee 100644 --- a/lustre/obdclass/cl_io.c +++ b/lustre/obdclass/cl_io.c @@ -41,6 +41,7 @@ #define DEBUG_SUBSYSTEM S_CLASS +#include #include #include #include @@ -1558,14 +1559,6 @@ void cl_req_attr_set(const struct lu_env *env, struct cl_req *req, } EXPORT_SYMBOL(cl_req_attr_set); -/* XXX complete(), init_completion(), and wait_for_completion(), until they are - * implemented in libcfs. */ -#ifdef __KERNEL__ -# include -#else /* __KERNEL__ */ -# include -#endif - /** * Initialize synchronous io wait anchor, for transfer of \a nrpages pages. */ @@ -1617,9 +1610,7 @@ int cl_sync_io_wait(const struct lu_env *env, struct cl_io *io, /* wait until cl_sync_io_note() has done wakeup */ while (unlikely(atomic_read(&anchor->csi_barrier) != 0)) { -#ifdef __KERNEL__ cpu_relax(); -#endif } POISON(anchor, 0x5a, sizeof *anchor); diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index afb0208..0fa08a5 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -35,11 +35,7 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -# include -#else -# include -#endif +#include #include #include @@ -56,10 +52,6 @@ #include #include "llog_internal.h" -#ifndef __KERNEL__ -/* liblustre workaround */ -atomic_t libcfs_kmemory = {0}; -#endif struct obd_device *obd_devs[MAX_OBD_DEVICES]; EXPORT_SYMBOL(obd_devs); @@ -68,10 +60,7 @@ DEFINE_RWLOCK(obd_dev_lock); __u64 obd_max_pages = 0; __u64 obd_max_alloc = 0; -#ifndef __KERNEL__ -__u64 obd_alloc; -__u64 obd_pages; -#endif + static DEFINE_SPINLOCK(obd_updatemax_lock); /* The following are visible and mutable through /proc/sys/lustre/. */ @@ -435,11 +424,7 @@ int class_handle_ioctl(unsigned int cmd, unsigned long arg) RETURN(err); } /* class_handle_ioctl */ -#ifdef __KERNEL__ extern struct miscdevice obd_psdev; -#else -struct miscdevice obd_psdev; -#endif #define OBD_INIT_CHECK #ifdef OBD_INIT_CHECK @@ -517,19 +502,13 @@ static int obd_init_checks(void) extern int class_procfs_init(void); extern int class_procfs_clean(void); -#ifdef __KERNEL__ static int __init init_obdclass(void) -#else -int init_obdclass(void) -#endif { int i, err; -#ifdef __KERNEL__ int lustre_register_fs(void); for (i = CAPA_SITE_CLIENT; i < CAPA_SITE_MAX; i++) INIT_LIST_HEAD(&capa_list[i]); -#endif LCONSOLE_INFO("Lustre: Build Version: "BUILD_VERSION"\n"); @@ -583,11 +562,9 @@ int init_obdclass(void) err = obd_init_caches(); if (err) return err; -#ifdef __KERNEL__ err = class_procfs_init(); if (err) return err; -#endif err = lu_global_init(); if (err) @@ -601,7 +578,7 @@ int init_obdclass(void) if (err != 0) return err; -#if defined(__KERNEL__) && defined(HAVE_SERVER_SUPPORT) +#ifdef HAVE_SERVER_SUPPORT err = dt_global_init(); if (err != 0) return err; @@ -609,15 +586,13 @@ int init_obdclass(void) err = lu_ucred_global_init(); if (err != 0) return err; -#endif +#endif /* HAVE_SERVER_SUPPORT */ err = llog_info_init(); if (err) return err; -#ifdef __KERNEL__ err = lustre_register_fs(); -#endif return err; } @@ -662,11 +637,10 @@ __u64 obd_pages_max(void) return ret; } EXPORT_SYMBOL(obd_pages_max); -#endif +#endif /* LPROCFS */ /* liblustre doesn't call cleanup_obdclass, apparently. we carry on in this * ifdef to the end of the file to cover module and versioning goo.*/ -#ifdef __KERNEL__ static void cleanup_obdclass(void) { int lustre_unregister_fs(void); @@ -681,7 +655,7 @@ static void cleanup_obdclass(void) #ifdef HAVE_SERVER_SUPPORT lu_ucred_global_fini(); dt_global_fini(); -#endif +#endif /* HAVE_SERVER_SUPPORT */ cl_global_fini(); lu_capainfo_fini(); lu_global_fini(); @@ -717,4 +691,3 @@ MODULE_DESCRIPTION("Lustre Class Driver Build Version: " BUILD_VERSION); MODULE_LICENSE("GPL"); cfs_module(obdclass, LUSTRE_VERSION_STRING, init_obdclass, cleanup_obdclass); -#endif diff --git a/lustre/obdclass/debug.c b/lustre/obdclass/debug.c index 7d65547..9f9c0a4 100644 --- a/lustre/obdclass/debug.c +++ b/lustre/obdclass/debug.c @@ -40,9 +40,6 @@ #define DEBUG_SUBSYSTEM D_OTHER -#ifndef __KERNEL__ -# include -#endif #include #include diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c index 37757a8..f20f3b1 100644 --- a/lustre/obdclass/genops.c +++ b/lustre/obdclass/genops.c @@ -40,9 +40,6 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -#include -#endif #include #include @@ -1767,7 +1764,6 @@ void obd_zombie_barrier(void) } EXPORT_SYMBOL(obd_zombie_barrier); -#ifdef __KERNEL__ /** * destroy zombie export/import thread. @@ -1798,34 +1794,13 @@ static int obd_zombie_impexp_thread(void *unused) RETURN(0); } -#else /* ! KERNEL */ - -static atomic_t zombie_recur = ATOMIC_INIT(0); -static void *obd_zombie_impexp_work_cb; -static void *obd_zombie_impexp_idle_cb; - -int obd_zombie_impexp_kill(void *arg) -{ - int rc = 0; - - if (atomic_inc_return(&zombie_recur) == 1) { - obd_zombie_impexp_cull(); - rc = 1; - } - atomic_dec(&zombie_recur); - return rc; -} - -#endif /** * start destroy zombie import/export thread */ int obd_zombie_impexp_init(void) { -#ifdef __KERNEL__ struct task_struct *task; -#endif INIT_LIST_HEAD(&obd_zombie_imports); @@ -1836,22 +1811,11 @@ int obd_zombie_impexp_init(void) init_waitqueue_head(&obd_zombie_waitq); obd_zombie_pid = 0; -#ifdef __KERNEL__ task = kthread_run(obd_zombie_impexp_thread, NULL, "obd_zombid"); if (IS_ERR(task)) RETURN(PTR_ERR(task)); wait_for_completion(&obd_zombie_start); -#else - - obd_zombie_impexp_work_cb = - liblustre_register_wait_callback("obd_zombi_impexp_kill", - &obd_zombie_impexp_kill, NULL); - - obd_zombie_impexp_idle_cb = - liblustre_register_idle_callback("obd_zombi_impexp_check", - &obd_zombie_impexp_check, NULL); -#endif RETURN(0); } /** @@ -1861,12 +1825,7 @@ void obd_zombie_impexp_stop(void) { set_bit(OBD_ZOMBIE_STOP, &obd_zombie_flags); obd_zombie_impexp_notify(); -#ifdef __KERNEL__ wait_for_completion(&obd_zombie_stop); -#else - liblustre_deregister_wait_callback(obd_zombie_impexp_work_cb); - liblustre_deregister_idle_callback(obd_zombie_impexp_idle_cb); -#endif } /***** Kernel-userspace comm helpers *******/ diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index 0d7f656..04ec8c5 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -42,7 +42,6 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifdef __KERNEL__ #include #include #include @@ -66,9 +65,6 @@ #include #include #include -#else -# include -#endif #include #include @@ -78,7 +74,6 @@ #include #include #include -#ifdef __KERNEL__ int proc_version; @@ -223,7 +218,6 @@ struct miscdevice obd_psdev = { .fops = &obd_psdev_fops, }; -#endif #ifdef LPROCFS static int obd_proc_version_seq_show(struct seq_file *m, void *v) @@ -340,7 +334,6 @@ struct lprocfs_seq_vars lprocfs_base[] = { #define lprocfs_base NULL #endif /* LPROCFS */ -#ifdef __KERNEL__ static void *obd_device_list_seq_start(struct seq_file *p, loff_t *pos) { if (*pos >= class_devno_max()) @@ -416,11 +409,9 @@ struct file_operations obd_device_list_fops = { .llseek = seq_lseek, .release = seq_release, }; -#endif int class_procfs_init(void) { -#ifdef __KERNEL__ int rc; ENTRY; @@ -431,13 +422,9 @@ int class_procfs_init(void) &obd_device_list_fops, NULL); if (rc) CERROR("error adding /proc/fs/lustre/devices file\n"); -#else - ENTRY; -#endif RETURN(0); } -#ifdef __KERNEL__ int class_procfs_clean(void) { ENTRY; @@ -446,4 +433,3 @@ int class_procfs_clean(void) } RETURN(0); } -#endif diff --git a/lustre/obdclass/llog.c b/lustre/obdclass/llog.c index cd2166d..78ba445 100644 --- a/lustre/obdclass/llog.c +++ b/lustre/obdclass/llog.c @@ -47,9 +47,6 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef __KERNEL__ -#include -#endif #include #include @@ -418,7 +415,6 @@ out: return 0; } -#ifdef __KERNEL__ static int llog_process_thread_daemonize(void *arg) { struct llog_process_info *lpi = arg; @@ -440,7 +436,6 @@ out: complete(&lpi->lpi_completion); return rc; } -#endif int llog_process_or_fork(const struct lu_env *env, struct llog_handle *loghandle, @@ -461,7 +456,6 @@ int llog_process_or_fork(const struct lu_env *env, lpi->lpi_cbdata = data; lpi->lpi_catdata = catdata; -#ifdef __KERNEL__ if (fork) { struct task_struct *task; @@ -482,15 +476,9 @@ int llog_process_or_fork(const struct lu_env *env, lpi->lpi_env = env; llog_process_thread(lpi); } -#else - lpi->lpi_env = env; - llog_process_thread(lpi); -#endif rc = lpi->lpi_rc; -#ifdef __KERNEL__ out_lpi: -#endif OBD_FREE_PTR(lpi); RETURN(rc); } diff --git a/lustre/obdclass/llog_cat.c b/lustre/obdclass/llog_cat.c index 05d2f26..0d47c58 100644 --- a/lustre/obdclass/llog_cat.c +++ b/lustre/obdclass/llog_cat.c @@ -48,9 +48,6 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef __KERNEL__ -#include -#endif #include diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c index a2dc63a..2761698 100644 --- a/lustre/obdclass/llog_obd.c +++ b/lustre/obdclass/llog_obd.c @@ -36,9 +36,6 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef __KERNEL__ -#include -#endif #include #include diff --git a/lustre/obdclass/llog_swab.c b/lustre/obdclass/llog_swab.c index 150921a..a647a4b 100644 --- a/lustre/obdclass/llog_swab.c +++ b/lustre/obdclass/llog_swab.c @@ -42,9 +42,6 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef __KERNEL__ -#include -#endif #include diff --git a/lustre/obdclass/lprocfs_counters.c b/lustre/obdclass/lprocfs_counters.c index 51ce4ae..7e78335 100644 --- a/lustre/obdclass/lprocfs_counters.c +++ b/lustre/obdclass/lprocfs_counters.c @@ -36,11 +36,7 @@ * * Author: Andreas Dilger */ -#ifdef __KERNEL__ #include -#else -#include -#endif #include #include diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c index 05b378e..f0d2205 100644 --- a/lustre/obdclass/lprocfs_jobstats.c +++ b/lustre/obdclass/lprocfs_jobstats.c @@ -30,9 +30,6 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -# include -#endif #include #include diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c index 455934d..dce67d5 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -40,9 +40,6 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -#include -#endif #include #include diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c index 5abee4e..10e0cd3 100644 --- a/lustre/obdclass/lprocfs_status_server.c +++ b/lustre/obdclass/lprocfs_status_server.c @@ -34,9 +34,6 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -#include -#endif #include #include diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c index 567c4b4..eda5e9c 100644 --- a/lustre/obdclass/lu_object.c +++ b/lustre/obdclass/lu_object.c @@ -45,13 +45,8 @@ #define DEBUG_SUBSYSTEM S_CLASS #include - -#ifdef __KERNEL__ -# include -#endif - -/* hash_long() */ -#include +#include +#include /* hash_long() */ #include #include #include @@ -1941,7 +1936,6 @@ static void lu_site_stats_get(cfs_hash_t *hs, } } -#ifdef __KERNEL__ static unsigned long lu_cache_shrink_count(struct shrinker *sk, struct shrink_control *sc) @@ -2096,7 +2090,6 @@ void lu_context_keys_dump(void) } } EXPORT_SYMBOL(lu_context_keys_dump); -#endif /* __KERNEL__ */ /** * Initialization of global lu_* data. diff --git a/lustre/obdclass/lu_ref.c b/lustre/obdclass/lu_ref.c index 94ad740..5d2fc06 100644 --- a/lustre/obdclass/lu_ref.c +++ b/lustre/obdclass/lu_ref.c @@ -42,12 +42,7 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifdef __KERNEL__ -# include -#else -# include -#endif - +#include #include #include #include @@ -296,7 +291,7 @@ void lu_ref_del_at(struct lu_ref *ref, struct lu_ref_link *link, } EXPORT_SYMBOL(lu_ref_del_at); -#if defined(__KERNEL__) && defined(LPROCFS) +#ifdef LPROCFS static void *lu_ref_seq_start(struct seq_file *seq, loff_t *pos) { @@ -420,7 +415,7 @@ static struct file_operations lu_ref_dump_fops = { .release = lu_ref_seq_release }; -#endif +#endif /* LPROCFS */ int lu_ref_global_init(void) { @@ -433,23 +428,23 @@ int lu_ref_global_init(void) spin_lock_init(&lu_ref_refs_guard); result = lu_kmem_init(lu_ref_caches); -#if defined(__KERNEL__) && defined(LPROCFS) +#ifdef LPROCFS if (result == 0) { result = lprocfs_seq_create(proc_lustre_root, "lu_refs", 0444, &lu_ref_dump_fops, NULL); if (result) lu_kmem_fini(lu_ref_caches); } -#endif +#endif /* LPROCFS */ return result; } void lu_ref_global_fini(void) { -#if defined(__KERNEL__) && defined(LPROCFS) +#ifdef LPROCFS lprocfs_remove_proc_entry("lu_refs", proc_lustre_root); -#endif +#endif /* LPROCFS */ lu_kmem_fini(lu_ref_caches); } diff --git a/lustre/obdclass/lustre_handles.c b/lustre/obdclass/lustre_handles.c index e4dc355..0827178 100644 --- a/lustre/obdclass/lustre_handles.c +++ b/lustre/obdclass/lustre_handles.c @@ -39,23 +39,11 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -# include -#endif #include #include #include -#ifndef __KERNEL__ -# define list_add_rcu list_add -# define list_del_rcu list_del -# define list_for_each_rcu list_for_each -# define list_for_each_safe_rcu list_for_each_safe -# define list_for_each_entry_rcu list_for_each_entry -# define rcu_read_lock() spin_lock(&bucket->lock) -# define rcu_read_unlock() spin_unlock(&bucket->lock) -#endif /* !__KERNEL__ */ static __u64 handle_base; #define HANDLE_INCR 7 diff --git a/lustre/obdclass/lustre_peer.c b/lustre/obdclass/lustre_peer.c index 46581a5..bce4efe 100644 --- a/lustre/obdclass/lustre_peer.c +++ b/lustre/obdclass/lustre_peer.c @@ -36,9 +36,6 @@ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#endif #include #include #include diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index c080610..be27f65 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -39,16 +39,9 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#ifdef __KERNEL__ #include #include #include -#else -#include -#include -#include -#include -#endif #include #include #include @@ -1271,7 +1264,6 @@ EXPORT_SYMBOL(class_process_config); int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, struct lustre_cfg *lcfg, void *data) { -#ifdef __KERNEL__ struct lprocfs_vars *var; char *key, *sval; int i, keylen, vallen; @@ -1349,19 +1341,13 @@ int class_process_proc_param(char *prefix, struct lprocfs_vars *lvars, if (!rc && skip) rc = skip; RETURN(rc); -#else - CDEBUG(D_CONFIG, "liblustre can't process params.\n"); - /* Don't throw config error */ - RETURN(0); -#endif } EXPORT_SYMBOL(class_process_proc_param); -#endif +#endif /* !HAVE_ONLY_PROCFS_SEQ */ int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars, struct lustre_cfg *lcfg, void *data) { -#ifdef __KERNEL__ struct lprocfs_seq_vars *var; struct file fakefile; struct seq_file fake_seqfile; @@ -1444,19 +1430,10 @@ int class_process_proc_seq_param(char *prefix, struct lprocfs_seq_vars *lvars, if (!rc && skip) rc = skip; RETURN(rc); -#else - CDEBUG(D_CONFIG, "liblustre can't process params.\n"); - /* Don't throw config error */ - RETURN(0); -#endif } EXPORT_SYMBOL(class_process_proc_seq_param); -#ifdef __KERNEL__ extern int lustre_check_exclusion(struct super_block *sb, char *svname); -#else -#define lustre_check_exclusion(a,b) 0 -#endif /* * Supplemental functions for config logs, it allocates lustre_cfg @@ -1599,7 +1576,7 @@ int class_config_llog_handler(const struct lu_env *env, } } -#if defined(HAVE_SERVER_SUPPORT) && defined(__KERNEL__) +#ifdef HAVE_SERVER_SUPPORT /* newer MDS replaces LOV/OSC with LOD/OSP */ { char *typename = lustre_cfg_string(lcfg, 1); @@ -1623,7 +1600,7 @@ int class_config_llog_handler(const struct lu_env *env, strcpy(typename, LUSTRE_OSP_NAME); } } -#endif +#endif /* HAVE_SERVER_SUPPORT */ if (clli->cfg_flags & CFG_F_EXCLUDE) { CDEBUG(D_CONFIG, "cmd: %x marked EXCLUDED\n", diff --git a/lustre/obdclass/obdo.c b/lustre/obdclass/obdo.c index 7cf1ca0..4ac18b4 100644 --- a/lustre/obdclass/obdo.c +++ b/lustre/obdclass/obdo.c @@ -42,12 +42,8 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -#include "../liblustre/llite_lib.h" -#else #include #include -#endif void obdo_set_parent_fid(struct obdo *dst, const struct lu_fid *parent) { @@ -121,10 +117,8 @@ EXPORT_SYMBOL(obdo_from_inode); void obdo_cpy_md(struct obdo *dst, const struct obdo *src, obd_flag valid) { -#ifdef __KERNEL__ CDEBUG(D_INODE, "src obdo "DOSTID" valid "LPX64", dst obdo "DOSTID"\n", POSTID(&src->o_oi), src->o_valid, POSTID(&dst->o_oi)); -#endif if (valid & OBD_MD_FLATIME) dst->o_atime = src->o_atime; if (valid & OBD_MD_FLMTIME) diff --git a/lustre/obdclass/statfs_pack.c b/lustre/obdclass/statfs_pack.c index 7284f65..ba9c649 100644 --- a/lustre/obdclass/statfs_pack.c +++ b/lustre/obdclass/statfs_pack.c @@ -40,9 +40,6 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -#include -#endif #include #include diff --git a/lustre/obdclass/uuid.c b/lustre/obdclass/uuid.c index 40fb984..d3faea7 100644 --- a/lustre/obdclass/uuid.c +++ b/lustre/obdclass/uuid.c @@ -38,16 +38,10 @@ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -# include -#else -# include -#endif - +#include #include #include - static inline __u32 consume(int nob, __u8 **ptr) { __u32 value; diff --git a/lustre/obdecho/echo_client.c b/lustre/obdecho/echo_client.c index c7fcb5b..baccb17 100644 --- a/lustre/obdecho/echo_client.c +++ b/lustre/obdecho/echo_client.c @@ -35,11 +35,7 @@ */ #define DEBUG_SUBSYSTEM S_ECHO -#ifdef __KERNEL__ #include -#else -#include -#endif #include #include @@ -3034,7 +3030,6 @@ void echo_client_exit(void) lu_kmem_fini(echo_caches); } -#ifdef __KERNEL__ static int __init obdecho_init(void) { int rc; @@ -3087,6 +3082,5 @@ MODULE_DESCRIPTION("Lustre Testing Echo OBD driver"); MODULE_LICENSE("GPL"); cfs_module(obdecho, LUSTRE_VERSION_STRING, obdecho_init, obdecho_exit); -#endif /* __KERNEL__ */ /** @} echo_client */ diff --git a/lustre/obdecho/echo_internal.h b/lustre/obdecho/echo_internal.h index fdaa43c..474c6dc 100644 --- a/lustre/obdecho/echo_internal.h +++ b/lustre/obdecho/echo_internal.h @@ -43,18 +43,10 @@ /* block size to use for data verification */ #define OBD_ECHO_BLOCK_SIZE (4<<10) -#ifdef __KERNEL__ -# ifdef HAVE_SERVER_SUPPORT +#ifdef HAVE_SERVER_SUPPORT extern struct obd_ops echo_obd_ops; int echo_persistent_pages_init(void); void echo_persistent_pages_fini(void); -# endif -#else /* ! __KERNEL__ */ -/* Kludge here, define some functions and macros needed by liblustre -jay */ - -#define READ 0 -#define WRITE 1 - -#endif /* ifdef __KERNEL__ */ +#endif /* HAVE_SERVER_SUPPORT */ #endif diff --git a/lustre/osc/osc_cl_internal.h b/lustre/osc/osc_cl_internal.h index 3941910..724a70a 100644 --- a/lustre/osc/osc_cl_internal.h +++ b/lustre/osc/osc_cl_internal.h @@ -46,12 +46,7 @@ #ifndef OSC_CL_INTERNAL_H #define OSC_CL_INTERNAL_H -#ifdef __KERNEL__ -# include -#else -# include -#endif - +#include #include /* osc_build_res_name() */ #include diff --git a/lustre/osc/osc_io.c b/lustre/osc/osc_io.c index 0070308..f60b05b 100644 --- a/lustre/osc/osc_io.c +++ b/lustre/osc/osc_io.c @@ -395,7 +395,6 @@ static int osc_async_upcall(void *a, int rc) return 0; } -#if defined(__KERNEL__) /** * Checks that there are no pages being written in the extent being truncated. */ @@ -412,11 +411,9 @@ static int trunc_check_cb(const struct lu_env *env, struct cl_io *io, CL_PAGE_DEBUG(D_ERROR, env, page, "exists " LPU64 "/%s.\n", start, current->comm); -#ifdef __linux__ if (PageLocked(page->cp_vmpage)) CDEBUG(D_CACHE, "page %p index %lu locked for %d.\n", ops, osc_index(ops), oap->oap_cmd & OBD_BRW_RWMASK); -#endif return CLP_GANG_OKAY; } @@ -439,13 +436,6 @@ static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, start + partial, CL_PAGE_EOF, trunc_check_cb, (void *)&size); } -#else /* __KERNEL__ */ -static void osc_trunc_check(const struct lu_env *env, struct cl_io *io, - struct osc_io *oio, __u64 size) -{ - return; -} -#endif static int osc_io_setattr_start(const struct lu_env *env, const struct cl_io_slice *slice) diff --git a/lustre/osc/osc_lock.c b/lustre/osc/osc_lock.c index 4f9fe7a..0f46193 100644 --- a/lustre/osc/osc_lock.c +++ b/lustre/osc/osc_lock.c @@ -41,11 +41,7 @@ #define DEBUG_SUBSYSTEM S_OSC -#ifdef __KERNEL__ -# include -#else -# include -#endif +#include /* fid_build_reg_res_name() */ #include @@ -912,9 +908,7 @@ static int weigh_cb(const struct lu_env *env, struct cl_io *io, struct cl_page *page = ops->ops_cl.cpl_page; if (cl_page_is_vmlocked(env, page) -#if defined(__KERNEL__) || PageDirty(page->cp_vmpage) || PageWriteback(page->cp_vmpage) -#endif ) { (*(unsigned long *)cbdata)++; return CLP_GANG_ABORT; diff --git a/lustre/osc/osc_quota.c b/lustre/osc/osc_quota.c index 31db149..be434d6 100644 --- a/lustre/osc/osc_quota.c +++ b/lustre/osc/osc_quota.c @@ -27,9 +27,6 @@ * * Code originally extracted from quota directory */ -#ifndef __KERNEL__ -# include -#endif #include #include "osc_internal.h" diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index cd84b54..7a05587 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -38,9 +38,6 @@ #include -#ifndef __KERNEL__ -# include -#endif #include #include @@ -1319,7 +1316,6 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa, ergo(i == page_count - 1, poff == 0)), "i: %d/%d pg: %p off: "LPU64", count: %u\n", i, page_count, pg, pg->off, pg->count); -#ifdef __linux__ LASSERTF(i == 0 || pg->off > pg_prev->off, "i %d p_c %u pg %p [pri %lu ind %lu] off "LPU64 " prev_pg %p [pri %lu ind %lu] off "LPU64"\n", @@ -1327,10 +1323,6 @@ static int osc_brw_prep_request(int cmd, struct client_obd *cli,struct obdo *oa, pg->pg, page_private(pg->pg), pg->pg->index, pg->off, pg_prev->pg, page_private(pg_prev->pg), pg_prev->pg->index, pg_prev->off); -#else - LASSERTF(i == 0 || pg->off > pg_prev->off, - "i %d p_c %u\n", i, page_count); -#endif LASSERT((pga[0]->flag & OBD_BRW_SRVLOCK) == (pg->flag & OBD_BRW_SRVLOCK)); @@ -3333,7 +3325,6 @@ int __init osc_init(void) RETURN(rc); } -#ifdef __KERNEL__ static void /*__exit*/ osc_exit(void) { class_unregister_type(LUSTRE_OSC_NAME); @@ -3345,4 +3336,3 @@ MODULE_DESCRIPTION("Lustre Object Storage Client (OSC)"); MODULE_LICENSE("GPL"); cfs_module(osc, LUSTRE_VERSION_STRING, osc_init, osc_exit); -#endif diff --git a/lustre/osd-ldiskfs/osd_dynlocks.c b/lustre/osd-ldiskfs/osd_dynlocks.c index 0e01a67..e14fab4 100644 --- a/lustre/osd-ldiskfs/osd_dynlocks.c +++ b/lustre/osd-ldiskfs/osd_dynlocks.c @@ -26,7 +26,6 @@ * in that lockspace * */ -#ifdef __KERNEL__ #include #include @@ -219,4 +218,3 @@ int dynlock_is_locked(struct dynlock *dl, unsigned long value) spin_unlock(&dl->dl_list_lock); return result; } -#endif diff --git a/lustre/osd-ldiskfs/osd_iam.h b/lustre/osd-ldiskfs/osd_iam.h index 78a1ce5..bc1306b 100644 --- a/lustre/osd-ldiskfs/osd_iam.h +++ b/lustre/osd-ldiskfs/osd_iam.h @@ -92,7 +92,6 @@ enum { DX_FMT_NAME_LEN = 16, }; -#ifdef __KERNEL__ /* * Debugging. @@ -1131,7 +1130,6 @@ static inline int ldiskfs_check_dir_entry(const char * function, */ /* __KERNEL__ */ -#endif /* * User level API. Copy exists in lustre/lustre/tests/iam_ut.c diff --git a/lustre/osd-ldiskfs/osd_internal.h b/lustre/osd-ldiskfs/osd_internal.h index b248e05..b3f15b5 100644 --- a/lustre/osd-ldiskfs/osd_internal.h +++ b/lustre/osd-ldiskfs/osd_internal.h @@ -43,7 +43,6 @@ #ifndef _OSD_INTERNAL_H #define _OSD_INTERNAL_H -#if defined(__KERNEL__) /* struct mutex */ #include @@ -1108,5 +1107,4 @@ void ldiskfs_dec_count(handle_t *handle, struct inode *inode); void osd_fini_iobuf(struct osd_device *d, struct osd_iobuf *iobuf); -#endif /* __KERNEL__ */ #endif /* _OSD_INTERNAL_H */ diff --git a/lustre/osd-ldiskfs/osd_oi.h b/lustre/osd-ldiskfs/osd_oi.h index 2e6848f..c9d727d 100644 --- a/lustre/osd-ldiskfs/osd_oi.h +++ b/lustre/osd-ldiskfs/osd_oi.h @@ -49,7 +49,6 @@ #ifndef _OSD_OI_H #define _OSD_OI_H -#if defined(__KERNEL__) /* struct rw_semaphore */ #include @@ -155,5 +154,4 @@ int osd_oi_update(struct osd_thread_info *info, struct osd_device *osd, int fid_is_on_ost(struct osd_thread_info *info, struct osd_device *osd, const struct lu_fid *fid, enum oi_check_flags flags); -#endif /* __KERNEL__ */ #endif /* _OSD_OI_H */ diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 6416e5f..8c2a833 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -37,11 +37,6 @@ /** Implementation of client-side PortalRPC interfaces */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#include -#include -#endif #include #include @@ -2419,12 +2414,10 @@ int ptlrpc_unregister_reply(struct ptlrpc_request *request, int async) * unlinked before returning a req to the pool. */ for (;;) { -#ifdef __KERNEL__ /* The wq argument is ignored by user-space wait_event macros */ wait_queue_head_t *wq = (request->rq_set != NULL) ? &request->rq_set->set_waitq : &request->rq_reply_waitq; -#endif /* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK), diff --git a/lustre/ptlrpc/connection.c b/lustre/ptlrpc/connection.c index d85fcf2..9f20b07 100644 --- a/lustre/ptlrpc/connection.c +++ b/lustre/ptlrpc/connection.c @@ -35,13 +35,9 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifdef __KERNEL__ #include #include #include -#else -#include -#endif #include "ptlrpc_internal.h" diff --git a/lustre/ptlrpc/errno.c b/lustre/ptlrpc/errno.c index 83aab13..91c6188 100644 --- a/lustre/ptlrpc/errno.c +++ b/lustre/ptlrpc/errno.c @@ -172,7 +172,6 @@ static int lustre_errno_hton_mapping[] = { [EKEYREJECTED] = LUSTRE_EKEYREJECTED, [EOWNERDEAD] = LUSTRE_EOWNERDEAD, [ENOTRECOVERABLE] = LUSTRE_ENOTRECOVERABLE, -#ifdef __KERNEL__ [ERESTARTSYS] = LUSTRE_ERESTARTSYS, [ERESTARTNOINTR] = LUSTRE_ERESTARTNOINTR, [ERESTARTNOHAND] = LUSTRE_ERESTARTNOHAND, @@ -188,7 +187,6 @@ static int lustre_errno_hton_mapping[] = { [EJUKEBOX] = LUSTRE_EJUKEBOX, [EIOCBQUEUED] = LUSTRE_EIOCBQUEUED, [EIOCBRETRY] = LUSTRE_EIOCBRETRY -#endif }; static int lustre_errno_ntoh_mapping[] = { @@ -321,7 +319,6 @@ static int lustre_errno_ntoh_mapping[] = { [LUSTRE_EKEYREJECTED] = EKEYREJECTED, [LUSTRE_EOWNERDEAD] = EOWNERDEAD, [LUSTRE_ENOTRECOVERABLE] = ENOTRECOVERABLE, -#ifdef __KERNEL__ [LUSTRE_ERESTARTSYS] = ERESTARTSYS, [LUSTRE_ERESTARTNOINTR] = ERESTARTNOINTR, [LUSTRE_ERESTARTNOHAND] = ERESTARTNOHAND, @@ -337,7 +334,6 @@ static int lustre_errno_ntoh_mapping[] = { [LUSTRE_EJUKEBOX] = EJUKEBOX, [LUSTRE_EIOCBQUEUED] = EIOCBQUEUED, [LUSTRE_EIOCBRETRY] = EIOCBRETRY -#endif }; unsigned int lustre_errno_hton(unsigned int h) diff --git a/lustre/ptlrpc/events.c b/lustre/ptlrpc/events.c index 96e68d4..cd3fecb 100644 --- a/lustre/ptlrpc/events.c +++ b/lustre/ptlrpc/events.c @@ -36,15 +36,8 @@ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#else -# include -# ifdef __mips64__ -# include -# endif -#endif - +#include +#include #include #include #include @@ -594,11 +587,7 @@ lnet_pid_t ptl_get_pid(void) { lnet_pid_t pid; -#ifndef __KERNEL__ - pid = getpid(); -#else pid = LUSTRE_SRV_LNET_PID; -#endif return pid; } @@ -619,18 +608,11 @@ int ptlrpc_ni_init(void) /* CAVEAT EMPTOR: how we process portals events is _radically_ * different depending on... */ -#ifdef __KERNEL__ /* kernel LNet calls our master callback when there are new event, * because we are guaranteed to get every event via callback, * so we just set EQ size to 0 to avoid overhread of serializing * enqueue/dequeue operations in LNet. */ rc = LNetEQAlloc(0, ptlrpc_master_callback, &ptlrpc_eq_h); -#else - /* liblustre calls the master callback when it removes events from the - * event queue. The event queue has to be big enough not to drop - * anything */ - rc = LNetEQAlloc(10240, LNET_EQ_HANDLER_NONE, &ptlrpc_eq_h); -#endif if (rc == 0) return 0; @@ -640,163 +622,6 @@ int ptlrpc_ni_init(void) return rc; } -#ifndef __KERNEL__ -struct list_head liblustre_wait_callbacks; -struct list_head liblustre_idle_callbacks; -void *liblustre_services_callback; - -void * -liblustre_register_waitidle_callback(struct list_head *callback_list, - const char *name, - int (*fn)(void *arg), void *arg) -{ - struct liblustre_wait_callback *llwc; - - OBD_ALLOC(llwc, sizeof(*llwc)); - LASSERT (llwc != NULL); - - llwc->llwc_name = name; - llwc->llwc_fn = fn; - llwc->llwc_arg = arg; - list_add_tail(&llwc->llwc_list, callback_list); - - return (llwc); -} - -void -liblustre_deregister_waitidle_callback (void *opaque) -{ - struct liblustre_wait_callback *llwc = opaque; - - list_del(&llwc->llwc_list); - OBD_FREE(llwc, sizeof(*llwc)); -} - -void * -liblustre_register_wait_callback (const char *name, - int (*fn)(void *arg), void *arg) -{ - return liblustre_register_waitidle_callback(&liblustre_wait_callbacks, - name, fn, arg); -} - -void -liblustre_deregister_wait_callback (void *opaque) -{ - liblustre_deregister_waitidle_callback(opaque); -} - -void * -liblustre_register_idle_callback (const char *name, - int (*fn)(void *arg), void *arg) -{ - return liblustre_register_waitidle_callback(&liblustre_idle_callbacks, - name, fn, arg); -} - -void -liblustre_deregister_idle_callback (void *opaque) -{ - liblustre_deregister_waitidle_callback(opaque); -} - -int -liblustre_check_events (int timeout) -{ - lnet_event_t ev; - int rc; - int i; - ENTRY; - - rc = LNetEQPoll(&ptlrpc_eq_h, 1, timeout * 1000, &ev, &i); - if (rc == 0) - RETURN(0); - - LASSERT (rc == -EOVERFLOW || rc == 1); - - /* liblustre: no asynch callback so we can't afford to miss any - * events... */ - if (rc == -EOVERFLOW) { - CERROR ("Dropped an event!!!\n"); - abort(); - } - - ptlrpc_master_callback (&ev); - RETURN(1); -} - -int liblustre_waiting = 0; - -int -liblustre_wait_event (int timeout) -{ - struct list_head *tmp; - struct liblustre_wait_callback *llwc; - int found_something = 0; - - /* single threaded recursion check... */ - liblustre_waiting = 1; - - for (;;) { - /* Deal with all pending events */ - while (liblustre_check_events(0)) - found_something = 1; - - /* Give all registered callbacks a bite at the cherry */ - list_for_each(tmp, &liblustre_wait_callbacks) { - llwc = list_entry(tmp, - struct liblustre_wait_callback, - llwc_list); - - if (llwc->llwc_fn(llwc->llwc_arg)) - found_something = 1; - } - - if (found_something || timeout == 0) - break; - - /* Nothing so far, but I'm allowed to block... */ - found_something = liblustre_check_events(timeout); - if (!found_something) /* still nothing */ - break; /* I timed out */ - } - - liblustre_waiting = 0; - - return found_something; -} - -void -liblustre_wait_idle(void) -{ - static int recursed = 0; - struct list_head *tmp; - struct liblustre_wait_callback *llwc; - int idle = 0; - - LASSERT(!recursed); - recursed = 1; - - do { - liblustre_wait_event(0); - - idle = 1; - - list_for_each(tmp, &liblustre_idle_callbacks) { - llwc = list_entry(tmp, struct liblustre_wait_callback, - llwc_list); - if (!llwc->llwc_fn(llwc->llwc_arg)) { - idle = 0; - break; - } - } - - } while (!idle); - - recursed = 0; -} - -#endif /* __KERNEL__ */ int ptlrpc_init_portals(void) { @@ -806,33 +631,17 @@ int ptlrpc_init_portals(void) CERROR("network initialisation failed\n"); return rc; } -#ifndef __KERNEL__ - INIT_LIST_HEAD(&liblustre_wait_callbacks); - INIT_LIST_HEAD(&liblustre_idle_callbacks); - - liblustre_services_callback = - liblustre_register_wait_callback("liblustre_check_services", - &liblustre_check_services, - NULL); - init_completion_module(liblustre_wait_event); -#endif rc = ptlrpcd_addref(); if (rc == 0) return 0; CERROR("rpcd initialisation failed\n"); -#ifndef __KERNEL__ - liblustre_deregister_wait_callback(liblustre_services_callback); -#endif ptlrpc_ni_fini(); return rc; } void ptlrpc_exit_portals(void) { -#ifndef __KERNEL__ - liblustre_deregister_wait_callback(liblustre_services_callback); -#endif ptlrpcd_decref(); ptlrpc_ni_fini(); } diff --git a/lustre/ptlrpc/gss/gss_bulk.c b/lustre/ptlrpc/gss/gss_bulk.c index edc59289..1f0c06e0 100644 --- a/lustre/ptlrpc/gss/gss_bulk.c +++ b/lustre/ptlrpc/gss/gss_bulk.c @@ -37,7 +37,6 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -45,9 +44,6 @@ #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_cli_upcall.c b/lustre/ptlrpc/gss/gss_cli_upcall.c index 35250c0..cb0695d 100644 --- a/lustre/ptlrpc/gss/gss_cli_upcall.c +++ b/lustre/ptlrpc/gss/gss_cli_upcall.c @@ -39,16 +39,12 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_generic_token.c b/lustre/ptlrpc/gss/gss_generic_token.c index 0c05df4..3c4e63b 100644 --- a/lustre/ptlrpc/gss/gss_generic_token.c +++ b/lustre/ptlrpc/gss/gss_generic_token.c @@ -42,14 +42,10 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index 3e943c0..e6ade3b 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -39,7 +39,6 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -51,9 +50,6 @@ #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c index e79ffdd..d286a71 100644 --- a/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -49,15 +49,11 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_mech_switch.c b/lustre/ptlrpc/gss/gss_mech_switch.c index 608aa8c..8306b21 100644 --- a/lustre/ptlrpc/gss/gss_mech_switch.c +++ b/lustre/ptlrpc/gss/gss_mech_switch.c @@ -44,14 +44,10 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_null_mech.c b/lustre/ptlrpc/gss/gss_null_mech.c index cdb120d..3021d7d 100644 --- a/lustre/ptlrpc/gss/gss_null_mech.c +++ b/lustre/ptlrpc/gss/gss_null_mech.c @@ -25,15 +25,11 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_pipefs.c b/lustre/ptlrpc/gss/gss_pipefs.c index ed854b2..e532572 100644 --- a/lustre/ptlrpc/gss/gss_pipefs.c +++ b/lustre/ptlrpc/gss/gss_pipefs.c @@ -47,7 +47,6 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -58,9 +57,6 @@ #include struct rpc_clnt; /* for rpc_pipefs */ #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_sk_mech.c b/lustre/ptlrpc/gss/gss_sk_mech.c index 590a839..df31b18 100644 --- a/lustre/ptlrpc/gss/gss_sk_mech.c +++ b/lustre/ptlrpc/gss/gss_sk_mech.c @@ -25,15 +25,11 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c index 3e60767..44e91da 100644 --- a/lustre/ptlrpc/gss/gss_svc_upcall.c +++ b/lustre/ptlrpc/gss/gss_svc_upcall.c @@ -48,7 +48,6 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -56,9 +55,6 @@ #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c index 06f219e..d05d35b 100644 --- a/lustre/ptlrpc/gss/lproc_gss.c +++ b/lustre/ptlrpc/gss/lproc_gss.c @@ -35,16 +35,12 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/gss/sec_gss.c b/lustre/ptlrpc/gss/sec_gss.c index ccd5ff7..e337689 100644 --- a/lustre/ptlrpc/gss/sec_gss.c +++ b/lustre/ptlrpc/gss/sec_gss.c @@ -47,7 +47,6 @@ */ #define DEBUG_SUBSYSTEM S_SEC -#ifdef __KERNEL__ #include #include #include @@ -55,9 +54,6 @@ #include #include #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/import.c b/lustre/ptlrpc/import.c index 901af6f..ae43f74 100644 --- a/lustre/ptlrpc/import.c +++ b/lustre/ptlrpc/import.c @@ -39,9 +39,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#endif #include #include @@ -720,9 +717,6 @@ int ptlrpc_connect_import(struct obd_import *imp) request->rq_timeout = INITIAL_CONNECT_TIMEOUT; lustre_msg_set_timeout(request->rq_reqmsg, request->rq_timeout); -#ifndef __KERNEL__ - lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_LIBCLIENT); -#endif lustre_msg_add_op_flags(request->rq_reqmsg, MSG_CONNECT_NEXT_VER); request->rq_no_resend = request->rq_no_delay = 1; @@ -767,7 +761,6 @@ EXPORT_SYMBOL(ptlrpc_connect_import); static void ptlrpc_maybe_ping_import_soon(struct obd_import *imp) { -#ifdef __KERNEL__ int force_verify; spin_lock(&imp->imp_lock); @@ -776,10 +769,6 @@ static void ptlrpc_maybe_ping_import_soon(struct obd_import *imp) if (force_verify) ptlrpc_pinger_wake_up(); -#else - /* liblustre has no pinger thread, so we wakeup pinger anyway */ - ptlrpc_pinger_wake_up(); -#endif } static int ptlrpc_busy_reconnect(int rc) @@ -1069,13 +1058,8 @@ finish: of macro arguments */ const char *older = "older than client. " "Consider upgrading server"; -#ifdef __KERNEL__ const char *newer = "newer than client. " "Consider recompiling application"; -#else - const char *newer = "newer than client. " - "Consider upgrading client"; -#endif LCONSOLE_WARN("Server %s version (%d.%d.%d.%d) " "is much %s (%s)\n", @@ -1304,7 +1288,6 @@ static int signal_completed_replay(struct obd_import *imp) RETURN(0); } -#ifdef __KERNEL__ /** * In kernel code all import invalidation happens in its own * separate thread, so that whatever application happened to encounter @@ -1335,7 +1318,6 @@ static int ptlrpc_invalidate_import_thread(void *data) class_import_put(imp); RETURN(0); } -#endif /** * This is the state machine for client-side recovery on import. @@ -1385,7 +1367,6 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) imp->imp_vbr_failed = 0; spin_unlock(&imp->imp_lock); -#ifdef __KERNEL__ { struct task_struct *task; /* bug 17802: XXX client_disconnect_export vs connect request @@ -1404,11 +1385,6 @@ int ptlrpc_import_recovery_state_machine(struct obd_import *imp) } RETURN(rc); } -#else - ptlrpc_invalidate_import(imp); - - IMPORT_SET_STATE(imp, LUSTRE_IMP_RECOVER); -#endif } if (imp->imp_state == LUSTRE_IMP_REPLAY) { diff --git a/lustre/ptlrpc/layout.c b/lustre/ptlrpc/layout.c index 4ecd9b5..6bfc1d2 100644 --- a/lustre/ptlrpc/layout.c +++ b/lustre/ptlrpc/layout.c @@ -50,11 +50,7 @@ #define DEBUG_SUBSYSTEM S_RPC -#ifdef __KERNEL__ #include -#else -# include -#endif /* LUSTRE_VERSION_CODE */ #include diff --git a/lustre/ptlrpc/llog_client.c b/lustre/ptlrpc/llog_client.c index cad3e24..2a30db5 100644 --- a/lustre/ptlrpc/llog_client.c +++ b/lustre/ptlrpc/llog_client.c @@ -42,11 +42,7 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifdef __KERNEL__ #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/llog_net.c b/lustre/ptlrpc/llog_net.c index abb99ce..2b09b8d 100644 --- a/lustre/ptlrpc/llog_net.c +++ b/lustre/ptlrpc/llog_net.c @@ -46,11 +46,7 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifdef __KERNEL__ #include -#else -#include -#endif #include #include diff --git a/lustre/ptlrpc/llog_server.c b/lustre/ptlrpc/llog_server.c index b4d81c3..1371aa7 100644 --- a/lustre/ptlrpc/llog_server.c +++ b/lustre/ptlrpc/llog_server.c @@ -42,16 +42,11 @@ #define DEBUG_SUBSYSTEM S_LOG -#ifndef __KERNEL__ -#include -#endif - #include #include #include #include -#if defined(__KERNEL__) && defined(LUSTRE_LOG_SERVER) static int llog_origin_close(const struct lu_env *env, struct llog_handle *lgh) { if (lgh->lgh_hdr != NULL && lgh->lgh_hdr->llh_flags & LLOG_F_IS_CAT) @@ -350,38 +345,3 @@ int llog_origin_handle_close(struct ptlrpc_request *req) RETURN(0); } EXPORT_SYMBOL(llog_origin_handle_close); - -#else /* !__KERNEL__ */ -int llog_origin_handle_open(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} - -int llog_origin_handle_destroy(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} - -int llog_origin_handle_next_block(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_prev_block(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_read_header(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -int llog_origin_handle_close(struct ptlrpc_request *req) -{ - LBUG(); - return 0; -} -#endif diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c index ce9f1df..2ce646b 100644 --- a/lustre/ptlrpc/lproc_ptlrpc.c +++ b/lustre/ptlrpc/lproc_ptlrpc.c @@ -35,9 +35,6 @@ */ #define DEBUG_SUBSYSTEM S_CLASS -#ifndef __KERNEL__ -# include -#endif #include #include diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index c1b99c9..dedb574 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -35,9 +35,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#endif #include #include #include @@ -458,12 +455,10 @@ int ptlrpc_unregister_bulk(struct ptlrpc_request *req, int async) RETURN(0); for (;;) { -#ifdef __KERNEL__ /* The wq argument is ignored by user-space wait_event macros */ wait_queue_head_t *wq = (req->rq_set != NULL) ? &req->rq_set->set_waitq : &req->rq_reply_waitq; -#endif /* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ lwi = LWI_TIMEOUT_INTERVAL(cfs_time_seconds(LONG_UNLINK), diff --git a/lustre/ptlrpc/nrs.c b/lustre/ptlrpc/nrs.c index a2df45d..3164f5b 100644 --- a/lustre/ptlrpc/nrs.c +++ b/lustre/ptlrpc/nrs.c @@ -40,9 +40,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#endif #include #include #include @@ -1762,14 +1759,14 @@ out: /* ptlrpc/nrs_fifo.c */ extern struct ptlrpc_nrs_pol_conf nrs_conf_fifo; -#if defined HAVE_SERVER_SUPPORT && defined(__KERNEL__) +#ifdef HAVE_SERVER_SUPPORT /* ptlrpc/nrs_crr.c */ extern struct ptlrpc_nrs_pol_conf nrs_conf_crrn; /* ptlrpc/nrs_orr.c */ extern struct ptlrpc_nrs_pol_conf nrs_conf_orr; extern struct ptlrpc_nrs_pol_conf nrs_conf_trr; extern struct ptlrpc_nrs_pol_conf nrs_conf_tbf; -#endif +#endif /* HAVE_SERVER_SUPPORT */ /** * Adds all policies that ship with the ptlrpc module, to NRS core's list of @@ -1790,7 +1787,7 @@ int ptlrpc_nrs_init(void) if (rc != 0) GOTO(fail, rc); -#if defined HAVE_SERVER_SUPPORT && defined(__KERNEL__) +#ifdef HAVE_SERVER_SUPPORT rc = ptlrpc_nrs_policy_register(&nrs_conf_crrn); if (rc != 0) GOTO(fail, rc); @@ -1805,7 +1802,7 @@ int ptlrpc_nrs_init(void) rc = ptlrpc_nrs_policy_register(&nrs_conf_tbf); if (rc != 0) GOTO(fail, rc); -#endif +#endif /* HAVE_SERVER_SUPPORT */ RETURN(rc); fail: diff --git a/lustre/ptlrpc/nrs_crr.c b/lustre/ptlrpc/nrs_crr.c index 1d3259d..bf16216 100644 --- a/lustre/ptlrpc/nrs_crr.c +++ b/lustre/ptlrpc/nrs_crr.c @@ -41,9 +41,6 @@ #ifdef HAVE_SERVER_SUPPORT #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#endif #include #include #include diff --git a/lustre/ptlrpc/nrs_fifo.c b/lustre/ptlrpc/nrs_fifo.c index f407866..6b156da 100644 --- a/lustre/ptlrpc/nrs_fifo.c +++ b/lustre/ptlrpc/nrs_fifo.c @@ -47,9 +47,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#endif #include #include #include diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c index 63c7b38..3cad160 100644 --- a/lustre/ptlrpc/nrs_tbf.c +++ b/lustre/ptlrpc/nrs_tbf.c @@ -38,9 +38,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#endif #include #include #include diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 0383616..82cebfd 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -43,9 +43,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#endif #include diff --git a/lustre/ptlrpc/pers.c b/lustre/ptlrpc/pers.c index 97b7bf4..4606bdf 100644 --- a/lustre/ptlrpc/pers.c +++ b/lustre/ptlrpc/pers.c @@ -33,11 +33,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#include -#include -#endif #include #include @@ -47,7 +42,6 @@ #include "ptlrpc_internal.h" -#ifdef __KERNEL__ void ptlrpc_fill_bulk_md(lnet_md_t *md, struct ptlrpc_bulk_desc *desc, int mdidx) @@ -80,53 +74,3 @@ void ptlrpc_add_bulk_page(struct ptlrpc_bulk_desc *desc, struct page *page, desc->bd_iov_count++; } -#else /* !__KERNEL__ */ - -void ptlrpc_fill_bulk_md(lnet_md_t *md, struct ptlrpc_bulk_desc *desc, - int mdidx) -{ - LASSERT(mdidx < desc->bd_md_max_brw); - LASSERT(desc->bd_iov_count > mdidx * LNET_MAX_IOV); - LASSERT(!(md->options & (LNET_MD_IOVEC | LNET_MD_KIOV | LNET_MD_PHYS))); - - if (desc->bd_iov_count == 1) { - md->start = desc->bd_iov[0].iov_base; - md->length = desc->bd_iov[0].iov_len; - return; - } - - md->options |= LNET_MD_IOVEC; - md->start = &desc->bd_iov[mdidx * LNET_MAX_IOV]; - md->length = min(LNET_MAX_IOV, desc->bd_iov_count - mdidx * - LNET_MAX_IOV); -} - -static int can_merge_iovs(lnet_md_iovec_t *existing, lnet_md_iovec_t *candidate) -{ - if (existing->iov_base + existing->iov_len == candidate->iov_base) - return 1; -#if 0 - /* Enable this section to provide earlier evidence of fragmented bulk */ - CERROR("Can't merge iovs %p for %x, %p for %x\n", - existing->iov_base, existing->iov_len, - candidate->iov_base, candidate->iov_len); -#endif - return 0; -} - -void ptlrpc_add_bulk_page(struct ptlrpc_bulk_desc *desc, struct page *page, - int pageoffset, int len) -{ - lnet_md_iovec_t *iov = &desc->bd_iov[desc->bd_iov_count]; - - iov->iov_base = page->addr + pageoffset; - iov->iov_len = len; - - if (desc->bd_iov_count > 0 && can_merge_iovs(iov - 1, iov)) { - (iov - 1)->iov_len += len; - } else { - desc->bd_iov_count++; - } -} - -#endif /* !__KERNEL__ */ diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index 59bf8eb..6cf7d66 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -38,11 +38,7 @@ * Portal-RPC reconnection and replay operations, for use in recovery. */ -#ifndef __KERNEL__ -#include -#else #define DEBUG_SUBSYSTEM S_RPC -#endif #include #include @@ -169,7 +165,6 @@ cfs_duration_t pinger_check_timeout(cfs_time_t time) cfs_time_current()); } -#ifdef __KERNEL__ static bool ir_up; @@ -716,299 +711,3 @@ void ping_evictor_stop(void) wake_up(&pet_waitq); } EXPORT_SYMBOL(ping_evictor_stop); -#else /* !__KERNEL__ */ - -/* XXX - * the current implementation of pinger in liblustre is not optimized - */ - -#ifdef ENABLE_PINGER -static struct pinger_data { - int pd_recursion; - cfs_time_t pd_this_ping; /* jiffies */ - cfs_time_t pd_next_ping; /* jiffies */ - struct ptlrpc_request_set *pd_set; -} pinger_args; - -static int pinger_check_rpcs(void *arg) -{ - cfs_time_t curtime = cfs_time_current(); - struct ptlrpc_request *req; - struct ptlrpc_request_set *set; - struct list_head *iter; - struct obd_import *imp; - struct pinger_data *pd = &pinger_args; - int rc; - - /* prevent recursion */ - if (pd->pd_recursion++) { - CDEBUG(D_HA, "pinger: recursion! quit\n"); - LASSERT(pd->pd_set); - pd->pd_recursion--; - return 0; - } - - /* have we reached ping point? */ - if (!pd->pd_set && cfs_time_before(curtime, pd->pd_next_ping)) { - pd->pd_recursion--; - return 0; - } - - /* if we have rpc_set already, continue processing it */ - if (pd->pd_set) { - LASSERT(pd->pd_this_ping); - set = pd->pd_set; - goto do_check_set; - } - - pd->pd_this_ping = curtime; - pd->pd_set = ptlrpc_prep_set(); - if (pd->pd_set == NULL) - goto out; - set = pd->pd_set; - - /* add rpcs into set */ - mutex_lock(&pinger_mutex); - list_for_each(iter, &pinger_imports) { - struct obd_import *imp = list_entry(iter, struct obd_import, - imp_pinger_chain); - int generation, level; - - if (cfs_time_aftereq(pd->pd_this_ping, - imp->imp_next_ping - 5 * CFS_TICK)) { - /* Add a ping. */ - spin_lock(&imp->imp_lock); - generation = imp->imp_generation; - level = imp->imp_state; - spin_unlock(&imp->imp_lock); - - if (level != LUSTRE_IMP_FULL) { - CDEBUG(D_HA, - "not pinging %s (in recovery)\n", - obd2cli_tgt(imp->imp_obd)); - continue; - } - - req = ptlrpc_request_alloc_pack(imp, &RQF_OBD_PING, - LUSTRE_OBD_VERSION, - OBD_PING); - if (req == NULL) { - CERROR("OOM trying to ping %s->%s\n", - imp->imp_obd->obd_uuid.uuid, - obd2cli_tgt(imp->imp_obd)); - break; - } - - req->rq_no_resend = 1; - ptlrpc_request_set_replen(req); - req->rq_send_state = LUSTRE_IMP_FULL; - ptlrpc_rqphase_move(req, RQ_PHASE_RPC); - req->rq_import_generation = generation; - ptlrpc_set_add_req(set, req); - } else { - CDEBUG(D_INFO, "don't need to ping %s ("CFS_TIME_T - " > "CFS_TIME_T")\n", obd2cli_tgt(imp->imp_obd), - imp->imp_next_ping, pd->pd_this_ping); - } - } - pd->pd_this_ping = curtime; - mutex_unlock(&pinger_mutex); - - /* Might be empty, that's OK. */ - if (atomic_read(&set->set_remaining) == 0) - CDEBUG(D_RPCTRACE, "nothing to ping\n"); - - list_for_each(iter, &set->set_requests) { - struct ptlrpc_request *req = - list_entry(iter, struct ptlrpc_request, - rq_set_chain); - DEBUG_REQ(D_RPCTRACE, req, "pinging %s->%s", - req->rq_import->imp_obd->obd_uuid.uuid, - obd2cli_tgt(req->rq_import->imp_obd)); - (void)ptl_send_rpc(req, 0); - } - -do_check_set: - rc = ptlrpc_check_set(NULL, set); - - /* not finished, and we are not expired, simply return */ - if (!rc && cfs_time_before(curtime, cfs_time_add(pd->pd_this_ping, - cfs_time_seconds(PING_INTERVAL)))) { - CDEBUG(D_RPCTRACE, "not finished, but also not expired\n"); - pd->pd_recursion--; - return 0; - } - - /* Expire all the requests that didn't come back. */ - mutex_lock(&pinger_mutex); - list_for_each(iter, &set->set_requests) { - req = list_entry(iter, struct ptlrpc_request, - rq_set_chain); - - if (req->rq_phase == RQ_PHASE_COMPLETE) - continue; - - CDEBUG(D_RPCTRACE, "Pinger initiate expire request(%p)\n", - req); - - /* This will also unregister reply. */ - ptlrpc_expire_one_request(req, 0); - - /* We're done with this req, let's finally move it to complete - * phase and take care of inflights. */ - ptlrpc_rqphase_move(req, RQ_PHASE_COMPLETE); - imp = req->rq_import; - spin_lock(&imp->imp_lock); - if (!list_empty(&req->rq_list)) { - list_del_init(&req->rq_list); - atomic_dec(&imp->imp_inflight); - } - spin_unlock(&imp->imp_lock); - atomic_dec(&set->set_remaining); - } - mutex_unlock(&pinger_mutex); - - ptlrpc_set_destroy(set); - pd->pd_set = NULL; - -out: - pd->pd_next_ping = cfs_time_add(pd->pd_this_ping, - cfs_time_seconds(PING_INTERVAL)); - pd->pd_this_ping = 0; /* XXX for debug */ - - CDEBUG(D_INFO, "finished a round ping\n"); - pd->pd_recursion--; - return 0; -} - -static void *pinger_callback = NULL; -#endif /* ENABLE_PINGER */ - -int ptlrpc_start_pinger(void) -{ -#ifdef ENABLE_PINGER - memset(&pinger_args, 0, sizeof(pinger_args)); - pinger_callback = liblustre_register_wait_callback("pinger_check_rpcs", - &pinger_check_rpcs, - &pinger_args); -#endif - return 0; -} - -int ptlrpc_stop_pinger(void) -{ -#ifdef ENABLE_PINGER - if (pinger_callback) - liblustre_deregister_wait_callback(pinger_callback); -#endif - return 0; -} - -void ptlrpc_pinger_sending_on_import(struct obd_import *imp) -{ -#ifdef ENABLE_PINGER - mutex_lock(&pinger_mutex); - ptlrpc_update_next_ping(imp, 0); - if (pinger_args.pd_set == NULL && - cfs_time_before(imp->imp_next_ping, pinger_args.pd_next_ping)) { - CDEBUG(D_HA, "set next ping to "CFS_TIME_T"(cur "CFS_TIME_T")\n", - imp->imp_next_ping, cfs_time_current()); - pinger_args.pd_next_ping = imp->imp_next_ping; - } - mutex_unlock(&pinger_mutex); -#endif -} - -void ptlrpc_pinger_commit_expected(struct obd_import *imp) -{ -#ifdef ENABLE_PINGER - mutex_lock(&pinger_mutex); - ptlrpc_update_next_ping(imp, 1); - if (pinger_args.pd_set == NULL && - cfs_time_before(imp->imp_next_ping, pinger_args.pd_next_ping)) { - CDEBUG(D_HA,"set next ping to "CFS_TIME_T"(cur "CFS_TIME_T")\n", - imp->imp_next_ping, cfs_time_current()); - pinger_args.pd_next_ping = imp->imp_next_ping; - } - mutex_unlock(&pinger_mutex); -#endif -} - -int ptlrpc_add_timeout_client(int time, enum timeout_event event, - timeout_cb_t cb, void *data, - struct list_head *obd_list) -{ - return 0; -} - -int ptlrpc_del_timeout_client(struct list_head *obd_list, - enum timeout_event event) -{ - return 0; -} - -int ptlrpc_pinger_add_import(struct obd_import *imp) -{ - ENTRY; - - if (!list_empty(&imp->imp_pinger_chain)) - RETURN(-EALREADY); - - CDEBUG(D_HA, "adding pingable import %s->%s\n", - imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd)); - ptlrpc_pinger_sending_on_import(imp); - - mutex_lock(&pinger_mutex); - list_add_tail(&imp->imp_pinger_chain, &pinger_imports); - class_import_get(imp); - mutex_unlock(&pinger_mutex); - - RETURN(0); -} - -int ptlrpc_pinger_del_import(struct obd_import *imp) -{ - ENTRY; - - if (list_empty(&imp->imp_pinger_chain)) - RETURN(-ENOENT); - - mutex_lock(&pinger_mutex); - list_del_init(&imp->imp_pinger_chain); - CDEBUG(D_HA, "removing pingable import %s->%s\n", - imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd)); - class_import_put(imp); - mutex_unlock(&pinger_mutex); - RETURN(0); -} - -void ptlrpc_pinger_wake_up() -{ -#ifdef ENABLE_PINGER - /* XXX force pinger to run, if needed */ - struct obd_import *imp; - ENTRY; - list_for_each_entry(imp, &pinger_imports, imp_pinger_chain) { - CDEBUG(D_RPCTRACE, "checking import %s->%s\n", - imp->imp_obd->obd_uuid.uuid, obd2cli_tgt(imp->imp_obd)); -#ifdef ENABLE_LIBLUSTRE_RECOVERY - if (imp->imp_state == LUSTRE_IMP_DISCON && - !imp_is_deactive(imp)) -#else - /*XXX only recover for the initial connection */ - if (!lustre_handle_is_used(&imp->imp_remote_handle) && - imp->imp_state == LUSTRE_IMP_DISCON && - !imp_is_deactive(imp)) -#endif - ptlrpc_initiate_recovery(imp); - else if (imp->imp_state != LUSTRE_IMP_FULL) - CDEBUG(D_HA, "Refused to recover import %s->%s " - "state %d, deactive %d\n", - imp->imp_obd->obd_uuid.uuid, - obd2cli_tgt(imp->imp_obd), imp->imp_state, - imp_is_deactive(imp)); - } - EXIT; -#endif -} -#endif /* !__KERNEL__ */ diff --git a/lustre/ptlrpc/ptlrpc_internal.h b/lustre/ptlrpc/ptlrpc_internal.h index 9d8bd46..76382c9 100644 --- a/lustre/ptlrpc/ptlrpc_internal.h +++ b/lustre/ptlrpc/ptlrpc_internal.h @@ -247,11 +247,7 @@ void ptlrpc_pinger_sending_on_import(struct obd_import *imp); void ptlrpc_pinger_commit_expected(struct obd_import *imp); void ptlrpc_pinger_wake_up(void); void ptlrpc_ping_import_soon(struct obd_import *imp); -#ifdef __KERNEL__ int ping_evictor_wake(struct obd_export *exp); -#else -#define ping_evictor_wake(exp) 1 -#endif /* sec_null.c */ int sptlrpc_null_init(void); @@ -297,10 +293,10 @@ static inline int ll_rpc_recoverable_error(int rc) return (rc == -ENOTCONN || rc == -ENODEV); } -#if defined HAVE_SERVER_SUPPORT && defined(__KERNEL__) +#ifdef HAVE_SERVER_SUPPORT int tgt_mod_init(void); void tgt_mod_exit(void); -#else +#else /* HAVE_SERVER_SUPPORT */ static inline int tgt_mod_init(void) { return 0; @@ -310,7 +306,7 @@ static inline void tgt_mod_exit(void) { return; } -#endif +#endif /* !HAVE_SERVER_SUPPORT */ static inline void ptlrpc_reqset_put(struct ptlrpc_request_set *set) { diff --git a/lustre/ptlrpc/ptlrpc_module.c b/lustre/ptlrpc/ptlrpc_module.c index 8a9250d..7931e5d 100644 --- a/lustre/ptlrpc/ptlrpc_module.c +++ b/lustre/ptlrpc/ptlrpc_module.c @@ -36,9 +36,6 @@ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#endif #include #include @@ -134,7 +131,6 @@ err_layout: return rc; } -#ifdef __KERNEL__ static void __exit ptlrpc_exit(void) { ptlrpc_nrs_fini(); @@ -154,4 +150,3 @@ MODULE_DESCRIPTION("Lustre Request Processor and Lock Management"); MODULE_LICENSE("GPL"); cfs_module(ptlrpc, "1.0.0", ptlrpc_init, ptlrpc_exit); -#endif diff --git a/lustre/ptlrpc/ptlrpcd.c b/lustre/ptlrpc/ptlrpcd.c index a58f510..8f7fa9d 100644 --- a/lustre/ptlrpc/ptlrpcd.c +++ b/lustre/ptlrpc/ptlrpcd.c @@ -55,16 +55,9 @@ #define DEBUG_SUBSYSTEM S_RPC -#ifdef __KERNEL__ -# include -#else /* __KERNEL__ */ -# include -# include -#endif - +#include #include -# include - +#include #include #include /* for obd_zombie */ #include /* for OBD_FAIL_CHECK */ @@ -81,7 +74,6 @@ struct ptlrpcd { struct ptlrpcd_ctl pd_threads[0]; }; -#ifdef __KERNEL__ static int max_ptlrpcds; CFS_MODULE_PARM(max_ptlrpcds, "i", int, 0644, "Max ptlrpcd thread count to be started."); @@ -89,7 +81,6 @@ CFS_MODULE_PARM(max_ptlrpcds, "i", int, 0644, static int ptlrpcd_bind_policy = PDB_POLICY_PAIR; CFS_MODULE_PARM(ptlrpcd_bind_policy, "i", int, 0644, "Ptlrpcd threads binding mode."); -#endif static struct ptlrpcd *ptlrpcds; struct mutex ptlrpcd_mutex; @@ -113,7 +104,6 @@ ptlrpcd_select_pc(struct ptlrpc_request *req, pdl_policy_t policy, int index) if (req != NULL && req->rq_send_state != LUSTRE_IMP_FULL) return &ptlrpcds->pd_thread_rcv; -#ifdef __KERNEL__ switch (policy) { case PDL_POLICY_SAME: idx = smp_processor_id() % ptlrpcds->pd_nthreads; @@ -144,7 +134,6 @@ ptlrpcd_select_pc(struct ptlrpc_request *req, pdl_policy_t policy, int index) ptlrpcds->pd_index = idx; break; } -#endif /* __KERNEL__ */ return &ptlrpcds->pd_threads[idx]; } @@ -156,14 +145,12 @@ ptlrpcd_select_pc(struct ptlrpc_request *req, pdl_policy_t policy, int index) void ptlrpcd_add_rqset(struct ptlrpc_request_set *set) { struct list_head *tmp, *pos; -#ifdef __KERNEL__ struct ptlrpcd_ctl *pc; struct ptlrpc_request_set *new; int count, i; pc = ptlrpcd_select_pc(NULL, PDL_POLICY_LOCAL, -1); new = pc->pc_set; -#endif list_for_each_safe(pos, tmp, &set->set_requests) { struct ptlrpc_request *req = @@ -171,18 +158,10 @@ void ptlrpcd_add_rqset(struct ptlrpc_request_set *set) rq_set_chain); LASSERT(req->rq_phase == RQ_PHASE_NEW); -#ifdef __KERNEL__ req->rq_set = new; req->rq_queued_time = cfs_time_current(); -#else - list_del_init(&req->rq_set_chain); - req->rq_set = NULL; - ptlrpcd_add_req(req, PDL_POLICY_LOCAL, -1); - atomic_dec(&set->set_remaining); -#endif } -#ifdef __KERNEL__ spin_lock(&new->set_new_req_lock); list_splice_init(&set->set_requests, &new->set_new_requests); i = atomic_read(&set->set_remaining); @@ -198,11 +177,9 @@ void ptlrpcd_add_rqset(struct ptlrpc_request_set *set) for (i = 0; i < pc->pc_npartners; i++) wake_up(&pc->pc_partners[i]->pc_set->set_waitq); } -#endif } EXPORT_SYMBOL(ptlrpcd_add_rqset); -#ifdef __KERNEL__ /** * Return transferred RPCs count. */ @@ -229,7 +206,6 @@ static int ptlrpcd_steal_rqset(struct ptlrpc_request_set *des, spin_unlock(&src->set_new_req_lock); return rc; } -#endif /** * Requests that are added to the ptlrpcd queue are sent via @@ -353,7 +329,6 @@ static int ptlrpcd_check(struct lu_env *env, struct ptlrpcd_ctl *pc) */ rc = atomic_read(&set->set_new_count); -#ifdef __KERNEL__ /* If we have nothing to do, check whether we can take some * work from our partner threads. */ if (rc == 0 && pc->pc_npartners > 0) { @@ -389,13 +364,11 @@ static int ptlrpcd_check(struct lu_env *env, struct ptlrpcd_ctl *pc) ptlrpc_reqset_put(ps); } while (rc == 0 && pc->pc_cursor != first); } -#endif } RETURN(rc); } -#ifdef __KERNEL__ /** * Main ptlrpcd thread. * ptlrpc's code paths like to execute in process context, so we have this @@ -630,52 +603,6 @@ static int ptlrpcd_bind(int index, int max) RETURN(rc); } -#else /* !__KERNEL__ */ - -/** - * In liblustre we do not have separate threads, so this function - * is called from time to time all across common code to see - * if something needs to be processed on ptlrpcd set. - */ -int ptlrpcd_check_async_rpcs(void *arg) -{ - struct ptlrpcd_ctl *pc = arg; - int rc = 0; - - /* - * Single threaded!! - */ - pc->pc_recurred++; - - if (pc->pc_recurred == 1) { - rc = lu_env_refill(&pc->pc_env); - if (rc == 0) { - lu_context_enter(&pc->pc_env.le_ctx); - rc = ptlrpcd_check(&pc->pc_env, pc); - if (!rc) - ptlrpc_expired_set(pc->pc_set); - /* - * XXX: send replay requests. - */ - if (test_bit(LIOD_RECOVERY, &pc->pc_flags)) - rc = ptlrpcd_check(&pc->pc_env, pc); - lu_context_exit(&pc->pc_env.le_ctx); - } - } - - pc->pc_recurred--; - return rc; -} - -int ptlrpcd_idle(void *arg) -{ - struct ptlrpcd_ctl *pc = arg; - - return (atomic_read(&pc->pc_set->set_new_count) == 0 && - atomic_read(&pc->pc_set->set_remaining) == 0); -} - -#endif int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) { @@ -700,15 +627,6 @@ int ptlrpcd_start(int index, int max, const char *name, struct ptlrpcd_ctl *pc) if (pc->pc_set == NULL) GOTO(out, rc = -ENOMEM); -#ifndef __KERNEL__ - pc->pc_wait_callback = - liblustre_register_wait_callback("ptlrpcd_check_async_rpcs", - &ptlrpcd_check_async_rpcs, pc); - pc->pc_idle_callback = - liblustre_register_idle_callback("ptlrpcd_check_idle_rpcs", - &ptlrpcd_idle, pc); - RETURN(0); -#else /* * So far only "client" ptlrpcd uses an environment. In the future, * ptlrpcd thread (or a thread-set) has to be given an argument, @@ -747,7 +665,6 @@ out_set: ptlrpc_set_destroy(set); } clear_bit(LIOD_BIND, &pc->pc_flags); -#endif out: clear_bit(LIOD_START, &pc->pc_flags); RETURN(rc); @@ -781,12 +698,7 @@ void ptlrpcd_free(struct ptlrpcd_ctl *pc) goto out; } -#ifdef __KERNEL__ wait_for_completion(&pc->pc_finishing); -#else - liblustre_deregister_wait_callback(pc->pc_wait_callback); - liblustre_deregister_idle_callback(pc->pc_idle_callback); -#endif lu_context_fini(&pc->pc_env.le_ctx); spin_lock(&pc->pc_lock); @@ -800,7 +712,6 @@ void ptlrpcd_free(struct ptlrpcd_ctl *pc) clear_bit(LIOD_BIND, &pc->pc_flags); out: -#ifdef __KERNEL__ if (pc->pc_npartners > 0) { LASSERT(pc->pc_partners != NULL); @@ -809,7 +720,6 @@ out: pc->pc_partners = NULL; } pc->pc_npartners = 0; -#endif EXIT; } @@ -839,7 +749,6 @@ static int ptlrpcd_init(void) int size, i = -1, j, rc = 0; ENTRY; -#ifdef __KERNEL__ if (max_ptlrpcds > 0 && max_ptlrpcds < nthreads) nthreads = max_ptlrpcds; if (nthreads < 2) @@ -848,9 +757,6 @@ static int ptlrpcd_init(void) ptlrpcd_bind_policy = PDB_POLICY_PAIR; else if (nthreads % 2 != 0 && ptlrpcd_bind_policy == PDB_POLICY_PAIR) nthreads &= ~1; /* make sure it is even */ -#else - nthreads = 1; -#endif size = offsetof(struct ptlrpcd, pd_threads[nthreads]); OBD_ALLOC(ptlrpcds, size); diff --git a/lustre/ptlrpc/recover.c b/lustre/ptlrpc/recover.c index 19b131b..70300b0 100644 --- a/lustre/ptlrpc/recover.c +++ b/lustre/ptlrpc/recover.c @@ -39,12 +39,7 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifdef __KERNEL__ -# include -#else -# include -#endif - +#include #include #include #include diff --git a/lustre/ptlrpc/sec.c b/lustre/ptlrpc/sec.c index 0de9228..402167b 100644 --- a/lustre/ptlrpc/sec.c +++ b/lustre/ptlrpc/sec.c @@ -41,13 +41,8 @@ #define DEBUG_SUBSYSTEM S_SEC #include -#ifndef __KERNEL__ -#include -#include -#else #include #include -#endif #include #include @@ -2411,14 +2406,10 @@ int sptlrpc_current_user_desc_size(void) { int ngroups; -#ifdef __KERNEL__ ngroups = current_ngroups; if (ngroups > LUSTRE_MAX_GROUPS) ngroups = LUSTRE_MAX_GROUPS; -#else - ngroups = 0; -#endif return sptlrpc_user_desc_size(ngroups); } EXPORT_SYMBOL(sptlrpc_current_user_desc_size); @@ -2436,14 +2427,12 @@ int sptlrpc_pack_user_desc(struct lustre_msg *msg, int offset) pud->pud_cap = cfs_curproc_cap_pack(); pud->pud_ngroups = (msg->lm_buflens[offset] - sizeof(*pud)) / 4; -#ifdef __KERNEL__ task_lock(current); if (pud->pud_ngroups > current_ngroups) pud->pud_ngroups = current_ngroups; memcpy(pud->pud_groups, current_cred()->group_info->blocks[0], pud->pud_ngroups * sizeof(__u32)); task_unlock(current); -#endif return 0; } diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c index 578715c..1ddc335 100644 --- a/lustre/ptlrpc/sec_bulk.c +++ b/lustre/ptlrpc/sec_bulk.c @@ -57,7 +57,6 @@ * bulk encryption page pools * ****************************************/ -#ifdef __KERNEL__ #define PTRS_PER_PAGE (PAGE_CACHE_SIZE / sizeof(void *)) #define PAGES_PER_POOL (PTRS_PER_PAGE) @@ -812,26 +811,6 @@ void sptlrpc_enc_pool_fini(void) } } -#else /* !__KERNEL__ */ - -int sptlrpc_enc_pool_get_pages(struct ptlrpc_bulk_desc *desc) -{ - return 0; -} - -void sptlrpc_enc_pool_put_pages(struct ptlrpc_bulk_desc *desc) -{ -} - -int sptlrpc_enc_pool_init(void) -{ - return 0; -} - -void sptlrpc_enc_pool_fini(void) -{ -} -#endif static int cfs_hash_alg_id[] = { [BULK_HASH_ALG_NULL] = CFS_HASH_ALG_NULL, @@ -920,14 +899,9 @@ int sptlrpc_get_bulk_checksum(struct ptlrpc_bulk_desc *desc, __u8 alg, hashsize = cfs_crypto_hash_digestsize(cfs_hash_alg_id[alg]); for (i = 0; i < desc->bd_iov_count; i++) { -#ifdef __KERNEL__ cfs_crypto_hash_update_page(hdesc, desc->bd_iov[i].kiov_page, desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK, desc->bd_iov[i].kiov_len); -#else - cfs_crypto_hash_update(hdesc, desc->bd_iov[i].iov_base, - desc->bd_iov[i].iov_len); -#endif } if (hashsize > buflen) { diff --git a/lustre/ptlrpc/sec_config.c b/lustre/ptlrpc/sec_config.c index b18b1f6..58703e0 100644 --- a/lustre/ptlrpc/sec_config.c +++ b/lustre/ptlrpc/sec_config.c @@ -37,13 +37,8 @@ #define DEBUG_SUBSYSTEM S_SEC #include -#ifndef __KERNEL__ -#include -#include -#else #include #include -#endif #include #include @@ -938,7 +933,6 @@ void sptlrpc_conf_client_adapt(struct obd_device *obd) } EXPORT_SYMBOL(sptlrpc_conf_client_adapt); -#ifdef __KERNEL__ static void rule2string(struct sptlrpc_rule *r, char *buf, int buflen) { @@ -1151,7 +1145,6 @@ out_pop: RETURN(rc); } -#endif /* __KRENEL__ */ /** * called by target devices, extract sptlrpc rules which applies to @@ -1188,7 +1181,6 @@ int sptlrpc_conf_target_get_rules(struct obd_device *obd, GOTO(out, rc); } -#ifdef __KERNEL__ if (conf->sc_updated == 0) { /* * always read from local copy. here another option is @@ -1208,7 +1200,6 @@ int sptlrpc_conf_target_get_rules(struct obd_device *obd, else CDEBUG(D_SEC, "unchanged, skip updating local copy\n"); } -#endif /* extract rule set for this target */ conf_tgt = sptlrpc_conf_get_tgt(conf, obd->obd_name, 0); diff --git a/lustre/ptlrpc/sec_ctx.c b/lustre/ptlrpc/sec_ctx.c index 431f4b3..c04020a 100644 --- a/lustre/ptlrpc/sec_ctx.c +++ b/lustre/ptlrpc/sec_ctx.c @@ -20,7 +20,6 @@ * * GPL HEADER END */ -#ifdef __KERNEL__ #define DEBUG_SUBSYSTEM S_FILTER @@ -123,4 +122,3 @@ put_old: dput(dchild_old); RETURN(err); } -#endif /* __KERNEL__ */ diff --git a/lustre/ptlrpc/sec_gc.c b/lustre/ptlrpc/sec_gc.c index c01dce0..af3ee85 100644 --- a/lustre/ptlrpc/sec_gc.c +++ b/lustre/ptlrpc/sec_gc.c @@ -40,11 +40,7 @@ #define DEBUG_SUBSYSTEM S_SEC -#ifndef __KERNEL__ -#include -#else #include -#endif #include #include @@ -53,7 +49,6 @@ #define SEC_GC_INTERVAL (30 * 60) -#ifdef __KERNEL__ static struct mutex sec_gc_mutex; static spinlock_t sec_gc_list_lock; @@ -257,20 +252,3 @@ void sptlrpc_gc_fini(void) thread_is_stopped(&sec_gc_thread), &lwi); } -#else /* !__KERNEL__ */ - -void sptlrpc_gc_add_sec(struct ptlrpc_sec *sec) -{ -} -void sptlrpc_gc_del_sec(struct ptlrpc_sec *sec) -{ -} -int sptlrpc_gc_init(void) -{ - return 0; -} -void sptlrpc_gc_fini(void) -{ -} - -#endif /* __KERNEL__ */ diff --git a/lustre/ptlrpc/sec_lproc.c b/lustre/ptlrpc/sec_lproc.c index 8260de5..9416f28 100644 --- a/lustre/ptlrpc/sec_lproc.c +++ b/lustre/ptlrpc/sec_lproc.c @@ -39,12 +39,7 @@ #define DEBUG_SUBSYSTEM S_SEC #include -#ifndef __KERNEL__ -#include -#include -#else #include -#endif #include #include @@ -56,7 +51,6 @@ #include "ptlrpc_internal.h" -#ifdef __KERNEL__ struct proc_dir_entry *sptlrpc_proc_root = NULL; EXPORT_SYMBOL(sptlrpc_proc_root); @@ -205,20 +199,3 @@ void sptlrpc_lproc_fini(void) } } -#else /* !__KERNEL__ */ - -int sptlrpc_lprocfs_cliobd_attach(struct obd_device *dev) -{ - return 0; -} - -int sptlrpc_lproc_init(void) -{ - return 0; -} - -void sptlrpc_lproc_fini(void) -{ -} - -#endif diff --git a/lustre/ptlrpc/sec_null.c b/lustre/ptlrpc/sec_null.c index 958fecd..ee9a093 100644 --- a/lustre/ptlrpc/sec_null.c +++ b/lustre/ptlrpc/sec_null.c @@ -40,9 +40,6 @@ #define DEBUG_SUBSYSTEM S_SEC -#ifndef __KERNEL__ -#include -#endif #include #include diff --git a/lustre/ptlrpc/sec_plain.c b/lustre/ptlrpc/sec_plain.c index b57f28a..4ed546a 100644 --- a/lustre/ptlrpc/sec_plain.c +++ b/lustre/ptlrpc/sec_plain.c @@ -40,9 +40,6 @@ #define DEBUG_SUBSYSTEM S_SEC -#ifndef __KERNEL__ -#include -#endif #include #include @@ -155,7 +152,6 @@ static int plain_verify_bulk_csum(struct ptlrpc_bulk_desc *desc, return 0; } -#ifdef __KERNEL__ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc) { char *ptr; @@ -172,20 +168,6 @@ static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc) return; } } -#else -static void corrupt_bulk_data(struct ptlrpc_bulk_desc *desc) -{ - unsigned int i; - - for (i = 0; i < desc->bd_iov_count; i++) { - if (desc->bd_iov[i].iov_len == 0) - continue; - - ((char *)desc->bd_iov[i].iov_base)[i] ^= 0x1; - return; - } -} -#endif /* __KERNEL__ */ /**************************************** * cli_ctx apis * @@ -355,9 +337,7 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, struct ptlrpc_bulk_sec_desc *bsdv; struct plain_bulk_token *tokenv; int rc; -#ifdef __KERNEL__ int i, nob; -#endif LASSERT(req->rq_pack_bulk); LASSERT(req->rq_reqbuf->lm_bufcount == PLAIN_PACK_SEGMENTS); @@ -372,7 +352,6 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, return 0; } -#ifdef __KERNEL__ /* fix the actual data size */ for (i = 0, nob = 0; i < desc->bd_iov_count; i++) { if (desc->bd_iov[i].kiov_len + nob > desc->bd_nob_transferred) { @@ -381,7 +360,6 @@ int plain_cli_unwrap_bulk(struct ptlrpc_cli_ctx *ctx, } nob += desc->bd_iov[i].kiov_len; } -#endif rc = plain_verify_bulk_csum(desc, req->rq_flvr.u_bulk.hash.hash_alg, tokenv); diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index b7918e1..71e4804 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -35,9 +35,6 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -#include -#endif #include #include #include @@ -204,7 +201,6 @@ ptlrpc_save_lock(struct ptlrpc_request *req, } EXPORT_SYMBOL(ptlrpc_save_lock); -#ifdef __KERNEL__ struct ptlrpc_hr_partition; @@ -365,14 +361,6 @@ static void rs_batch_fini(struct rs_batch *b) #define DECLARE_RS_BATCH(b) struct rs_batch b -#else /* __KERNEL__ */ - -#define rs_batch_init(b) do{}while(0) -#define rs_batch_fini(b) do{}while(0) -#define rs_batch_add(b, r) ptlrpc_schedule_difficult_reply(r) -#define DECLARE_RS_BATCH(b) - -#endif /* __KERNEL__ */ /** * Put reply state into a queue for processing because we received @@ -380,7 +368,6 @@ static void rs_batch_fini(struct rs_batch *b) */ void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs) { -#ifdef __KERNEL__ struct ptlrpc_hr_thread *hrt; ENTRY; @@ -394,9 +381,6 @@ void ptlrpc_dispatch_difficult_reply(struct ptlrpc_reply_state *rs) wake_up(&hrt->hrt_waitq); EXIT; -#else - list_add_tail(&rs->rs_list, &rs->rs_svcpt->scp_rep_queue); -#endif } void @@ -511,7 +495,6 @@ static void ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, struct ptlrpc_service_conf *conf) { -#ifdef __KERNEL__ struct ptlrpc_service_thr_conf *tc = &conf->psc_thr; unsigned init; unsigned total; @@ -608,7 +591,6 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, svc->srv_name, nthrs * svc->srv_ncpts, tc->tc_nthrs_max); } -#endif } /** @@ -642,9 +624,6 @@ ptlrpc_service_part_init(struct ptlrpc_service *svc, /* reply states */ spin_lock_init(&svcpt->scp_rep_lock); INIT_LIST_HEAD(&svcpt->scp_rep_active); -#ifndef __KERNEL__ - INIT_LIST_HEAD(&svcpt->scp_rep_queue); -#endif INIT_LIST_HEAD(&svcpt->scp_rep_idle); init_waitqueue_head(&svcpt->scp_rep_waitq); atomic_set(&svcpt->scp_nreps_difficult, 0); @@ -837,14 +816,12 @@ ptlrpc_register_service(struct ptlrpc_service_conf *conf, CDEBUG(D_NET, "%s: Started, listening on portal %d\n", service->srv_name, service->srv_req_portal); -#ifdef __KERNEL__ rc = ptlrpc_start_threads(service); if (rc != 0) { CERROR("Failed to start threads for service %s: %d\n", service->srv_name, rc); GOTO(failed, rc); } -#endif RETURN(service); failed: @@ -1749,10 +1726,6 @@ static bool ptlrpc_server_allow_normal(struct ptlrpc_service_part *svcpt, bool force) { int running = svcpt->scp_nthrs_running; -#ifndef __KERNEL__ - if (1) /* always allow to handle normal request for liblustre */ - return true; -#endif if (unlikely(svcpt->scp_service->srv_req_portal == MDS_REQUEST_PORTAL && CFS_FAIL_PRECHECK(OBD_FAIL_PTLRPC_CANCEL_RESEND))) { /* leave just 1 thread for normal RPCs */ @@ -1810,13 +1783,6 @@ ptlrpc_server_request_get(struct ptlrpc_service_part *svcpt, bool force) ENTRY; spin_lock(&svcpt->scp_req_lock); -#ifndef __KERNEL__ - /* !@%$# liblustre only has 1 thread */ - if (atomic_read(&svcpt->scp_nreps_difficult) != 0) { - spin_unlock(&svcpt->scp_req_lock); - RETURN(NULL); - } -#endif if (ptlrpc_server_high_pending(svcpt, force)) { req = ptlrpc_nrs_req_get_nolock(svcpt, true, force); @@ -2270,81 +2236,6 @@ ptlrpc_handle_rs(struct ptlrpc_reply_state *rs) RETURN(1); } -#ifndef __KERNEL__ - -/** - * Check whether given service has a reply available for processing - * and process it. - * - * \param svc a ptlrpc service - * \retval 0 no replies processed - * \retval 1 one reply processed - */ -static int -ptlrpc_server_handle_reply(struct ptlrpc_service_part *svcpt) -{ - struct ptlrpc_reply_state *rs = NULL; - ENTRY; - - spin_lock(&svcpt->scp_rep_lock); - if (!list_empty(&svcpt->scp_rep_queue)) { - rs = list_entry(svcpt->scp_rep_queue.prev, - struct ptlrpc_reply_state, - rs_list); - list_del_init(&rs->rs_list); - } - spin_unlock(&svcpt->scp_rep_lock); - if (rs != NULL) - ptlrpc_handle_rs(rs); - RETURN(rs != NULL); -} - -/* FIXME make use of timeout later */ -int -liblustre_check_services (void *arg) -{ - int did_something = 0; - int rc; - struct list_head *tmp, *nxt; - ENTRY; - - /* I'm relying on being single threaded, not to have to lock - * ptlrpc_all_services etc */ - list_for_each_safe(tmp, nxt, &ptlrpc_all_services) { - struct ptlrpc_service *svc = - list_entry(tmp, struct ptlrpc_service, srv_list); - struct ptlrpc_service_part *svcpt; - - LASSERT(svc->srv_ncpts == 1); - svcpt = svc->srv_parts[0]; - - if (svcpt->scp_nthrs_running != 0) /* I've recursed */ - continue; - - /* service threads can block for bulk, so this limits us - * (arbitrarily) to recursing 1 stack frame per service. - * Note that the problem with recursion is that we have to - * unwind completely before our caller can resume. */ - - svcpt->scp_nthrs_running++; - - do { - rc = ptlrpc_server_handle_req_in(svcpt, NULL); - rc |= ptlrpc_server_handle_reply(svcpt); - rc |= ptlrpc_at_check_timed(svcpt); - rc |= ptlrpc_server_handle_request(svcpt, NULL); - rc |= (ptlrpc_server_post_idle_rqbds(svcpt) > 0); - did_something |= rc; - } while (rc); - - svcpt->scp_nthrs_running--; - } - - RETURN(did_something); -} -#define ptlrpc_stop_all_threads(s) do {} while (0) - -#else /* __KERNEL__ */ static void ptlrpc_check_rqbd_pool(struct ptlrpc_service_part *svcpt) @@ -2479,9 +2370,7 @@ static int ptlrpc_main(void *arg) struct ptlrpc_service_part *svcpt = thread->t_svcpt; struct ptlrpc_service *svc = svcpt->scp_service; struct ptlrpc_reply_state *rs; -#ifdef WITH_GROUP_INFO struct group_info *ginfo = NULL; -#endif struct lu_env *env; int counter = 0, rc = 0; ENTRY; @@ -2498,7 +2387,6 @@ static int ptlrpc_main(void *arg) svc->srv_name, thread->t_name, svcpt->scp_cpt); } -#ifdef WITH_GROUP_INFO ginfo = groups_alloc(0); if (!ginfo) { rc = -ENOMEM; @@ -2507,7 +2395,6 @@ static int ptlrpc_main(void *arg) set_current_groups(ginfo); put_group_info(ginfo); -#endif if (svc->srv_ops.so_thr_init != NULL) { rc = svc->srv_ops.so_thr_init(thread); @@ -3062,7 +2949,6 @@ void ptlrpc_hr_fini(void) ptlrpc_hr.hr_partitions = NULL; } -#endif /* __KERNEL__ */ /** * Wait until all already scheduled replies are processed. diff --git a/lustre/ptlrpc/wirehdr.c b/lustre/ptlrpc/wirehdr.c index fe76629..7649bb4 100644 --- a/lustre/ptlrpc/wirehdr.c +++ b/lustre/ptlrpc/wirehdr.c @@ -35,16 +35,11 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#endif -#ifdef __KERNEL__ -# ifdef CONFIG_FS_POSIX_ACL -# include -# include -# endif -#endif +#ifdef CONFIG_FS_POSIX_ACL +# include +# include +#endif /* CONFIG_FS_POSIX_ACL */ #include #include diff --git a/lustre/ptlrpc/wiretest.c b/lustre/ptlrpc/wiretest.c index 4e3d903..1a70959 100644 --- a/lustre/ptlrpc/wiretest.c +++ b/lustre/ptlrpc/wiretest.c @@ -35,29 +35,23 @@ */ #define DEBUG_SUBSYSTEM S_RPC -#ifndef __KERNEL__ -# include -#endif -#ifdef __KERNEL__ -# ifdef CONFIG_FS_POSIX_ACL -# include -# include -# endif -#endif +#ifdef CONFIG_FS_POSIX_ACL +# include +# include +#endif /* CONFIG_FS_POSIX_ACL */ #include #include #include #include #include - void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux t 2.6.32-358.18.1.el6.lustre.x86_64 #1 SMP Mon Sep 2 15:21:03 CDT 2013 x8 - * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) */ + * running on Linux t 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8 + * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) */ /* Constants... */ diff --git a/lustre/tests/checkfiemap.c b/lustre/tests/checkfiemap.c index b28beb6..cfb6445 100644 --- a/lustre/tests/checkfiemap.c +++ b/lustre/tests/checkfiemap.c @@ -44,10 +44,8 @@ # include #endif -#ifdef __linux__ -# ifndef FS_IOC_FIEMAP -# define FS_IOC_FIEMAP (_IOWR('f', 11, struct fiemap)) -# endif +#ifndef FS_IOC_FIEMAP +# define FS_IOC_FIEMAP (_IOWR('f', 11, struct fiemap)) #endif #define ONEMB 1048576 diff --git a/lustre/utils/mount_utils_ldiskfs.c b/lustre/utils/mount_utils_ldiskfs.c index 6df4e45..0eb2ed8a 100644 --- a/lustre/utils/mount_utils_ldiskfs.c +++ b/lustre/utils/mount_utils_ldiskfs.c @@ -66,7 +66,6 @@ #include #include -#ifdef __linux__ /* libcfs.h is not really needed here, but on SLES10/PPC, fs.h includes idr.h * which requires BITS_PER_LONG to be defined */ #include @@ -74,7 +73,6 @@ #include /* for BLKGETSIZE64 */ #endif #include -#endif #include #include #include diff --git a/lustre/utils/wiretest.c b/lustre/utils/wiretest.c index ba7a1ab..248ccc6 100644 --- a/lustre/utils/wiretest.c +++ b/lustre/utils/wiretest.c @@ -62,8 +62,8 @@ void lustre_assert_wire_constants(void) { /* Wire protocol assertions generated by 'wirecheck' * (make -C lustre/utils newwiretest) - * running on Linux t 2.6.32-358.18.1.el6.lustre.x86_64 #1 SMP Mon Sep 2 15:21:03 CDT 2013 x8 - * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) */ + * running on Linux t 2.6.32-431.5.1.el6.lustre.x86_64 #1 SMP Wed Feb 12 11:01:08 CST 2014 x8 + * with gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) */ /* Constants... */ diff --git a/snmp/lustre-snmp-trap.c b/snmp/lustre-snmp-trap.c index 04b5bb1..2c1a20d 100644 --- a/snmp/lustre-snmp-trap.c +++ b/snmp/lustre-snmp-trap.c @@ -49,9 +49,7 @@ */ #include -#if defined (__linux__) #include -#endif #include #include #include diff --git a/snmp/lustre-snmp-util.c b/snmp/lustre-snmp-util.c index 70d5ecd..5f88c6a 100644 --- a/snmp/lustre-snmp-util.c +++ b/snmp/lustre-snmp-util.c @@ -49,9 +49,7 @@ */ #include -#if defined (__linux__) #include -#endif #include #include #include -- 1.8.3.1