Whamcloud - gitweb
LU-4679 liblustre: remove dead code and clean headers 29/9429/5
authorJohn L. Hammond <john.hammond@intel.com>
Thu, 27 Feb 2014 23:43:08 +0000 (17:43 -0600)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 28 Mar 2014 03:40:03 +0000 (03:40 +0000)
In liblustre, remove statically unused functions, varaibles and
macros. Also ensure that the headers needed by the c and h files are
included at top level. Prune unneeded includes. In libsysio, include
sys/queue.h in fs.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Change-Id: I878b442b6d0ae17d8d5d33375ca7596618323c52
Reviewed-on: http://review.whamcloud.com/9429
Reviewed-by: Lai Siyao <lai.siyao@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
15 files changed:
libsysio/include/fs.h
lustre/include/cl_object.h
lustre/include/lclient.h
lustre/include/liblustre.h
lustre/liblustre/dir.c
lustre/liblustre/file.c
lustre/liblustre/llite_cl.c
lustre/liblustre/llite_lib.c
lustre/liblustre/llite_lib.h
lustre/liblustre/lutil.c
lustre/liblustre/lutil.h
lustre/liblustre/namei.c
lustre/liblustre/rw.c
lustre/liblustre/super.c
lustre/ptlrpc/ptlrpc_internal.h

index 613ea29..e324006 100644 (file)
 /*
  * File system or volume support.
  */
+#ifndef SYSIO_FS_H_
+#define SYSIO_FS_H_
+
+#include <sys/queue.h>
 
 struct filesys;
 
@@ -171,3 +175,5 @@ extern void _sysio_fs_gone(struct filesys *fs);
 #ifdef ZERO_SUM_MEMORY
 extern void _sysio_fssw_shutdown(void);
 #endif
+
+#endif /* SYSIO_FS_H_ */
index bcedc91..7ccff98 100644 (file)
  */
 #include <lu_object.h>
 #ifdef __KERNEL__
-#        include <linux/mutex.h>
-#        include <linux/radix-tree.h>
+# include <linux/mutex.h>
+# include <linux/radix-tree.h>
+#else
+# include <liblustre.h>
 #endif
 
 struct inode;
index ac1dbc8..e483798 100644 (file)
 #ifndef LCLIENT_H
 #define LCLIENT_H
 
+#include <lustre/lustre_idl.h>
+#include <cl_object.h>
+
+enum obd_notify_event;
+struct inode;
+struct lov_stripe_md;
+struct lustre_md;
+struct obd_capa;
+struct obd_device;
+struct obd_export;
+struct page;
+
 blkcnt_t dirty_cnt(struct inode *inode);
 
 int cl_glimpse_size0(struct inode *inode, int agl);
index 4929dd9..77b1fb3 100644 (file)
@@ -71,27 +71,16 @@ typedef unsigned short umode_t;
 #define set_page_private(page, v) ((page)->private = (v))
 #endif
 
-
-/*
- * The inter_module_get implementation is specific to liblustre, so this needs
- * to stay here for now.
- */
-static inline void inter_module_put(void *a)
-{
-        return;
-}
-void *inter_module_get(char *arg);
-
 /* bits ops */
 
 /* a long can be more than 32 bits, so use BITS_PER_LONG
  * to allow the compiler to adjust the bit shifting accordingly
  */
 
-static __inline__ int ext2_set_bit(int nr, void *addr)
+static inline int ext2_set_bit(int nr, void *addr)
 {
 #if __BYTE_ORDER == __BIG_ENDIAN
-       return set_bit((nr ^ ((BITS_PER_LONG-1) & ~0x7)), addr);
+       return set_bit((nr ^ ((BITS_PER_LONG - 1) & ~0x7)), addr);
 #else
        return set_bit(nr, addr);
 #endif
@@ -100,23 +89,22 @@ static __inline__ int ext2_set_bit(int nr, void *addr)
 static inline int ext2_clear_bit(int nr, void *addr)
 {
 #if __BYTE_ORDER == __BIG_ENDIAN
-       return clear_bit((nr ^ ((BITS_PER_LONG-1) & ~0x7)), addr);
+       return clear_bit((nr ^ ((BITS_PER_LONG - 1) & ~0x7)), addr);
 #else
        return clear_bit(nr, addr);
 #endif
 }
 
-static __inline__ int ext2_test_bit(int nr, void *addr)
+static inline int ext2_test_bit(int nr, const void *addr)
 {
 #if __BYTE_ORDER == __BIG_ENDIAN
-        __const__ unsigned char *tmp = (__const__ unsigned char *) addr;
-        return (tmp[nr >> 3] >> (nr & 7)) & 1;
+       const unsigned char *tmp = addr;
+       return (tmp[nr >> 3] >> (nr & 7)) & 1;
 #else
        return test_bit(nr, addr);
 #endif
 }
 
-
 /* module initialization */
 extern int init_obdclass(void);
 extern int ptlrpc_init(void);
@@ -126,9 +114,6 @@ extern int lov_init(void);
 extern int mdc_init(void);
 extern int lmv_init(void);
 extern int mgc_init(void);
-extern int echo_client_init(void);
-
-
 
 /* general stuff */
 
@@ -149,8 +134,6 @@ extern int echo_client_init(void);
         ({ type __x = (x); type __y = (y); __x > __y ? __x: __y; })
 #endif
 
-#define simple_strtol strtol
-
 /* registering symbols */
 #ifndef ERESTARTSYS
 #define ERESTARTSYS ERESTART
@@ -245,32 +228,11 @@ static inline void it_clear_disposition(struct lookup_intent *it, int flag)
        it->d.lustre.it_disposition &= ~flag;
 }
 
