From: liangzhen Date: Wed, 15 Feb 2006 07:42:07 +0000 (+0000) Subject: 1. Cleanup Linux jiffies and using cfs_time_* X-Git-Tag: v1_7_140~1^12~3^2~50 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=d747f7059b146021c5d051c7c9fdbcf4faab7281;p=fs%2Flustre-release.git 1. Cleanup Linux jiffies and using cfs_time_* 2. Cleanup some headers 3. Info.plist for Tiger 4. Fix automake.am for building in Tiger 5. Porting of lctl --- diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4 index aa1b039..b656b49 100644 --- a/lustre/autoconf/lustre-core.m4 +++ b/lustre/autoconf/lustre-core.m4 @@ -541,7 +541,7 @@ AC_DEFUN([LC_CONFIGURE], [LC_CONFIG_OBD_BUFFER_SIZE # include/liblustre.h -AC_CHECK_HEADERS([asm/page.h sys/user.h stdint.h]) +AC_CHECK_HEADERS([asm/page.h sys/user.h sys/vfs.h stdint.h]) # include/lustre/lustre_user.h # See note there re: __ASM_X86_64_PROCESSOR_H diff --git a/lustre/include/darwin/lustre_compat.h b/lustre/include/darwin/lustre_compat.h index 559d2de..d11c8d6 100644 --- a/lustre/include/darwin/lustre_compat.h +++ b/lustre/include/darwin/lustre_compat.h @@ -50,6 +50,9 @@ static inline int32_t ext2_clear_bit(int nr, void *a) return old; } +struct nameidata; + +#if !defined(__DARWIN8__) static inline int ll_path_lookup(const char *path, unsigned int flags, struct nameidata *nd) { int ret = 0; @@ -59,6 +62,7 @@ static inline int ll_path_lookup(const char *path, unsigned int flags, struct na } return ret; } +#endif #define to_kdev_t(dev) (dev) #define kdev_t_to_nr(dev) (dev) @@ -66,6 +70,6 @@ static inline int ll_path_lookup(const char *path, unsigned int flags, struct na #define ext2_test_bit test_bit -#endif /* !__KERNEL__ */ +#endif /* __KERNEL__ */ #endif diff --git a/lustre/include/darwin/lustre_lib.h b/lustre/include/darwin/lustre_lib.h index 605d1e4..5adadae 100644 --- a/lustre/include/darwin/lustre_lib.h +++ b/lustre/include/darwin/lustre_lib.h @@ -55,12 +55,17 @@ struct obd_ioctl_data; #ifdef __KERNEL__ static inline sigset_t l_w_e_set_sigs(sigset_t sigs) { - struct proc *p = current_proc(); - sigset_t old; + sigset_t old = 0; + /* XXX Liang: how to change sigmask in Darwin8.x? + * there is syscall like pthread_sigmask() but we cannot + * use in kernel */ +#if !defined(__DARWIN8__) + struct proc *p = current_proc(); extern int block_procsigmask(struct proc *p, int bit); old = cfs_current()->uu_sigmask; block_procsigmask(p, ~sigs); +#endif return old; } diff --git a/lustre/include/darwin/lustre_net.h b/lustre/include/darwin/lustre_net.h index 4bd448f..f028545 100644 --- a/lustre/include/darwin/lustre_net.h +++ b/lustre/include/darwin/lustre_net.h @@ -28,7 +28,6 @@ #endif #include -#include #undef WITH_GROUP_INFO diff --git a/lustre/include/darwin/lustre_user.h b/lustre/include/darwin/lustre_user.h index 7aad75f..a495e60 100644 --- a/lustre/include/darwin/lustre_user.h +++ b/lustre/include/darwin/lustre_user.h @@ -25,23 +25,14 @@ # include #endif -#if defined(__KERNEL__) typedef struct stat lstat_t; #define HAVE_LOV_USER_MDS_DATA -#endif #ifndef LPU64 -/* x86_64 defines __u64 as "long" in userspace, but "long long" in the kernel */ -#if defined(__x86_64__) && defined(__KERNEL__) -# define LPU64 "%Lu" -# define LPD64 "%Ld" -# define LPX64 "%#Lx" -# define LPSZ "%lu" -# define LPSSZ "%ld" -#elif (BITS_PER_LONG == 32 || __WORDSIZE == 32) -# define LPU64 "%Lu" -# define LPD64 "%Ld" -# define LPX64 "%#Lx" +#if (BITS_PER_LONG == 32 || __WORDSIZE == 32) +# define LPU64 "%llu" +# define LPD64 "%lld" +# define LPX64 "%#llx" # define LPSZ "%u" # define LPSSZ "%d" #elif (BITS_PER_LONG == 64 || __WORDSIZE == 64) diff --git a/lustre/include/darwin/obd_class.h b/lustre/include/darwin/obd_class.h index eef0332..833da61 100644 --- a/lustre/include/darwin/obd_class.h +++ b/lustre/include/darwin/obd_class.h @@ -27,6 +27,8 @@ #error Do not #include this file directly. #include instead #endif -#define to_kdev_t(dev) dev +#if !defined(__KERNEL__) +#define to_kdev_t(dev) (dev) +#endif #endif /* __XNU_OBD_CLASS_H */ diff --git a/lustre/include/darwin/types.h b/lustre/include/darwin/types.h new file mode 100644 index 0000000..548ab38 --- /dev/null +++ b/lustre/include/darwin/types.h @@ -0,0 +1,6 @@ +#ifndef _LUSTRE_DARWIN_TYPES_H +#define _LUSTRE_DARWIN_TYPES_H + +#include + +#endif diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h index 662f702..6187482 100644 --- a/lustre/include/liblustre.h +++ b/lustre/include/liblustre.h @@ -57,7 +57,9 @@ #include #include #include -#include +#ifdef HAVE_SYS_VFS_H +# include +#endif #include #include @@ -821,13 +823,6 @@ typedef struct file_lock { #define QUOTA_OK 0 #define NO_QUOTA 1 -/* proc */ -#define proc_symlink(...) \ -({ \ - void *result = NULL; \ - result; \ -}) - /* ACL */ struct posix_acl_entry { short e_tag; diff --git a/lustre/include/linux/Makefile.am b/lustre/include/linux/Makefile.am index 70d4d03..762c6b9 100644 --- a/lustre/include/linux/Makefile.am +++ b/lustre/include/linux/Makefile.am @@ -9,7 +9,7 @@ if UTILS linux_HEADERS = lustre_idl.h endif -EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_lib.h \ +EXTRA_DIST = lprocfs_status.h lustre_debug.h lustre_lib.h types.h\ lustre_dlm.h lustre_handles.h lustre_net.h obd_class.h obd_support.h \ lustre_log.h lustre_compat25.h lustre_fsfilt.h lustre_mds.h obd.h \ lvfs.h lvfs_linux.h lustre_lite.h lustre_idl.h lustre_quota.h lustre_user.h diff --git a/lustre/include/linux/lustre_user.h b/lustre/include/linux/lustre_user.h index 1a757c3..dd4723d 100644 --- a/lustre/include/linux/lustre_user.h +++ b/lustre/include/linux/lustre_user.h @@ -15,17 +15,20 @@ #include #endif -#ifdef HAVE_QUOTA_SUPPORT -#include -#endif #ifndef __KERNEL__ -#define NEED_QUOTA_DEFS +# define NEED_QUOTA_DEFS +# ifdef HAVE_QUOTA_SUPPORT +# include +# endif #else # include # if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,21) # define NEED_QUOTA_DEFS # endif +# ifdef HAVE_QUOTA_SUPPORT +# include +# endif #endif /* diff --git a/lustre/include/linux/types.h b/lustre/include/linux/types.h new file mode 100644 index 0000000..1adf66c0 --- /dev/null +++ b/lustre/include/linux/types.h @@ -0,0 +1,27 @@ +#ifndef _LUSTRE_LINUX_TYPES_H +#define _LUSTRE_LINUX_TYPES_H + +typedef unsigned short umode_t; + +#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \ + !defined(_EXT2_TYPES_H) && !defined(_I386_TYPES_H)) + +/* + * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the + * header files exported to user space + */ + +typedef __signed__ char __s8; +typedef unsigned char __u8; + +typedef __signed__ short __s16; +typedef unsigned short __u16; + +typedef __signed__ int __s32; +typedef unsigned int __u32; + +typedef __signed__ long long __s64; +typedef unsigned long long __u64; +#endif + +#endif diff --git a/lustre/include/lustre/types.h b/lustre/include/lustre/types.h index 5389d37..bc3f4e9 100644 --- a/lustre/include/lustre/types.h +++ b/lustre/include/lustre/types.h @@ -1,27 +1,14 @@ #ifndef _LUSTRE_TYPES_H #define _LUSTRE_TYPES_H -typedef unsigned short umode_t; - -#if (!defined(_LINUX_TYPES_H) && !defined(_BLKID_TYPES_H) && \ - !defined(_EXT2_TYPES_H) && !defined(_I386_TYPES_H)) - -/* - * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the - * header files exported to user space - */ - -typedef __signed__ char __s8; -typedef unsigned char __u8; - -typedef __signed__ short __s16; -typedef unsigned short __u16; - -typedef __signed__ int __s32; -typedef unsigned int __u32; - -typedef __signed__ long long __s64; -typedef unsigned long long __u64; +#if defined(__linux__) +#include +#elif defined(__APPLE__) +#include +#elif defined(__WINNT__) +#include +#else +#error Unsupported operating system. #endif #endif diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index deaba07..58ad7b6 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -587,7 +587,7 @@ do { \ } \ if (condition) \ break; \ - if (cfs_signal_pending(cfs_current())) { \ + if (cfs_signal_pending()) { \ if (!info->lwi_timeout || __timed_out) { \ break; \ } else { \ @@ -598,9 +598,9 @@ do { \ /* -EINTR when the RPC actually succeeded. */ \ /* the RECALC_SIGPENDING below will deliver the */ \ /* signal properly. */ \ - cfs_sigmask_lock(cfs_current(), irqflags); \ - cfs_clear_sigpending(cfs_current()); \ - cfs_sigmask_unlock(cfs_current(), irqflags); \ + cfs_sigmask_lock(irqflags); \ + cfs_clear_sigpending(); \ + cfs_sigmask_unlock(irqflags); \ } \ } \ } \ @@ -608,7 +608,7 @@ do { \ cfs_block_sigs(blocked); \ \ if ((!info->lwi_timeout || __timed_out) && \ - cfs_signal_pending(cfs_current())) { \ + cfs_signal_pending()) { \ if (info->lwi_on_signal) \ info->lwi_on_signal(info->lwi_cb_data); \ ret = -EINTR; \ diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index 54bb279..0692bf0 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -586,7 +586,7 @@ obd_lvfs_fid2dentry(struct obd_export *exp, __u64 id_ino, __u32 gen, __u64 gr) * If the cache is older than @max_age we will get a new value from the * target. Use a value of "jiffies + HZ" to guarantee freshness. */ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs, - unsigned long max_age) + cfs_time_t max_age) { int rc = 0; ENTRY; @@ -597,8 +597,9 @@ static inline int obd_statfs(struct obd_device *obd, struct obd_statfs *osfs, OBD_CHECK_OP(obd, statfs, -EOPNOTSUPP); OBD_COUNTER_INCREMENT(obd, statfs); - CDEBUG(D_SUPER, "osfs %lu, max_age %lu\n", obd->obd_osfs_age, max_age); - if (time_before(obd->obd_osfs_age, max_age)) { + CDEBUG(D_SUPER, "osfs "CFS_TIME_T", max_age "CFS_TIME_T"\n", + obd->obd_osfs_age, max_age); + if (cfs_time_before(obd->obd_osfs_age, max_age)) { rc = OBP(obd, statfs)(obd, osfs, max_age); if (rc == 0) { spin_lock(&obd->obd_osfs_lock); @@ -688,7 +689,7 @@ static inline int obd_brw_async(int cmd, struct obd_export *exp, static inline int obd_prep_async_page(struct obd_export *exp, struct lov_stripe_md *lsm, struct lov_oinfo *loi, - struct page *page, obd_off offset, + cfs_page_t *page, obd_off offset, struct obd_async_page_ops *ops, void *data, void **res) { diff --git a/lustre/lov/Info.plist b/lustre/lov/Info.plist index b3818d4..006f794 100644 --- a/lustre/lov/Info.plist +++ b/lustre/lov/Info.plist @@ -22,22 +22,20 @@ 1.0.0 OSBundleLibraries - com.apple.kernel.bsd - 1.1 - com.apple.kernel.iokit - 1.0.0b1 - com.apple.kernel.mach - 1.0.0b1 - com.clusterfs.lustre.libcfs - 1.0.0 - com.clusterfs.lustre.portals - 1.0.0 - com.clusterfs.lustre.lvfs - 1.0.0 - com.clusterfs.lustre.obdclass - 1.0.0 - com.clusterfs.lustre.osc - 1.0.0 + com.apple.kpi.bsd + 8.0.0b1 + com.apple.kpi.libkern + 8.0.0b1 + com.apple.kpi.mach + 8.0.0b1 + com.clusterfs.lustre.libcfs + 1.0.0 + com.clusterfs.lustre.lvfs + 1.0.0 + com.clusterfs.lustre.obdclass + 1.0.0 + com.clusterfs.lustre.ptlrpc + 1.0.0 diff --git a/lustre/lov/autoMakefile.am b/lustre/lov/autoMakefile.am index 9eb1aaa..0ade64c 100644 --- a/lustre/lov/autoMakefile.am +++ b/lustre/lov/autoMakefile.am @@ -34,11 +34,13 @@ lov_LDADD := $(EXTRA_KLIBS) plist_DATA := Info.plist -#install-data-hook: fix-kext-ownership +install_data_hook := fix-kext-ownership endif # DARWIN endif # MODULES +install-data-hook: $(install_data_hook) + DIST_SOURCES = $(lov-objs:.o=.c) lov_internal.h MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ diff --git a/lustre/lvfs/Info.plist b/lustre/lvfs/Info.plist index 51b70ed..44439e2 100644 --- a/lustre/lvfs/Info.plist +++ b/lustre/lvfs/Info.plist @@ -21,16 +21,16 @@ OSBundleCompatibleVersion 1.0.0 OSBundleLibraries - - com.apple.kernel.bsd - 1.1 - com.apple.kernel.iokit - 1.0.0b1 - com.apple.kernel.mach - 1.0.0b1 + + com.apple.kpi.bsd + 8.0.0b1 + com.apple.kpi.libkern + 8.0.0b1 + com.apple.kpi.mach + 8.0.0b1 + com.apple.kpi.unsupported + 8.0.0b1 com.clusterfs.lustre.libcfs - 1.0.0 - com.clusterfs.lustre.lnet 1.0.0 diff --git a/lustre/lvfs/autoMakefile.am b/lustre/lvfs/autoMakefile.am index a1c6a31..9185580 100644 --- a/lustre/lvfs/autoMakefile.am +++ b/lustre/lvfs/autoMakefile.am @@ -59,7 +59,7 @@ lvfs_LDADD := $(EXTRA_KLIBS) plist_DATA := Info.plist -#install-data-hook: fix-kext-ownership +install_data_hook := fix-kext-ownership endif # DARWIN @@ -69,6 +69,8 @@ sources: endif # MODULES +install-data-hook: $(install_data_hook) + DIST_SOURCES = fsfilt.c fsfilt_ext3.c fsfilt_reiserfs.c lvfs_common.c \ lvfs_internal.h lvfs_linux.c lvfs_userfs.c \ upcall_cache.c \ diff --git a/lustre/lvfs/lvfs_darwin.c b/lustre/lvfs/lvfs_darwin.c index 6315aab..1feb31c 100644 --- a/lustre/lvfs/lvfs_darwin.c +++ b/lustre/lvfs/lvfs_darwin.c @@ -21,24 +21,11 @@ void pop_ctxt(struct lvfs_run_ctxt *saved, struct lvfs_run_ctxt *new_ctx, LBUG(); } -int lvfs_arch_init(void) -{ - return 0; -} - -void lvfs_arch_exit(void) -{ - return; -} - - static int __init lvfs_init(void) { int ret = 0; ENTRY; - ret = lvfs_arch_init(); - RETURN(ret); } @@ -47,7 +34,6 @@ static void __exit lvfs_exit(void) int leaked; ENTRY; - lvfs_arch_exit(); leaked = atomic_read(&obd_memory); CDEBUG(leaked ? D_ERROR : D_INFO, "obd mem max: %d leaked: %d\n", obd_memmax, leaked); diff --git a/lustre/obdclass/Info.plist b/lustre/obdclass/Info.plist index 5e8312c..0b7e718 100644 --- a/lustre/obdclass/Info.plist +++ b/lustre/obdclass/Info.plist @@ -22,16 +22,16 @@ 1.0.0 OSBundleLibraries - com.apple.kernel.bsd - 1.1 - com.apple.kernel.iokit - 1.0.0b1 - com.apple.kernel.mach - 1.0.0b1 + com.apple.kpi.bsd + 8.0.0b1 + com.apple.kpi.libkern + 8.0.0b1 + com.apple.kpi.mach + 8.0.0b1 + com.apple.kpi.unsupported + 8.0.0b1 com.clusterfs.lustre.libcfs 1.0.0 - com.clusterfs.lustre.lnet - 1.0.0 com.clusterfs.lustre.lvfs 1.0.0 diff --git a/lustre/obdclass/autoMakefile.am b/lustre/obdclass/autoMakefile.am index 1ee08d0..b31e2c5 100644 --- a/lustre/obdclass/autoMakefile.am +++ b/lustre/obdclass/autoMakefile.am @@ -40,11 +40,14 @@ obdclass_LDADD := $(EXTRA_KLIBS) plist_DATA := Info.plist -#install-data-hook: fix-kext-ownership +install_data_hook := fix-kext-ownership + endif # DARWIN endif # MODULES +install-data-hook: $(install_data_hook) + MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ llog-test.c MOSTLYCLEANFILES += linux/*.o darwin/*.o DIST_SOURCES = $(filter-out llog-test.c,$(obdclass-all-objs:.o=.c)) $(llog-test-objs:.o=.c) llog_test.c llog_internal.h diff --git a/lustre/obdclass/class_obd.c b/lustre/obdclass/class_obd.c index 44b2103..456ce2a 100644 --- a/lustre/obdclass/class_obd.c +++ b/lustre/obdclass/class_obd.c @@ -448,8 +448,8 @@ int obd_init_checks(void) CWARN("LPD64 wrong length! strlen(%s)=%d != 2\n", buf, len); ret = -EINVAL; } - if ((u64val & ~PAGE_MASK) >= PAGE_SIZE) { - CWARN("mask failed: u64val "LPU64" >= %lu\n", u64val,PAGE_SIZE); + if ((u64val & ~CFS_PAGE_MASK) >= CFS_PAGE_SIZE) { + CWARN("mask failed: u64val "LPU64" >= %lu\n", u64val,CFS_PAGE_SIZE); ret = -EINVAL; } diff --git a/lustre/obdclass/darwin/darwin-module.c b/lustre/obdclass/darwin/darwin-module.c index 62f937b..87d0554 100644 --- a/lustre/obdclass/darwin/darwin-module.c +++ b/lustre/obdclass/darwin/darwin-module.c @@ -117,7 +117,7 @@ obd_class_ioctl(dev_t dev, u_long cmd, caddr_t arg, int flag, struct proc *p) int err = 0; ENTRY; - if (suser(p->p_ucred, &p->p_acflag)) + if (!is_suser()) RETURN (-EPERM); if (obd_psdev_ops.p_ioctl != NULL) err = obd_psdev_ops.p_ioctl(NULL, cmd, (void *)arg); diff --git a/lustre/obdclass/darwin/darwin-sysctl.c b/lustre/obdclass/darwin/darwin-sysctl.c index 645080c..d2ce8c1 100644 --- a/lustre/obdclass/darwin/darwin-sysctl.c +++ b/lustre/obdclass/darwin/darwin-sysctl.c @@ -82,10 +82,10 @@ int proc_fail_loc SYSCTL_HANDLER_ARGS int old_fail_loc = obd_fail_loc; error = sysctl_handle_long(oidp, oidp->oid_arg1, oidp->oid_arg2, req); - if (!error && req->newptr != NULL) { + if (!error && req->newptr != USER_ADDR_NULL) { if (old_fail_loc != obd_fail_loc) cfs_waitq_signal(&obd_race_waitq); - } else if (req->newptr != NULL) { + } else if (req->newptr != USER_ADDR_NULL) { /* Something was wrong with the write request */ printf ("sysctl fail loc fault: %d.\n", error); } else { diff --git a/lustre/obdecho/Info.plist b/lustre/obdecho/Info.plist index fd4db0c..19a6096 100644 --- a/lustre/obdecho/Info.plist +++ b/lustre/obdecho/Info.plist @@ -22,16 +22,16 @@ 1.0.0 OSBundleLibraries - com.apple.kernel.bsd - 1.1 - com.apple.kernel.iokit - 1.0.0b1 - com.apple.kernel.mach - 1.0.0b1 + com.apple.kpi.bsd + 8.0.0b1 + com.apple.kpi.libkern + 8.0.0b1 + com.apple.kpi.mach + 8.0.0b1 + com.apple.kpi.unsupported + 8.0.0b1 com.clusterfs.lustre.libcfs - 1.0.0 - com.clusterfs.lustre.lnet - 1.0.0 + 1.0.0 com.clusterfs.lustre.lvfs 1.0.0 com.clusterfs.lustre.obdclass diff --git a/lustre/obdecho/autoMakefile.am b/lustre/obdecho/autoMakefile.am index b1489b6..d08aa57 100644 --- a/lustre/obdecho/autoMakefile.am +++ b/lustre/obdecho/autoMakefile.am @@ -28,10 +28,13 @@ obdecho_LDADD := $(EXTRA_KLIBS) plist_DATA := Info.plist -#install-data-hook: fix-kext-ownership +install_data_hook := fix-kext-ownership + endif # darwin endif # MODULES +install-data-hook: $(install_data_hook) + MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ DIST_SOURCES = $(obdecho-objs:%.o=%.c) diff --git a/lustre/osc/Info.plist b/lustre/osc/Info.plist index cb3f391..727980d 100644 --- a/lustre/osc/Info.plist +++ b/lustre/osc/Info.plist @@ -22,16 +22,16 @@ 1.0.0 OSBundleLibraries - com.apple.kernel.bsd - 1.1 - com.apple.kernel.iokit - 1.0.0b1 - com.apple.kernel.mach - 1.0.0b1 + com.apple.kpi.bsd + 8.0.0b1 + com.apple.kpi.libkern + 8.0.0b1 + com.apple.kpi.mach + 8.0.0b1 + com.apple.kpi.unsupported + 8.0.0b1 com.clusterfs.lustre.libcfs - 1.0.0 - com.clusterfs.lustre.lnet - 1.0.0 + 1.0.0 com.clusterfs.lustre.lvfs 1.0.0 com.clusterfs.lustre.obdclass diff --git a/lustre/osc/autoMakefile.am b/lustre/osc/autoMakefile.am index 2bef826..c9f2fbb 100644 --- a/lustre/osc/autoMakefile.am +++ b/lustre/osc/autoMakefile.am @@ -29,10 +29,13 @@ osc_LDADD := $(EXTRA_KLIBS) plist_DATA := Info.plist -#install-data-hook: fix-kext-ownership +install_data_hook := fix-kext-ownership + endif # Darwin endif +install-data-hook: $(install_data_hook) + MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ DIST_SOURCES = $(osc-objs:%.o=%.c) osc_internal.h diff --git a/lustre/osc/osc_create.c b/lustre/osc/osc_create.c index 19be08f..557e036 100644 --- a/lustre/osc/osc_create.c +++ b/lustre/osc/osc_create.c @@ -180,7 +180,8 @@ int osc_create(struct obd_export *exp, struct obdo *oa, CDEBUG(D_HA,"%p: oscc recovery in progress, waiting\n", oscc); - lwi = LWI_TIMEOUT(MAX(obd_timeout*HZ/4, 1), NULL, NULL); + lwi = LWI_TIMEOUT(cfs_timeout_cap(cfs_time_seconds(obd_timeout/4)), + NULL, NULL); rc = l_wait_event(oscc->oscc_waitq, !oscc_recovering(oscc), &lwi); LASSERT(rc == 0 || rc == -ETIMEDOUT); diff --git a/lustre/osc/osc_internal.h b/lustre/osc/osc_internal.h index 1382be4..667da17 100644 --- a/lustre/osc/osc_internal.h +++ b/lustre/osc/osc_internal.h @@ -57,10 +57,6 @@ int osc_real_create(struct obd_export *exp, struct obdo *oa, void oscc_init(struct obd_device *obd); void osc_wake_cache_waiters(struct client_obd *cli); - -/* Quota stuff */ -extern quota_interface_t *quota_interface; - #ifdef LPROCFS int lproc_osc_attach_seqstat(struct obd_device *dev); #else diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 1724794..0f80243 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -57,6 +57,9 @@ #include #include "osc_internal.h" +static quota_interface_t *quota_interface = NULL; +extern quota_interface_t osc_quota_interface; + /* Pack OSC object metadata for disk storage (LE byte order). */ static int osc_packmd(struct obd_export *exp, struct lov_mds_md **lmmp, struct lov_stripe_md *lsm) @@ -558,7 +561,7 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, cli->cl_dirty, cli->cl_dirty_max); oa->o_undirty = 0; } else { - long max_in_flight = (cli->cl_max_pages_per_rpc << PAGE_SHIFT)* + long max_in_flight = (cli->cl_max_pages_per_rpc << CFS_PAGE_SHIFT)* (cli->cl_max_rpcs_in_flight + 1); oa->o_undirty = max(cli->cl_dirty_max, max_in_flight); } @@ -574,10 +577,10 @@ static void osc_announce_cached(struct client_obd *cli, struct obdo *oa, static void osc_consume_write_grant(struct client_obd *cli, struct osc_async_page *oap) { - cli->cl_dirty += PAGE_SIZE; - cli->cl_avail_grant -= PAGE_SIZE; + cli->cl_dirty += CFS_PAGE_SIZE; + cli->cl_avail_grant -= CFS_PAGE_SIZE; oap->oap_brw_flags |= OBD_BRW_FROM_GRANT; - CDEBUG(D_CACHE, "using %lu grant credits for oap %p\n", PAGE_SIZE, oap); + CDEBUG(D_CACHE, "using %lu grant credits for oap %p\n", CFS_PAGE_SIZE, oap); LASSERT(cli->cl_avail_grant >= 0); } @@ -595,7 +598,7 @@ void osc_wake_cache_waiters(struct client_obd *cli) ENTRY; list_for_each_safe(l, tmp, &cli->cl_cache_waiters) { /* if we can't dirty more, we must wait until some is written */ - if (cli->cl_dirty + PAGE_SIZE > cli->cl_dirty_max) { + if (cli->cl_dirty + CFS_PAGE_SIZE > cli->cl_dirty_max) { CDEBUG(D_CACHE, "no dirty room: dirty: %ld max %ld\n", cli->cl_dirty, cli->cl_dirty_max); return; @@ -603,7 +606,7 @@ void osc_wake_cache_waiters(struct client_obd *cli) /* if still dirty cache but no grant wait for pending RPCs that * may yet return us some grant before doing sync writes */ - if (cli->cl_w_in_flight && cli->cl_avail_grant < PAGE_SIZE) { + if (cli->cl_w_in_flight && cli->cl_avail_grant < CFS_PAGE_SIZE) { CDEBUG(D_CACHE, "%u BRW writes in flight, no grant\n", cli->cl_w_in_flight); return; @@ -611,7 +614,7 @@ void osc_wake_cache_waiters(struct client_obd *cli) ocw = list_entry(l, struct osc_cache_waiter, ocw_entry); list_del_init(&ocw->ocw_entry); - if (cli->cl_avail_grant < PAGE_SIZE) { + if (cli->cl_avail_grant < CFS_PAGE_SIZE) { /* no more RPCs in flight to return grant, do sync IO */ ocw->ocw_rc = -EDQUOT; CDEBUG(D_INODE, "wake oap %p for sync\n", ocw->ocw_oap); @@ -649,7 +652,7 @@ static void handle_short_read(int nob_read, obd_count page_count, if (pga->count > nob_read) { /* EOF inside this page */ - ptr = cfs_kmap(pga->pg) + (pga->off & ~PAGE_MASK); + ptr = cfs_kmap(pga->pg) + (pga->off & ~CFS_PAGE_MASK); memset(ptr + nob_read, 0, pga->count - nob_read); cfs_kunmap(pga->pg); page_count--; @@ -664,7 +667,7 @@ static void handle_short_read(int nob_read, obd_count page_count, /* zero remaining pages */ while (page_count-- > 0) { - ptr = cfs_kmap(pga->pg) + (pga->off & ~PAGE_MASK); + ptr = cfs_kmap(pga->pg) + (pga->off & ~CFS_PAGE_MASK); memset(ptr, 0, pga->count); cfs_kunmap(pga->pg); pga++; @@ -732,7 +735,7 @@ static obd_count osc_checksum_bulk(int nob, obd_count pg_count, LASSERT (pg_count > 0); while (nob > 0 && pg_count > 0) { char *ptr = cfs_kmap(pga->pg); - int off = pga->off & ~PAGE_MASK; + int off = pga->off & ~CFS_PAGE_MASK; int count = pga->count > nob ? nob : pga->count; cksum = crc32_le(cksum, ptr + off, count); @@ -809,7 +812,7 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa, struct brw_page *pg_prev = pg - 1; LASSERT(pg->count > 0); - LASSERTF((pg->off & ~PAGE_MASK) + pg->count <= PAGE_SIZE, + LASSERTF((pg->off & ~CFS_PAGE_MASK) + pg->count <= CFS_PAGE_SIZE, "i: %d pg: %p off: "LPU64", count: %u\n", i, pg, pg->off, pg->count); #ifdef __LINUX__ @@ -827,7 +830,7 @@ static int osc_brw_prep_request(int cmd, struct obd_import *imp,struct obdo *oa, LASSERT((pga[0].flag & OBD_BRW_SRVLOCK) == (pg->flag & OBD_BRW_SRVLOCK)); - ptlrpc_prep_bulk_page(desc, pg->pg, pg->off & ~PAGE_MASK, + ptlrpc_prep_bulk_page(desc, pg->pg, pg->off & ~CFS_PAGE_MASK, pg->count); requested_nob += pg->count; @@ -1136,18 +1139,18 @@ static obd_count max_unfragmented_pages(struct brw_page *pg, obd_count pages) int offset; LASSERT (pages > 0); - offset = pg->off & (PAGE_SIZE - 1); + offset = pg->off & (CFS_PAGE_SIZE - 1); for (;;) { pages--; if (pages == 0) /* that's all */ return count; - if (offset + pg->count < PAGE_SIZE) + if (offset + pg->count < CFS_PAGE_SIZE) return count; /* doesn't end on page boundary */ pg++; - offset = pg->off & (PAGE_SIZE - 1); + offset = pg->off & (CFS_PAGE_SIZE - 1); if (offset != 0) /* doesn't start on page boundary */ return count; @@ -1666,7 +1669,7 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi, /* If there is a gap at the end of this page, it can't merge * with any subsequent pages, so we'll hand the network a * "fragmented" page array that it can't transfer in 1 RDMA */ - if (oap->oap_page_off + oap->oap_count < PAGE_SIZE) + if (oap->oap_page_off + oap->oap_count < CFS_PAGE_SIZE) break; } @@ -1721,13 +1724,13 @@ static int osc_send_oap_rpc(struct client_obd *cli, struct lov_oinfo *loi, lprocfs_oh_tally_log2(&cli->cl_read_page_hist, page_count); lprocfs_oh_tally(&cli->cl_read_rpc_hist, cli->cl_r_in_flight); lprocfs_oh_tally_log2(&cli->cl_read_offset_hist, - starting_offset/PAGE_SIZE + 1); + starting_offset/CFS_PAGE_SIZE + 1); } else { lprocfs_oh_tally_log2(&cli->cl_write_page_hist, page_count); lprocfs_oh_tally(&cli->cl_write_rpc_hist, cli->cl_w_in_flight); lprocfs_oh_tally_log2(&cli->cl_write_offset_hist, - starting_offset/PAGE_SIZE + 1); + starting_offset/CFS_PAGE_SIZE + 1); } client_obd_list_lock(&cli->cl_loi_list_lock); @@ -1894,13 +1897,13 @@ static int osc_enter_cache(struct client_obd *cli, struct lov_oinfo *loi, /* force the caller to try sync io. this can jump the list * of queued writes and create a discontiguous rpc stream */ - if (cli->cl_dirty_max < PAGE_SIZE || cli->cl_ar.ar_force_sync || + if (cli->cl_dirty_max < CFS_PAGE_SIZE || cli->cl_ar.ar_force_sync || loi->loi_ar.ar_force_sync) RETURN(-EDQUOT); /* Hopefully normal case - cache space and write credits available */ - if (cli->cl_dirty + PAGE_SIZE <= cli->cl_dirty_max && - cli->cl_avail_grant >= PAGE_SIZE) { + if (cli->cl_dirty + CFS_PAGE_SIZE <= cli->cl_dirty_max && + cli->cl_avail_grant >= CFS_PAGE_SIZE) { /* account for ourselves */ osc_consume_write_grant(cli, oap); RETURN(0); @@ -1948,24 +1951,24 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap, } oap->oap_brw_flags &= ~OBD_BRW_FROM_GRANT; - cli->cl_dirty -= PAGE_SIZE; + cli->cl_dirty -= CFS_PAGE_SIZE; if (!sent) { - cli->cl_lost_grant += PAGE_SIZE; + cli->cl_lost_grant += CFS_PAGE_SIZE; CDEBUG(D_CACHE, "lost grant: %lu avail grant: %lu dirty: %lu\n", cli->cl_lost_grant, cli->cl_avail_grant, cli->cl_dirty); - } else if (PAGE_SIZE != blocksize && oap->oap_count != PAGE_SIZE) { + } else if (CFS_PAGE_SIZE != blocksize && oap->oap_count != CFS_PAGE_SIZE) { /* For short writes we shouldn't count parts of pages that * span a whole block on the OST side, or our accounting goes * wrong. Should match the code in filter_grant_check. */ - int offset = (oap->oap_obj_off +oap->oap_page_off) & ~PAGE_MASK; + int offset = (oap->oap_obj_off +oap->oap_page_off) & ~CFS_PAGE_MASK; int count = oap->oap_count + (offset & (blocksize - 1)); int end = (offset + oap->oap_count) & (blocksize - 1); if (end) count += blocksize - end; - cli->cl_lost_grant += PAGE_SIZE - count; + cli->cl_lost_grant += CFS_PAGE_SIZE - count; CDEBUG(D_CACHE, "lost %lu grant: %lu avail: %lu dirty: %lu\n", - PAGE_SIZE - count, cli->cl_lost_grant, + CFS_PAGE_SIZE - count, cli->cl_lost_grant, cli->cl_avail_grant, cli->cl_dirty); } @@ -1973,7 +1976,7 @@ static void osc_exit_cache(struct client_obd *cli, struct osc_async_page *oap, } int osc_prep_async_page(struct obd_export *exp, struct lov_stripe_md *lsm, - struct lov_oinfo *loi, struct page *page, + struct lov_oinfo *loi, cfs_page_t *page, obd_off offset, struct obd_async_page_ops *ops, void *data, void **res) { @@ -2384,12 +2387,12 @@ static int sanosc_brw_read(struct obd_export *exp, struct obdo *oa, CDEBUG(D_PAGE, "hole at ino %lu; index %ld\n", page->mapping->host->i_ino, page->index); - memset(page_address(page), 0, PAGE_SIZE); + memset(page_address(page), 0, CFS_PAGE_SIZE); continue; } if (!page->buffers) { - create_empty_buffers(page, dev, PAGE_SIZE); + create_empty_buffers(page, dev, CFS_PAGE_SIZE); bh = page->buffers; clear_bit(BH_New, &bh->b_state); @@ -2501,7 +2504,7 @@ static int sanosc_brw_write(struct obd_export *exp, struct obdo *oa, dev = exp->exp_obd->u.cli.cl_sandev; if (!page->buffers) { - create_empty_buffers(page, dev, PAGE_SIZE); + create_empty_buffers(page, dev, CFS_PAGE_SIZE); } else { /* checking */ LASSERT(!test_bit(BH_New, &page->buffers->b_state)); @@ -2634,8 +2637,8 @@ static int osc_enqueue(struct obd_export *exp, struct lov_stripe_md *lsm, /* Filesystem lock extents are extended to page boundaries so that * dealing with the page cache is a little smoother. */ - policy->l_extent.start -= policy->l_extent.start & ~PAGE_MASK; - policy->l_extent.end |= ~PAGE_MASK; + policy->l_extent.start -= policy->l_extent.start & ~CFS_PAGE_MASK; + policy->l_extent.end |= ~CFS_PAGE_MASK; if (lsm->lsm_oinfo->loi_kms_valid == 0) goto no_match; @@ -2733,8 +2736,8 @@ static int osc_match(struct obd_export *exp, struct lov_stripe_md *lsm, /* Filesystem lock extents are extended to page boundaries so that * dealing with the page cache is a little smoother */ - policy->l_extent.start -= policy->l_extent.start & ~PAGE_MASK; - policy->l_extent.end |= ~PAGE_MASK; + policy->l_extent.start -= policy->l_extent.start & ~CFS_PAGE_MASK; + policy->l_extent.end |= ~CFS_PAGE_MASK; /* Next, search for already existing extent locks that will cover us */ rc = ldlm_lock_match(obd->obd_namespace, *flags, &res_id, type, @@ -3360,9 +3363,6 @@ struct obd_ops sanosc_obd_ops = { }; #endif -static quota_interface_t *quota_interface = NULL; -extern quota_interface_t osc_quota_interface; - int __init osc_init(void) { struct lprocfs_static_vars lvars; diff --git a/lustre/ptlrpc/Info.plist b/lustre/ptlrpc/Info.plist index 51b70ed..2b7d35f 100644 --- a/lustre/ptlrpc/Info.plist +++ b/lustre/ptlrpc/Info.plist @@ -5,11 +5,11 @@ CFBundleDevelopmentRegion English CFBundleExecutable - lvfs + ptlrpc CFBundleIconFile CFBundleIdentifier - com.clusterfs.lustre.lvfs + com.clusterfs.lustre.ptlrpc CFBundleInfoDictionaryVersion 6.0 CFBundlePackageType @@ -22,16 +22,12 @@ 1.0.0 OSBundleLibraries - com.apple.kernel.bsd - 1.1 - com.apple.kernel.iokit - 1.0.0b1 - com.apple.kernel.mach - 1.0.0b1 com.clusterfs.lustre.libcfs 1.0.0 com.clusterfs.lustre.lnet 1.0.0 + com.clusterfs.lustre.obdclass + 1.0.0 diff --git a/lustre/ptlrpc/autoMakefile.am b/lustre/ptlrpc/autoMakefile.am index 37803a9..9fd2781 100644 --- a/lustre/ptlrpc/autoMakefile.am +++ b/lustre/ptlrpc/autoMakefile.am @@ -64,10 +64,13 @@ ptlrpc_LDADD := $(EXTRA_KLIBS) plist_DATA := Info.plist -#install-data-hook: fix-kext-ownership +install_data_hook := fix-kext-ownership + endif # DARWIN endif # MODULES +install-data-hook: $(install_data_hook) + MOSTLYCLEANFILES := @MOSTLYCLEANFILES@ ldlm_*.c l_lock.c DIST_SOURCES = $(ptlrpc_objs:.o=.c) ptlrpc_internal.h diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index dbb03f7..fa233e0 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1560,7 +1560,7 @@ restart: rc = ptl_send_rpc(req); if (rc) { DEBUG_REQ(D_HA, req, "send failed (%d); recovering", rc); - timeout = cfs_time_minimal_timeout(); + timeout = CFS_TICK; } else { timeout = cfs_timeout_cap(cfs_time_seconds(req->rq_timeout)); DEBUG_REQ(D_NET, req, diff --git a/lustre/ptlrpc/niobuf.c b/lustre/ptlrpc/niobuf.c index ce5dad0..71c839f 100644 --- a/lustre/ptlrpc/niobuf.c +++ b/lustre/ptlrpc/niobuf.c @@ -288,7 +288,7 @@ void ptlrpc_unregister_bulk (struct ptlrpc_request *req) for (;;) { /* Network access will complete in finite time but the HUGE * timeout lets us CWARN for visibility of sluggish NALs */ - lwi = LWI_TIMEOUT (300 * HZ, NULL, NULL); + lwi = LWI_TIMEOUT (cfs_time_seconds(300), NULL, NULL); rc = l_wait_event(*wq, !ptlrpc_bulk_active(desc), &lwi); if (rc == 0) return; diff --git a/lustre/ptlrpc/pack_generic.c b/lustre/ptlrpc/pack_generic.c index 9471c85..dd4063f 100644 --- a/lustre/ptlrpc/pack_generic.c +++ b/lustre/ptlrpc/pack_generic.c @@ -137,7 +137,7 @@ static struct ptlrpc_reply_state *lustre_get_emerg_rs(struct ptlrpc_service *svc spin_unlock_irqrestore(&svc->srv_lock, flags); /* If we cannot get anything for some long time, we better bail out instead of waiting infinitely */ - lwi = LWI_TIMEOUT(10 * HZ, NULL, NULL); + lwi = LWI_TIMEOUT(cfs_time_seconds(10), NULL, NULL); rc = l_wait_event(svc->srv_free_rs_waitq, !list_empty(&svc->srv_free_rs_list), &lwi); if (rc) diff --git a/lustre/ptlrpc/pinger.c b/lustre/ptlrpc/pinger.c index a231f92..05c4a96 100644 --- a/lustre/ptlrpc/pinger.c +++ b/lustre/ptlrpc/pinger.c @@ -192,7 +192,7 @@ static int ptlrpc_pinger_main(void *arg) /* if the next ping is within, say, 5 jiffies from now, go ahead and ping. See note below. */ cfs_time_aftereq(this_ping, - imp->imp_next_ping - 5 * CFS_MIN_DELAY)) { + imp->imp_next_ping - 5 * CFS_TICK)) { if (level == LUSTRE_IMP_DISCON && !imp->imp_deactive) { /* wait at least a timeout before @@ -447,7 +447,7 @@ static int pinger_check_rpcs(void *arg) unsigned long flags; if (cfs_time_aftereq(pd->pd_this_ping, - imp->imp_next_ping - 5 * CFS_MIN_DELAY)) { + imp->imp_next_ping - 5 * CFS_TICK)) { /* Add a ping. */ spin_lock_irqsave(&imp->imp_lock, flags); generation = imp->imp_generation; diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index 9563334..3c17b11 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -37,7 +37,7 @@ wirecheck_SOURCES = wirecheck.c wirecheck_CPPFLAGS = -DCC="\"$(CC)\"" wiretest_SOURCES = wiretest.c -lctl_SOURCES = parser.c obd.c lustre_cfg.c lctl.c parser.h obdctl.h +lctl_SOURCES = parser.c obd.c lustre_cfg.c lctl.c parser.h obdctl.h platform.h lload_SOURCES = lload.c obdio_SOURCES = obdio.c obdiolib.c obdiolib.h obdbarrier_SOURCES = obdbarrier.c obdiolib.c obdiolib.h diff --git a/lustre/utils/parser.c b/lustre/utils/parser.c index 9c23e77..513a5d7 100644 --- a/lustre/utils/parser.c +++ b/lustre/utils/parser.c @@ -28,19 +28,7 @@ #include #include -#ifdef HAVE_LIBREADLINE -#define READLINE_LIBRARY -#include - -/* completion_matches() is #if 0-ed out in modern glibc */ -#ifndef completion_matches -# define completion_matches rl_completion_matches -#endif -extern void using_history(void); -extern void stifle_history(int); -extern void add_history(char *); -#endif - +#include "platform.h" #include "parser.h" static command_t * top_level; /* Top level of commands, initialized by diff --git a/lustre/utils/platform.h b/lustre/utils/platform.h new file mode 100644 index 0000000..2a11e0f --- /dev/null +++ b/lustre/utils/platform.h @@ -0,0 +1,24 @@ +#ifndef __LUSTRE_UTILS_PLATFORM_H +#define __LUSTRE_UTILS_PLATFORM_H + +#ifdef HAVE_LIBREADLINE +# define READLINE_LIBRARY +# include + +/* completion_matches() is #if 0-ed out in modern glibc */ +# ifdef __linux__ +# ifndef completion_matches +# define completion_matches rl_completion_matches +# endif + extern void using_history(void); + extern void stifle_history(int); + extern void add_history(char *); +# elif __APPLE__ + typedef VFunction rl_vintfunc_t; + typedef VFunction rl_voidfunc_t; +# else +# endif /* __linux__ */ + +#endif /* HAVE_LIBREADLINE */ + +#endif