-static inline void intent_init(struct lookup_intent *it, int op, int flags)
-{
-        memset(it, 0, sizeof(*it));
-        it->it_magic = INTENT_MAGIC;
-        it->it_op = op;
-        it->it_flags = flags;
-}
-
-struct dentry {
-        int d_count;
-};
-
-struct vfsmount {
-        void *pwd;
-};
-
-struct signal {
-        int signal;
-};
-
 #undef  LL_TASK_CL_ENV
 #define LL_TASK_CL_ENV          cl_env
 
 struct task_struct {
         int state;
-        struct signal pending;
         char comm[32];
         int uid;
         int gid;
@@ -308,12 +270,7 @@ int in_group_p(gid_t gid);
        ret;                                                            \
 }
 
-#define daemonize(l) do {} while (0)
-#define sigfillset(l) do {} while (0)
-#define recalc_sigpending(l) do {} while (0)
-
 #define call_usermodehelper(path, argv, envp, wait) (0)
-#define KERN_INFO
 
 #if HZ != 1
 #error "liblustre's jiffies currently expects HZ to be 1"
@@ -360,10 +317,6 @@ typedef enum {
 cap_t   cap_get_proc(void);
 int     cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
 
-static inline void libcfs_run_lbug_upcall(char *file, const char *fn,
-                                           const int l){}
-
-
 struct liblustre_wait_callback {
         cfs_list_t              llwc_list;
         const char             *llwc_name;
@@ -381,13 +334,6 @@ void *liblustre_register_idle_callback(const char *name,
 void liblustre_deregister_idle_callback(void *notifier);
 void liblustre_wait_idle(void);
 
-/* flock related */
-struct nfs_lock_info {
-        __u32             state;
-        __u32             flags;
-        void            *host;
-};
-
 struct file_lock {
         struct file_lock *fl_next;  /* singly linked list for this inode  */
         cfs_list_t fl_link;   /* doubly linked list of all locks */
@@ -407,10 +353,6 @@ struct file_lock {
 
         void *fl_fasync; /* for lease break notifications */
         unsigned long fl_break_time;    /* for nonblocking lease breaks */
-
-        union {
-                struct nfs_lock_info    nfs_fl;
-        } fl_u;
 };
 
 #define flock_type(fl)                 ((fl)->fl_type)
@@ -499,25 +441,10 @@ void posix_acl_release(struct posix_acl *acl)
 #endif
 
 typedef int mm_segment_t;
-enum {
-        KERNEL_DS,
-        USER_DS
-};
-static inline mm_segment_t get_fs(void)
-{
-        return USER_DS;
-}
-
-static inline void set_fs(mm_segment_t seg)
-{
-}
 
 #define S_IRWXUGO       (S_IRWXU|S_IRWXG|S_IRWXO)
 #define S_IALLUGO       (S_ISUID|S_ISGID|S_ISVTX|S_IRWXUGO)
 
-struct inode *igrab(struct inode *inode);
-void iput(struct inode *inode);
-
 #include <obd_support.h>
 #include <lustre/lustre_idl.h>
 #include <lustre_lib.h>
index 00b111e..5282eae 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-#include <unistd.h>
-#include <stdlib.h>
+#include <errno.h>
+#include <stddef.h>
 #include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-
-#ifdef HAVE_LINUX_UNISTD_H
-#include <linux/unistd.h>
-#elif defined(HAVE_UNISTD_H)
-#include <unistd.h>
-#endif
-
-
+#include <sys/types.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <lclient.h>
+#include <lustre_dlm.h>
+#include <lustre_lite.h>
+#include <lustre_net.h>
+#include <lustre_req_layout.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
 #include "llite_lib.h"
 #include <dirent.h>
 
@@ -140,7 +139,7 @@ static struct page *llu_dir_read_page(struct inode *ino, __u64 hash,
         return page;
 }
 
-void *(*memmover)(void *, const void *, size_t) = memmove;
+static void *(*memmover)(void *, const void *, size_t) = memmove;
 
 #define NAME_OFFSET(de) ((int) ((de)->d_name - (char *) (de)))
 #define ROUND_UP64(x)   (((x)+sizeof(__u64)-1) & ~(sizeof(__u64)-1))
index e27dcb5..5a30299 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-#include <stdlib.h>
+#include <errno.h>
+#include <fcntl.h>
 #include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/queue.h>
-#include <fcntl.h>
-
+#include <sys/types.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <lclient.h>
+#include <lustre_lib.h>
+#include <lustre_lite.h>
+#include <lustre_mdc.h>
+#include <lustre_net.h>
+#include <lustre_req_layout.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
 #include "llite_lib.h"
 
 /* Pack the required supplementary groups into the supplied groups array.
index 0d857fa..e4ed309 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <sys/types.h>
+#include <errno.h>
+#include <stdarg.h>
+#include <stddef.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-#ifndef __CYGWIN__
-# include <sys/statvfs.h>
-#else
-# include <sys/statfs.h>
-#endif
-
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
 #include <liblustre.h>
-
+#include <lclient.h>
+#include <cl_object.h>
+#include <lustre_export.h>
+#include <lustre_lite.h>
 #include <obd.h>
 #include <obd_support.h>
-#include <lustre_fid.h>
-#include <lustre_lite.h>
-#include <lustre_dlm.h>
-#include <lustre_ver.h>
-#include <lustre_mdc.h>
-#include <cl_object.h>
-
 #include "llite_lib.h"
 
 /*
@@ -80,7 +70,6 @@ static const struct cl_device_operations      slp_cl_ops;
 static const struct cl_io_operations          ccc_io_ops;
 static const struct lu_device_type_operations slp_device_type_ops;
              //struct lu_device_type            slp_device_type;
-static const struct cl_page_operations        slp_page_ops;
 static const struct cl_page_operations        slp_transient_page_ops;
 static const struct cl_lock_operations        slp_lock_ops;
 
@@ -91,8 +80,8 @@ static const struct cl_lock_operations        slp_lock_ops;
  *
  */
 
-void *slp_session_key_init(const struct lu_context *ctx,
-                                  struct lu_context_key *key)
+static void *slp_session_key_init(const struct lu_context *ctx,
+                                 struct lu_context_key *key)
 {
         struct slp_session *session;
 
@@ -102,8 +91,8 @@ void *slp_session_key_init(const struct lu_context *ctx,
         return session;
 }
 
-void slp_session_key_fini(const struct lu_context *ctx,
-                                 struct lu_context_key *key, void *data)
+static void slp_session_key_fini(const struct lu_context *ctx,
+                                struct lu_context_key *key, void *data)
 {
         struct slp_session *session = data;
         OBD_FREE_PTR(session);
@@ -197,7 +186,7 @@ static const struct lu_device_type_operations slp_device_type_ops = {
         .ldto_device_fini  = ccc_device_fini
 };
 
-struct lu_device_type slp_device_type = {
+static struct lu_device_type slp_device_type = {
         .ldt_tags     = LU_DEVICE_CL,
         .ldt_name     = LUSTRE_SLP_NAME,
         .ldt_ops      = &slp_device_type_ops,
@@ -564,8 +553,7 @@ static int llu_queue_pio(const struct lu_env *env, struct cl_io *io,
 }
 
 static
-struct llu_io_group * get_io_group(struct inode *inode, int maxpages,
-                                   struct lustre_rw_params *params)
+struct llu_io_group *get_io_group(struct inode *inode, int maxpages)
 {
         struct llu_io_group *group;
 
@@ -573,8 +561,6 @@ struct llu_io_group * get_io_group(struct inode *inode, int maxpages,
         if (!group)
                 return ERR_PTR(-ENOMEM);
 
-        group->lig_params = params;
-
         return group;
 }
 
@@ -607,7 +593,6 @@ static int slp_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
         loff_t pos;
         long   cnt;
         struct llu_io_group *iogroup;
-        struct lustre_rw_params p = {0};
         int iovidx;
         struct intnl_stat *st = llu_i2stat(inode);
         struct llu_inode_info *lli = llu_i2info(inode);
@@ -624,14 +609,8 @@ static int slp_io_start(const struct lu_env *env, const struct cl_io_slice *ios)
                 pos = io->u.ci_rd.rd.crw_pos;
                 cnt = io->u.ci_rd.rd.crw_count;
         }
-        if (io->u.ci_wr.wr_append) {
-                p.lrp_lock_mode = LCK_PW;
-        } else {
-                p.lrp_brw_flags = OBD_BRW_SRVLOCK;
-                p.lrp_lock_mode = LCK_NL;
-        }
 
-        iogroup = get_io_group(inode, max_io_pages(cnt, cio->cui_nrsegs), &p);
+       iogroup = get_io_group(inode, max_io_pages(cnt, cio->cui_nrsegs));
         if (IS_ERR(iogroup))
                 RETURN(PTR_ERR(iogroup));
 
index a4444af..e108220 100644 (file)
  * Lustre Light common routines
  */
 
+#include <errno.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
-#include <signal.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/queue.h>
-
+#include <unistd.h>
+#include <sys/mount.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
 #include <liblustre.h>
-#include <lnet/lnetctl.h>     /* needed for parse_dump */
+#include <lnet/lnet.h>
+#include <lustre_cfg.h>
+#include <lustre_export.h>
 #include <lustre_log.h>
-
-#include "lutil.h"
+#include <lustre_ver.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
 #include "llite_lib.h"
-
-int slp_global_init(void);
+#include "lutil.h"
 
 static int lllib_init(void)
 {
@@ -269,7 +272,7 @@ int ll_parse_mount_target(const char *target, char **mgsnid,
  * to enable libsysio's processing of namespace init strings containing
  * lustre filesystem operations
  */
-int _sysio_lustre_init(void)
+static int _sysio_lustre_init(void)
 {
         int err;
         char *envstr;
index cc12ddf..090a06d 100644 (file)
 
 #ifndef __LLU_H_
 #define __LLU_H_
+
 #include <fcntl.h>
-#include <sys/queue.h>
+#include <limits.h>
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <time.h>
+#include <unistd.h>
 #include <sysio.h>
 #ifdef HAVE_XTIO_H
-#include <xtio.h>
+# include <xtio.h>
 #endif
 #include <fs.h>
 #include <mount.h>
 #include <inode.h>
 #ifdef HAVE_FILE_H
-#include <file.h>
+# include <file.h>
 #endif
-
-#include <liblustre.h>
-#include <obd.h>
-#include <obd_class.h>
-#include <lustre_mdc.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <lclient.h>
+#include <lustre_lib.h>
 #include <lustre_lite.h>
-#include <lustre_ver.h>
 
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/* for struct cl_lock_descr and struct cl_io */
-#include <cl_object.h>
-#include <lclient.h>
+enum cl_req_type;
 
 /* This should not be "optimized" use ~0ULL because page->index is a long and
  * 32-bit systems are therefore limited to 16TB in a mapping */
@@ -77,19 +76,12 @@ struct llu_sb_info {
         struct obd_export       *ll_md_exp;
         struct obd_export       *ll_dt_exp;
         struct lu_fid            ll_root_fid;
-        int                      ll_flags;
         struct lustre_client_ocd ll_lco;
         cfs_list_t               ll_conn_chain;
-
-        struct obd_uuid          ll_mds_uuid;
-        struct obd_uuid          ll_mds_peer_uuid;
-        char                    *ll_instance;
-        struct lu_site           *ll_site;
-        struct cl_device         *ll_cl;
+       struct lu_site          *ll_site;
+       struct cl_device        *ll_cl;
 };
 
-#define LL_SBI_NOLCK            0x1
-
 enum lli_flags {
         /* MDS has an authority for the Size-on-MDS attributes. */
         LLIF_MDS_SIZE_LOCK      = (1 << 0),
@@ -198,39 +190,19 @@ do {                                                                           \
                         it, inode, (long long)llu_i2stat(inode)->st_ino);      \
 } while(0)
 
-/* interpet return codes from intent lookup */
-#define LL_LOOKUP_POSITIVE 1
-#define LL_LOOKUP_NEGATIVE 2
-
 static inline struct lu_fid *ll_inode2fid(struct inode *inode)
 {
         LASSERT(inode != NULL);
         return &llu_i2info(inode)->lli_fid;
 }
 
-struct it_cb_data {
-        struct inode *icbd_parent;
-        struct pnode *icbd_child;
-        obd_id hash;
-};
-
 void ll_i2gids(__u32 *suppgids, struct inode *i1,struct inode *i2);
 
-typedef int (*intent_finish_cb)(struct ptlrpc_request *,
-                                struct inode *parent, struct pnode *pnode,
-                                struct lookup_intent *, int offset, obd_id ino);
-
 static inline __u64 ll_file_maxbytes(struct inode *inode)
 {
         return llu_i2info(inode)->lli_maxbytes;
 }
 
-struct mount_option_s
-{
-        char *md_uuid;
-        char *dt_uuid;
-};
-
 #define IS_BAD_PTR(ptr)         \
         ((unsigned long)(ptr) == 0 || (unsigned long)(ptr) > -1000UL)
 
@@ -239,13 +211,10 @@ int liblustre_process_log(struct config_llog_instance *cfg, char *mgsnid,
                           char *profile, int allow_recov);
 int ll_parse_mount_target(const char *target, char **mgsnid,
                           char **fsname);
-
-extern struct mount_option_s mount_option;
+extern char *lustre_path;
 
 /* super.c */
 void llu_update_inode(struct inode *inode, struct lustre_md *md);
-void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid);
-int ll_it_open_error(int phase, struct lookup_intent *it);
 struct inode *llu_iget(struct filesys *fs, struct lustre_md *md);
 int llu_inode_getattr(struct inode *inode, struct obdo *obdo,
                       __u64 ioepoch, int sync);
@@ -260,7 +229,6 @@ extern struct fssw_ops llu_fssw_ops;
 void llu_prep_md_op_data(struct md_op_data *op_data, struct inode *i1,
                          struct inode *i2, const char *name, int namelen,
                          int mode, __u32 opc);
-int llu_create(struct inode *dir, struct pnode_base *pnode, int mode);
 int llu_local_open(struct llu_inode_info *lli, struct lookup_intent *it);
 int llu_iop_open(struct pnode *pnode, int flags, mode_t mode);
 void llu_done_writing_attr(struct inode *inode, struct md_op_data *op_data);
@@ -271,7 +239,6 @@ int llu_file_release(struct inode *inode);
 int llu_som_update(struct inode *inode, struct md_op_data *op_data);
 int llu_iop_close(struct inode *inode);
 _SYSIO_OFF_T llu_iop_pos(struct inode *ino, _SYSIO_OFF_T off);
-int llu_vmtruncate(struct inode * inode, loff_t offset, obd_flag obd_flags);
 void obdo_refresh_inode(struct inode *dst, struct obdo *src, obd_flag valid);
 int llu_objects_destroy(struct ptlrpc_request *request, struct inode *dir);
 void llu_ioepoch_open(struct llu_inode_info *lli, __u64 ioepoch);
@@ -286,9 +253,7 @@ int llu_iop_lookup(struct pnode *pnode,
                    struct inode **inop,
                    struct intent *intnt,
                    const char *path);
-void unhook_stale_inode(struct pnode *pno);
 struct inode *llu_inode_from_resource_lock(struct ldlm_lock *lock);
-struct inode *llu_inode_from_lock(struct ldlm_lock *lock);
 int llu_md_blocking_ast(struct ldlm_lock *lock,
                         struct ldlm_lock_desc *desc,
                         void *data, int flag);
@@ -297,10 +262,6 @@ int llu_md_blocking_ast(struct ldlm_lock *lock,
 ssize_t llu_iop_filldirentries(struct inode *ino, _SYSIO_OFF_T *basep,
                                char *buf, size_t nbytes);
 
-/* liblustre/llite_fid.c*/
-unsigned long llu_fid_build_ino(struct llu_sb_info *sbi,
-                                struct lu_fid *fid);
-
 /* ext2 related */
 #define EXT2_NAME_LEN (255)
 
@@ -312,11 +273,6 @@ struct ext2_dirent {
         char    name[EXT2_NAME_LEN];
 };
 
-#define EXT2_DIR_PAD                    4
-#define EXT2_DIR_ROUND                  (EXT2_DIR_PAD - 1)
-#define EXT2_DIR_REC_LEN(name_len)      (((name_len) + 8 + EXT2_DIR_ROUND) & \
-                                         ~EXT2_DIR_ROUND)
-
 static inline struct ext2_dirent *ext2_next_entry(struct ext2_dirent *p)
 {
         return (struct ext2_dirent*)((char*) p + le16_to_cpu(p->rec_len));
@@ -334,24 +290,15 @@ static inline void inode_init_lvb(struct inode *inode, struct ost_lvb *lvb)
         lvb->lvb_ctime = st->st_ctime;
 }
 
-#define LLU_IO_GROUP_SIZE(x) \
-        (sizeof(struct llu_io_group) + \
-         (sizeof(struct ll_async_page) + \
-         sizeof(struct page) + \
-          llap_cookie_size) * (x))
-
 struct llu_io_session {
         struct inode           *lis_inode;
         int                     lis_cmd;
-        int                     lis_max_groups;
-        int                     lis_ngroups;
         int                     lis_rc;
         __u64                   lis_rwcount;
 };
 
 struct llu_io_group
 {
-        struct lustre_rw_params *lig_params;
         int                     lig_rc;
         __u64                   lig_rwcount;
 };
@@ -372,6 +319,9 @@ struct slp_session {
         struct slp_io ss_ios;
 };
 
+int slp_global_init(void);
+void slp_global_fini(void);
+
 static inline struct slp_session *slp_env_session(const struct lu_env *env)
 {
         extern struct lu_context_key slp_session_key;
@@ -433,11 +383,6 @@ static inline loff_t i_size_read(struct inode *inode)
         return inode->i_stbuf.st_size;
 }
 
-static inline void i_size_write(struct inode *inode, loff_t i_sz)
-{
-        inode->i_stbuf.st_size = i_sz;
-}
-
 static inline __u64 hash_x_index(__u64 hash, int hash64)
 {
        if (BITS_PER_LONG == 32 && hash64)
index 2ec4aa2..ba1c35b 100644 (file)
  * Lustre is a trademark of Sun Microsystems, Inc.
  */
 
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <signal.h>
-#include <sys/types.h>
-
+#include <byteswap.h>
+#include <errno.h>
 #include <fcntl.h>
-#ifdef HAVE_NETDB_H
+#include <malloc.h>
 #include <netdb.h>
-#endif
-#ifdef _AIX
-#include "syscall_AIX.h"
-#else
+#include <stdio.h>
+#include <unistd.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
 #include <sys/syscall.h>
-#endif
+#include <sys/time.h>
+#include <sys/types.h>
 #include <sys/utsname.h>
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#include <sys/socket.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <lnet/lnet.h>
+#include <lustre_dlm.h>
 #include "lutil.h"
 
-
-
-struct task_struct     *current;
-
-void *inter_module_get(char *arg)
-{
-        if (!strcmp(arg, "ldlm_cli_cancel_unused"))
-                return ldlm_cli_cancel_unused;
-        else if (!strcmp(arg, "ldlm_namespace_cleanup"))
-                return ldlm_namespace_cleanup;
-        else if (!strcmp(arg, "ldlm_replay_locks"))
-                return ldlm_replay_locks;
-        else
-                return NULL;
-}
+struct task_struct *current;
 
 /*
  * random number generator stuff
@@ -197,7 +177,6 @@ int liblustre_init_current(char *comm)
         current->gid = getgid();
         current->fsuid = geteuid();
         current->fsgid = getegid();
-        memset(&current->pending, 0, sizeof(current->pending));
 
         current->max_groups = sysconf(_SC_NGROUPS_MAX);
         current->groups = malloc(sizeof(gid_t) * current->max_groups);
index 3c07329..45a79d3 100644 (file)
 #ifndef __LUTIL_H_
 #define __LUTIL_H_
 
-#include <liblustre.h>
-#include <obd.h>
-#include <obd_class.h>
-
 void liblustre_init_random(void);
 int liblustre_init_current(char *comm);
 int init_lib_portals(void);
index a3d6d6e..cb6bb1d 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
-#include <time.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-
-#include "llite_lib.h"
+#include <sys/types.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <lclient.h>
+#include <lustre_dlm.h>
 #include <lustre_fid.h>
+#include <lustre_mdc.h>
+#include <lustre_net.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
+#include "llite_lib.h"
 
-void ll_intent_drop_lock(struct lookup_intent *it)
+static void ll_intent_drop_lock(struct lookup_intent *it)
 {
         struct lustre_handle *handle;
 
@@ -68,7 +76,7 @@ void ll_intent_drop_lock(struct lookup_intent *it)
         }
 }
 
-void ll_intent_release(struct lookup_intent *it)
+static void ll_intent_release(struct lookup_intent *it)
 {
         ENTRY;
 
@@ -80,7 +88,8 @@ void ll_intent_release(struct lookup_intent *it)
         EXIT;
 }
 
-void llu_lookup_finish_locks(struct lookup_intent *it, struct pnode *pnode)
+static void
+llu_lookup_finish_locks(struct lookup_intent *it, struct pnode *pnode)
 {
         struct inode *inode;
         LASSERT(it);
@@ -291,11 +300,9 @@ static int llu_pb_revalidate(struct pnode *pnode, int flags,
 }
 
 static int lookup_it_finish(struct ptlrpc_request *request, int offset,
-                            struct lookup_intent *it, void *data)
+                           struct lookup_intent *it,
+                           struct inode *parent, struct pnode *child)
 {
-        struct it_cb_data *icbd = data;
-        struct pnode *child = icbd->icbd_child;
-        struct inode *parent = icbd->icbd_parent;
         struct llu_sb_info *sbi = llu_i2sbi(parent);
         struct inode *inode = NULL;
         int rc;
@@ -395,26 +402,10 @@ struct inode *llu_inode_from_resource_lock(struct ldlm_lock *lock)
        return inode;
 }
 
-struct inode *llu_inode_from_lock(struct ldlm_lock *lock)
-{
-        struct inode *inode;
-        lock_res_and_lock(lock);
-
-        if (lock->l_ast_data) {
-                inode = (struct inode *)lock->l_ast_data;
-                I_REF(inode);
-        } else
-                inode = NULL;
-
-        unlock_res_and_lock(lock);
-        return inode;
-}
-
 static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
                          struct lookup_intent *it, int flags)
 {
         struct md_op_data op_data = {{ 0 }};
-        struct it_cb_data icbd;
         struct ptlrpc_request *req = NULL;
         struct lookup_intent lookup_it = { .it_op = IT_LOOKUP };
         __u32 opc;
@@ -429,9 +420,6 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
                 it->it_op_release = ll_intent_release;
         }
 
-        icbd.icbd_child = pnode;
-        icbd.icbd_parent = parent;
-
        if (it->it_op & IT_CREAT)
                opc = LUSTRE_OPC_CREATE;
        else
@@ -447,7 +435,7 @@ static int llu_lookup_it(struct inode *parent, struct pnode *pnode,
         if (rc < 0)
                 GOTO(out, rc);
 
-        rc = lookup_it_finish(req, DLM_REPLY_REC_OFF, it, &icbd);
+       rc = lookup_it_finish(req, DLM_REPLY_REC_OFF, it, parent, pnode);
         if (rc != 0) {
                 ll_intent_release(it);
                 GOTO(out, rc);
index 0e49174..54c6eaf 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-#include <assert.h>
 #include <time.h>
-#include <sys/types.h>
 #include <sys/stat.h>
-#include <sys/queue.h>
-#include <fcntl.h>
+#include <sys/types.h>
 #include <sys/uio.h>
-
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <cl_object.h>
+#include <lclient.h>
+#include <lustre_dlm.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
 #include "llite_lib.h"
 
-typedef ssize_t llu_file_piov_t(const struct iovec *iovec, int iovlen,
-                                _SYSIO_OFF_T pos, ssize_t len,
-                                void *private);
-
-size_t llap_cookie_size;
-
-static int llu_lock_to_stripe_offset(struct obd_export *exp,
-                                    struct lov_stripe_md *lsm,
-                                    struct ldlm_lock *lock)
-{
-        struct {
-                char name[16];
-                struct ldlm_lock *lock;
-        } key = { .name = KEY_LOCK_TO_STRIPE, .lock = lock };
-        __u32 stripe, vallen = sizeof(stripe);
-        int rc;
-        ENTRY;
-
-       if (lsm == NULL || lsm->lsm_stripe_count == 1)
-               RETURN(0);
-
-        /* get our offset in the lov */
-        rc = obd_get_info(NULL, exp, sizeof(key), &key, &vallen, &stripe, lsm);
-        if (rc != 0) {
-                CERROR("obd_get_info: rc = %d\n", rc);
-                LBUG();
-        }
-        LASSERT(stripe < lsm->lsm_stripe_count);
-       RETURN(stripe);
-}
-
-int llu_extent_lock_cancel_cb(struct ldlm_lock *lock,
-                              struct ldlm_lock_desc *new, void *data,
-                              int flag)
-{
-        struct lustre_handle lockh = { 0 };
-        int rc;
-        ENTRY;
-
-        if ((unsigned long)data > 0 && (unsigned long)data < 0x1000) {
-                LDLM_ERROR(lock, "cancelling lock with bad data %p", data);
-                LBUG();
-        }
-
-        switch (flag) {
-        case LDLM_CB_BLOCKING:
-                ldlm_lock2handle(lock, &lockh);
-               rc = ldlm_cli_cancel(&lockh, 0);
-                if (rc != ELDLM_OK)
-                        CERROR("ldlm_cli_cancel failed: %d\n", rc);
-                break;
-        case LDLM_CB_CANCELING: {
-                struct inode *inode;
-                struct llu_inode_info *lli;
-                struct lov_stripe_md *lsm;
-                __u32 stripe;
-                __u64 kms;
-
-                /* This lock wasn't granted, don't try to evict pages */
-                if (lock->l_req_mode != lock->l_granted_mode)
-                        RETURN(0);
-
-                inode = llu_inode_from_lock(lock);
-                if (!inode)
-                        RETURN(0);
-                lli= llu_i2info(inode);
-                if (!lli)
-                        goto iput;
-               if (!lli->lli_has_smd)
-                       goto iput;
-
-               lsm = ccc_inode_lsm_get(inode);
-               if (lsm == NULL)
-                       goto iput;
-
-                stripe = llu_lock_to_stripe_offset(llu_i2obdexp(inode),
-                                                  lsm, lock);
-                lock_res_and_lock(lock);
-                kms = ldlm_extent_shift_kms(lock,
-                                            lsm->lsm_oinfo[stripe]->loi_kms);
-                unlock_res_and_lock(lock);
-                if (lsm->lsm_oinfo[stripe]->loi_kms != kms)
-                        LDLM_DEBUG(lock, "updating kms from "LPU64" to "LPU64,
-                                   lsm->lsm_oinfo[stripe]->loi_kms, kms);
-                loi_kms_set(lsm->lsm_oinfo[stripe], kms);
-               ccc_inode_lsm_put(inode, lsm);
-iput:
-                I_RELE(inode);
-                break;
-        }
-        default:
-                LBUG();
-        }
-
-        RETURN(0);
-}
-
 int llu_merge_lvb(const struct lu_env *env, struct inode *inode)
 {
        struct llu_inode_info *lli = llu_i2info(inode);
@@ -256,7 +168,6 @@ struct llu_io_session *get_io_session(struct inode *ino, int ngroups, int cmd)
 
         I_REF(ino);
         session->lis_inode = ino;
-        session->lis_max_groups = ngroups;
         session->lis_cmd = cmd;
         return session;
 }
index 726e141..43aeeee 100644 (file)
 
 #define DEBUG_SUBSYSTEM S_LLITE
 
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdarg.h>
+#include <stdbool.h>
+#include <stddef.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
-#include <assert.h>
 #include <time.h>
-#include <sys/types.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
 #include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/queue.h>
-#ifndef __CYGWIN__
-# include <sys/statvfs.h>
-#else
-# include <sys/statfs.h>
-#endif
-
+#include <sys/types.h>
+#include <libcfs/libcfs.h>
+#include <lustre/lustre_idl.h>
+#include <liblustre.h>
+#include <lclient.h>
+#include <lustre_dlm.h>
+#include <lustre_export.h>
+#include <lustre_lite.h>
+#include <lustre_mdc.h>
+#include <lustre_net.h>
+#include <lustre_req_layout.h>
+#include <lustre_ver.h>
+#include <obd.h>
+#include <obd_class.h>
+#include <obd_support.h>
 #include "llite_lib.h"
 
 #ifndef MAY_EXEC
@@ -213,48 +227,6 @@ void llu_update_inode(struct inode *inode, struct lustre_md *md)
         }
 }
 
-void obdo_to_inode(struct inode *dst, struct obdo *src, obd_flag valid)
-{
-        struct llu_inode_info *lli = llu_i2info(dst);
-        struct intnl_stat *st = llu_i2stat(dst);
-
-        valid &= src->o_valid;
-
-       LASSERTF(!(valid & (OBD_MD_FLTYPE | OBD_MD_FLGENER | OBD_MD_FLFID |
-                           OBD_MD_FLID | OBD_MD_FLGROUP)),
-                "object "DOSTID", valid %x\n", POSTID(&src->o_oi), valid);
-
-        if (valid & (OBD_MD_FLCTIME | OBD_MD_FLMTIME))
-                CDEBUG(D_INODE,"valid "LPX64", cur time "CFS_TIME_T"/"CFS_TIME_T
-                       ", new %lu/%lu\n",
-                       src->o_valid,
-                       LTIME_S(st->st_mtime), LTIME_S(st->st_ctime),
-                       (long)src->o_mtime, (long)src->o_ctime);
-
-        if (valid & OBD_MD_FLATIME)
-                LTIME_S(st->st_atime) = src->o_atime;
-        if (valid & OBD_MD_FLMTIME)
-                LTIME_S(st->st_mtime) = src->o_mtime;
-        if (valid & OBD_MD_FLCTIME && src->o_ctime > LTIME_S(st->st_ctime))
-                LTIME_S(st->st_ctime) = src->o_ctime;
-        if (valid & OBD_MD_FLSIZE)
-                st->st_size = src->o_size;
-        if (valid & OBD_MD_FLBLOCKS) /* allocation of space */
-                st->st_blocks = src->o_blocks;
-        if (valid & OBD_MD_FLBLKSZ)
-                st->st_blksize = src->o_blksize;
-        if (valid & OBD_MD_FLTYPE)
-                st->st_mode = (st->st_mode & ~S_IFMT) | (src->o_mode & S_IFMT);
-        if (valid & OBD_MD_FLMODE)
-                st->st_mode = (st->st_mode & S_IFMT) | (src->o_mode & ~S_IFMT);
-        if (valid & OBD_MD_FLUID)
-                st->st_uid = src->o_uid;
-        if (valid & OBD_MD_FLGID)
-                st->st_gid = src->o_gid;
-        if (valid & OBD_MD_FLFLAGS)
-                lli->lli_st_flags = src->o_flags;
-}
-
 /**
  * Performs the getattr on the inode and updates its fields.
  * If @sync != 0, perform the getattr under the server-side lock.
@@ -497,7 +469,7 @@ static int null_if_equal(struct ldlm_lock *lock, void *data)
         return LDLM_ITER_CONTINUE;
 }
 
-void llu_clear_inode(struct inode *inode)
+static void llu_clear_inode(struct inode *inode)
 {
        struct llu_inode_info *lli = llu_i2info(inode);
        struct llu_sb_info *sbi = llu_i2sbi(inode);
@@ -528,7 +500,7 @@ void llu_clear_inode(struct inode *inode)
         EXIT;
 }
 
-void llu_iop_gone(struct inode *inode)
+static void llu_iop_gone(struct inode *inode)
 {
         struct llu_inode_info *lli = llu_i2info(inode);
         ENTRY;
@@ -1788,9 +1760,8 @@ static int llu_iop_datasync(struct inode *inode)
         return 0;
 }
 
-struct filesys_ops llu_filesys_ops =
-{
-        fsop_gone: llu_fsop_gone,
+static struct filesys_ops llu_filesys_ops = {
+       .fsop_gone      = llu_fsop_gone,
 };
 
 struct inode *llu_iget(struct filesys *fs, struct lustre_md *md)
@@ -2055,34 +2026,34 @@ out_free:
 }
 
 struct fssw_ops llu_fssw_ops = {
-        llu_fsswop_mount
+       .fsswop_mount           = llu_fsswop_mount,
 };
 
 static struct inode_ops llu_inode_ops = {
-        inop_lookup:    llu_iop_lookup,
-        inop_getattr:   llu_iop_getattr,
-        inop_setattr:   llu_iop_setattr,
-        inop_filldirentries:     llu_iop_filldirentries,
-        inop_mkdir:     llu_iop_mkdir_raw,
-        inop_rmdir:     llu_iop_rmdir_raw,
-        inop_symlink:   llu_iop_symlink_raw,
-        inop_readlink:  llu_iop_readlink,
-        inop_open:      llu_iop_open,
-        inop_close:     llu_iop_close,
-        inop_link:      llu_iop_link_raw,
-        inop_unlink:    llu_iop_unlink_raw,
-        inop_rename:    llu_iop_rename_raw,
-        inop_pos:       llu_iop_pos,
-        inop_read:      llu_iop_read,
-        inop_write:     llu_iop_write,
-        inop_iodone:    llu_iop_iodone,
-        inop_fcntl:     llu_iop_fcntl,
-        inop_sync:      llu_iop_sync,
-        inop_datasync:  llu_iop_datasync,
-        inop_ioctl:     llu_iop_ioctl,
-        inop_mknod:     llu_iop_mknod_raw,
+       .inop_lookup            = llu_iop_lookup,
+       .inop_getattr           = llu_iop_getattr,
+       .inop_setattr           = llu_iop_setattr,
+       .inop_filldirentries    = llu_iop_filldirentries,
+       .inop_mkdir             = llu_iop_mkdir_raw,
+       .inop_rmdir             = llu_iop_rmdir_raw,
+       .inop_symlink           = llu_iop_symlink_raw,
+       .inop_readlink          = llu_iop_readlink,
+       .inop_open              = llu_iop_open,
+       .inop_close             = llu_iop_close,
+       .inop_link              = llu_iop_link_raw,
+       .inop_unlink            = llu_iop_unlink_raw,
+       .inop_rename            = llu_iop_rename_raw,
+       .inop_pos               = llu_iop_pos,
+       .inop_read              = llu_iop_read,
+       .inop_write             = llu_iop_write,
+       .inop_iodone            = llu_iop_iodone,
+       .inop_fcntl             = llu_iop_fcntl,
+       .inop_sync              = llu_iop_sync,
+       .inop_datasync          = llu_iop_datasync,
+       .inop_ioctl             = llu_iop_ioctl,
+       .inop_mknod             = llu_iop_mknod_raw,
 #ifdef _HAVE_STATVFS
-        inop_statvfs:   llu_iop_statvfs,
+       .inop_statvfs           = llu_iop_statvfs,
 #endif
-        inop_gone:      llu_iop_gone,
+       .inop_gone              = llu_iop_gone,
 };
index a83bca9..5cd9350 100644 (file)
@@ -282,6 +282,8 @@ void sptlrpc_conf_choose_flavor(enum lustre_sec_part from,
 int  sptlrpc_conf_init(void);
 void sptlrpc_conf_fini(void);
 
+struct dentry;
+struct vfsmount;
 int lustre_rename(struct dentry *dir, struct vfsmount *mnt, char *old_name,
                  char *new_name);