Whamcloud - gitweb
- except for fixing the segfault in the documentation build, this is
authorbraam <braam>
Sun, 30 Jun 2002 07:39:40 +0000 (07:39 +0000)
committerbraam <braam>
Sun, 30 Jun 2002 07:39:40 +0000 (07:39 +0000)
  merely a cleanup checkin.  Functions in the obdclass system were
  given sensible names, old unused headers were removed, and stuff
  that isn't used widely was sometimes move from generic headers to
  specific subsystems.

27 files changed:
lustre/include/linux/inofs.h [deleted file]
lustre/include/linux/lustre_lite.h
lustre/include/linux/lustre_mds.h
lustre/include/linux/lustre_net.h
lustre/include/linux/lustre_req.h [deleted file]
lustre/include/linux/obd.h
lustre/include/linux/obd_class.h
lustre/include/linux/obd_raid1.h [deleted file]
lustre/include/linux/obd_rpc.h [deleted file]
lustre/include/linux/obd_snap_support.h
lustre/include/linux/obdfs.h
lustre/include/linux/obdo.h [deleted file]
lustre/ldlm/ldlm_lockd.c
lustre/lib/l_net.c
lustre/lov/lov_obd.c
lustre/mdc/mdc_reint.c
lustre/mdc/mdc_request.c
lustre/mds/handler.c
lustre/obdclass/class_obd.c
lustre/obdclass/genops.c
lustre/obdclass/proc_lustre.c
lustre/obdecho/echo.c
lustre/obdfilter/filter.c
lustre/osc/osc_request.c
lustre/ost/ost_handler.c
lustre/ptlrpc/rpc.c
lustre/ptlrpc/service.c

diff --git a/lustre/include/linux/inofs.h b/lustre/include/linux/inofs.h
deleted file mode 100644 (file)
index 1ed3220..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* object based disk file system
- * 
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- * 
- * Copyright (C), 1999, Stelias Computing Inc
- *
- *
- */
-
-
-#ifndef _INOFS_H
-#define INOFS_H
-#include <linux/obd_class.h>
-
-#include <linux/obdo.h>
-
-/* super.c */
-void inofs_read_inode(struct inode *inode);
-
-
-/* file.c */
-ssize_t inofs_file_write(struct file *file, const char *buf, size_t count, loff_t *ppos);
-
-
-/* rw.c */
-struct page *inofs_getpage(struct inode *inode, unsigned long offset, int create, int locked);
-int inofs_writepage(struct file *file, struct page *page);
-int inofs_write_one_page(struct file *file, struct page *page, unsigned long offset, unsigned long bytes, const char * buf);
-
-/* namei.c */
-struct dentry *inofs_lookup(struct inode * dir, struct dentry *dentry);
-int inofs_create (struct inode * dir, struct dentry * dentry, int mode);
-int inofs_mkdir(struct inode *dir, struct dentry *dentry, int mode);
-int inofs_rmdir(struct inode *dir, struct dentry *dentry);
-int inofs_unlink(struct inode *dir, struct dentry *dentry);
-int inofs_mknod(struct inode *dir, struct dentry *dentry, int mode, int rdev);
-int inofs_symlink(struct inode *dir, struct dentry *dentry, const char *symname);
-int inofs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry);
-int inofs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry);
-
-/* dir.c */
-int inofs_readdir(struct file * filp, void * dirent, filldir_t filldir);
-
-struct inofs_sb_info {
-        struct list_head osi_list;      /* list of supers */
-        struct obd_conn osi_conn;
-        struct super_block *osi_super;
-        struct obd_device *osi_obd;
-        struct obd_ops *osi_ops;
-        struct list_head         osi_inodes;    /* list of dirty inodes */
-        unsigned long            osi_cache_count;
-        struct semaphore         osi_list_mutex;
-};
-
-void inofs_sysctl_init(void);
-void inofs_sysctl_clean(void);
-
-struct inofs_inode_info;
-
-extern struct file_operations inofs_file_ops;
-extern struct inode_operations inofs_inode_ops;
-
-static inline struct obd_ops *iops(struct inode *i)
-{
-        struct inofs_sb_info *sbi = (struct inofs_sb_info *) i->i_sb->u.generic_sbp;
-        return sbi->osi_ops;
-}
-
-#define NOLOCK 0
-#define LOCKED 1
-
-
-#define INOFS_SUPER_MAGIC 0x4711
-
-#endif
-
index 3f62ec7..758ad57 100644 (file)
@@ -20,7 +20,6 @@
 #include <linux/lustre_net.h>
 #include <linux/lustre_mds.h>
 #include <linux/lustre_ha.h>
-#include <linux/obdo.h>
 
 extern kmem_cache_t *ll_file_data_slab;
 struct ll_file_data {
@@ -56,8 +55,8 @@ struct ll_inode_info {
 #define LL_COMMITCBD_RUNNING   0x4
 
 struct ll_sb_info {
-        struct obd_conn           ll_mdc_conn;
-        struct obd_conn           ll_osc_conn;
+        struct lustre_handle           ll_mdc_conn;
+        struct lustre_handle           ll_osc_conn;
         ino_t                     ll_rootino; /* number of root inode */
 
         wait_queue_head_t         ll_commitcbd_waitq;
@@ -75,14 +74,14 @@ static inline struct ll_sb_info *ll_s2sbi(struct super_block *sb)
         return (struct ll_sb_info *)(sb->u.generic_sbp);
 }
 
-static inline struct obd_conn *ll_s2obdconn(struct super_block *sb)
+static inline struct lustre_handle *ll_s2obdconn(struct super_block *sb)
 {
         return &(ll_s2sbi(sb))->ll_osc_conn;
 }
 
 static inline struct mdc_obd *sbi2mdc(struct ll_sb_info *sbi)
 {
-        struct obd_device *obd = gen_conn2obd(&sbi->ll_mdc_conn);
+        struct obd_device *obd = class_conn2obd(&sbi->ll_mdc_conn);
         return &obd->u.mdc;
 }
 
@@ -102,7 +101,7 @@ static inline int ll_has_inline(struct inode *inode)
 }
 
 
-static inline struct obd_conn *ll_i2obdconn(struct inode *inode)
+static inline struct lustre_handle *ll_i2obdconn(struct inode *inode)
 {
         return ll_s2obdconn(inode->i_sb);
 }
index cd36563..095ee84 100644 (file)
@@ -137,44 +137,44 @@ int mds_lock_callback(struct lustre_handle *lockh, struct ldlm_lock_desc *desc,
 int mds_reint(int offset, struct ptlrpc_request *req);
 
 /* mdc/mdc_request.c */
-static inline struct mdc_obd *mdc_conn2mdc(struct obd_conn *conn)
+static inline struct mdc_obd *mdc_conn2mdc(struct lustre_handle *conn)
 {
-        return &gen_conn2obd(conn)->u.mdc;
+        return &class_conn2obd(conn)->u.mdc;
 }
 
-int mdc_enqueue(struct obd_conn *conn, int lock_type, struct lookup_intent *it, 
+int mdc_enqueue(struct lustre_handle *conn, int lock_type, struct lookup_intent *it, 
                 int lock_mode, struct inode *dir, struct dentry *de,
                 struct lustre_handle *h, __u64 id, char *tgt, int tgtlen,
                 void *data, int datalen);
-int mdc_getstatus(struct obd_conn *conn,
+int mdc_getstatus(struct lustre_handle *conn,
                 struct ll_fid *rootfid, __u64 *last_committed, __u64 *last_rcvd,
                 __u32 *last_xid, struct ptlrpc_request **);
-int mdc_getattr(struct obd_conn *conn,
+int mdc_getattr(struct lustre_handle *conn,
                 ino_t ino, int type, unsigned long valid, size_t ea_size,
                 struct ptlrpc_request **request);
-int mdc_statfs(struct obd_conn *conn,
+int mdc_statfs(struct lustre_handle *conn,
                struct statfs *sfs, struct ptlrpc_request **request);
-int mdc_setattr(struct obd_conn *conn,
+int mdc_setattr(struct lustre_handle *conn,
                 struct inode *, struct iattr *iattr, struct ptlrpc_request **);
-int mdc_open(struct obd_conn *conn,
+int mdc_open(struct lustre_handle *conn,
              ino_t ino, int type, int flags, struct obdo *obdo, __u64 cookie, 
              __u64 *fh, struct ptlrpc_request **request);
-int mdc_close(struct obd_conn *conn,
+int mdc_close(struct lustre_handle *conn,
               ino_t ino, int type, __u64 fh,  struct ptlrpc_request **req);
-int mdc_readpage(struct obd_conn *conn, ino_t ino,
+int mdc_readpage(struct lustre_handle *conn, ino_t ino,
                  int type, __u64 offset, char *addr, struct ptlrpc_request **);
-int mdc_create(struct obd_conn *conn,
+int mdc_create(struct lustre_handle *conn,
                struct inode *dir, const char *name, int namelen, 
                const char *tgt, int tgtlen, int mode, __u32 uid, __u32 gid,
                __u64 time, __u64 rdev, struct obdo *obdo,
                struct ptlrpc_request **);
-int mdc_unlink(struct obd_conn *conn,
+int mdc_unlink(struct lustre_handle *conn,
                struct inode *dir, struct inode *child, const char *name,
                int namelen, struct ptlrpc_request **);
-int mdc_link(struct obd_conn *conn,
+int mdc_link(struct lustre_handle *conn,
              struct dentry *src, struct inode *dir, const char *name,
              int namelen, struct ptlrpc_request **);
-int mdc_rename(struct obd_conn *conn,
+int mdc_rename(struct lustre_handle *conn,
                struct inode *src, struct inode *tgt, const char *old,
                int oldlen, const char *new, int newlen,
                struct ptlrpc_request **);
index 781191b..7e000e4 100644 (file)
@@ -203,7 +203,7 @@ struct ptlrpc_bulk_desc {
         struct ptlrpc_connection *b_connection;
         struct ptlrpc_client *b_client;
         __u32 b_portal;
-        struct obd_conn b_conn;
+        struct lustre_handle b_conn;
         void (*b_cb)(struct ptlrpc_bulk_desc *, void *);
         void *b_cb_data;
 
diff --git a/lustre/include/linux/lustre_req.h b/lustre/include/linux/lustre_req.h
deleted file mode 100644 (file)
index d726766..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
- *  Copyright (C) 2001 Cluster File Systems, Inc. <braam@clusterfs.com>
- *
- *   This file is part of Lustre, http://www.lustre.org.
- *
- *   Lustre is free software; you can redistribute it and/or
- *   modify it under the terms of version 2 of the GNU General Public
- *   License as published by the Free Software Foundation.
- *
- *   Lustre is distributed in the hope that it will be useful,
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *   GNU General Public License for more details.
- *
- *   You should have received a copy of the GNU General Public License
- *   along with Lustre; if not, write to the Free Software
- *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *   Definitions related to request handling
- */
-
-#ifndef __LUSTRE_REQ_H__
-#define __LUSTRE_REQ_H__
-
-struct lustre_connection { 
-       
-
-};
-
-#endif
index ee5af2d..aab618d 100644 (file)
@@ -22,6 +22,14 @@ struct obd_type {
         int  typ_refcnt;
 };
 
+
+/* Individual type definitions */
+
+struct ext2_obd {
+        struct super_block *e2_sb;
+        struct vfsmount *e2_vfsmnt;
+};
+
 #define OBD_RUN_CTXT_MAGIC      0xC0FFEEAA
 #define OBD_CTXT_DEBUG          /* development-only debugging */
 struct obd_run_ctxt {
@@ -33,21 +41,6 @@ struct obd_run_ctxt {
 #endif
 };
 
-
-
-struct obd_conn {
-        __u64 addr;
-        __u64 cookie;
-        struct obd_device *oc_dev;
-};
-
-/* Individual type definitions */
-
-struct ext2_obd {
-        struct super_block *e2_sb;
-        struct vfsmount *e2_vfsmnt;
-};
-
 struct filter_obd {
         char *fo_fstype;
         struct super_block *fo_sb;
@@ -86,7 +79,7 @@ struct mds_obd {
         struct ptlrpc_service *mds_service;
         struct ptlrpc_client *mds_ldlm_client; /* to be an LDLM client */
         struct ptlrpc_connection *mds_ldlm_conn; /* to be an LDLM client */
-        struct obd_conn mds_connh; /* to be one's on DLM client */
+        struct lustre_handle mds_connh; /* to be one's on DLM client */
 
         char *mds_fstype;
         struct super_block *mds_sb;
@@ -155,7 +148,7 @@ struct snap_obd {
 
 struct ost_obd {
         struct ptlrpc_service *ost_service;
-        struct obd_conn ost_conn;   /* the local connection to the OBD */
+        struct lustre_handle ost_conn;   /* the local connection to the OBD */
 };
 
 
@@ -170,7 +163,7 @@ struct lov_obd {
 
 #if 0
         int lov_count;
-        struct obd_conn *lov_targets;
+        struct lustre_handle *lov_targets;
 #endif
 };
 
@@ -186,7 +179,7 @@ struct obd_device {
         int obd_flags;
         struct proc_dir_entry *obd_proc_entry;
         int obd_multi_count;
-        struct obd_conn obd_multi_conn[MAX_MULTI];
+        struct lustre_handle obd_multi_conn[MAX_MULTI];
         unsigned int obd_gen_last_id;
         unsigned long obd_gen_prealloc_quota;
         //        struct obd_device *obd_target; /* for anything that simply layers */ 
@@ -212,57 +205,57 @@ struct obd_device {
 };
 
 struct obd_ops {
-        int (*o_iocontrol)(long cmd, struct obd_conn *, int len, void *karg,
+        int (*o_iocontrol)(long cmd, struct lustre_handle *, int len, void *karg,
                            void *uarg);
-        int (*o_get_info)(struct obd_conn *, obd_count keylen, void *key,
+        int (*o_get_info)(struct lustre_handle *, obd_count keylen, void *key,
                           obd_count *vallen, void **val);
-        int (*o_set_info)(struct obd_conn *, obd_count keylen, void *key,
+        int (*o_set_info)(struct lustre_handle *, obd_count keylen, void *key,
                           obd_count vallen, void *val);
         int (*o_attach)(struct obd_device *dev, obd_count len, void *data);
         int (*o_detach)(struct obd_device *dev);
         int (*o_setup) (struct obd_device *dev, obd_count len, void *data);
         int (*o_cleanup)(struct obd_device *dev);
-        int (*o_connect)(struct obd_conn *conn, struct obd_device *src);
-        int (*o_disconnect)(struct obd_conn *conn);
-
-
-        int (*o_statfs)(struct obd_conn *conn, struct statfs *statfs);
-        int (*o_preallocate)(struct obd_conn *, obd_count *req, obd_id *ids);
-        int (*o_create)(struct obd_conn *conn,  struct obdo *oa);
-        int (*o_destroy)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_setattr)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_getattr)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_open)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_close)(struct obd_conn *conn, struct obdo *oa);
-        int (*o_brw)(int rw, struct obd_conn *conn, obd_count num_oa,
+        int (*o_connect)(struct lustre_handle *conn, struct obd_device *src);
+        int (*o_disconnect)(struct lustre_handle *conn);
+
+
+        int (*o_statfs)(struct lustre_handle *conn, struct statfs *statfs);
+        int (*o_preallocate)(struct lustre_handle *, obd_count *req, obd_id *ids);
+        int (*o_create)(struct lustre_handle *conn,  struct obdo *oa);
+        int (*o_destroy)(struct lustre_handle *conn, struct obdo *oa);
+        int (*o_setattr)(struct lustre_handle *conn, struct obdo *oa);
+        int (*o_getattr)(struct lustre_handle *conn, struct obdo *oa);
+        int (*o_open)(struct lustre_handle *conn, struct obdo *oa);
+        int (*o_close)(struct lustre_handle *conn, struct obdo *oa);
+        int (*o_brw)(int rw, struct lustre_handle *conn, obd_count num_oa,
                      struct obdo **oa, obd_count *oa_bufs, struct page **buf,
                      obd_size *count, obd_off *offset, obd_flag *flags,
                      void *);
-        int (*o_punch)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
+        int (*o_punch)(struct lustre_handle *conn, struct obdo *tgt, obd_size count,
                        obd_off offset);
-        int (*o_sync)(struct obd_conn *conn, struct obdo *tgt, obd_size count,
+        int (*o_sync)(struct lustre_handle *conn, struct obdo *tgt, obd_size count,
                       obd_off offset);
-        int (*o_migrate)(struct obd_conn *conn, struct obdo *dst,
+        int (*o_migrate)(struct lustre_handle *conn, struct obdo *dst,
                          struct obdo *src, obd_size count, obd_off offset);
-        int (*o_copy)(struct obd_conn *dstconn, struct obdo *dst,
-                      struct obd_conn *srconn, struct obdo *src,
+        int (*o_copy)(struct lustre_handle *dstconn, struct obdo *dst,
+                      struct lustre_handle *srconn, struct obdo *src,
                       obd_size count, obd_off offset);
-        int (*o_iterate)(struct obd_conn *conn, int (*)(obd_id, obd_gr, void *),
+        int (*o_iterate)(struct lustre_handle *conn, int (*)(obd_id, obd_gr, void *),
                          obd_id *startid, obd_gr group, void *data);
-        int (*o_preprw)(int cmd, struct obd_conn *conn,
+        int (*o_preprw)(int cmd, struct lustre_handle *conn,
                         int objcount, struct obd_ioobj *obj,
                         int niocount, struct niobuf_remote *remote,
                         struct niobuf_local *local, void **desc_private);
-        int (*o_commitrw)(int cmd, struct obd_conn *conn,
+        int (*o_commitrw)(int cmd, struct lustre_handle *conn,
                           int objcount, struct obd_ioobj *obj,
                           int niocount, struct niobuf_local *local,
                           void *desc_private);
-        int (*o_enqueue)(struct obd_conn *conn,
+        int (*o_enqueue)(struct lustre_handle *conn,
                          struct lustre_handle *parent_lock, __u64 *res_id,
                          __u32 type, void *cookie, int cookielen, __u32 mode,
                          int *flags, void *cb, void *data, int datalen,
                          struct lustre_handle *lockh);
-        int (*o_cancel)(struct obd_conn *, __u32 mode, struct lustre_handle *);
+        int (*o_cancel)(struct lustre_handle *, __u32 mode, struct lustre_handle *);
 };
 
 #endif
index 9b477e0..3c93a8e 100644 (file)
@@ -41,6 +41,7 @@
 #include <linux/lustre_idl.h>
 #endif
 
+
 /*
  *  ======== OBD Device Declarations ===========
  */
@@ -66,8 +67,9 @@ extern void proc_lustre_remove_obd_entry(const char* name,
 #define OBD_BRW_CREATE  4
 
 #ifdef __KERNEL__
-extern struct obd_export *gen_client(struct obd_conn *conn);
-extern struct obd_device *gen_conn2obd(struct obd_conn *conn);
+extern struct obd_export *class_conn2export(struct lustre_handle *conn);
+extern struct obd_device *class_conn2obd(struct lustre_handle *conn);
+
 struct obd_export {
         __u64 export_cookie;
         struct lustre_handle export_import; /* client handle */ 
@@ -87,23 +89,14 @@ struct obd_import {
         void *import_data; /* device specific data */
 };
 
-
-struct obd_request {
-        struct obdo *oa;
-        struct obd_conn *conn;
-        __u32 plen1;
-        char *pbuf1;
-};
-
-
-static inline int obd_check_conn(struct obd_conn *conn) 
+static inline int obd_check_conn(struct lustre_handle *conn) 
 {
         struct obd_device *obd;
         if (!conn) {
                 CERROR("NULL conn\n");
                 RETURN(-ENOTCONN);
         }
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
         if (!obd) {
                 CERROR("NULL obd\n");
                 RETURN(-ENODEV);
@@ -143,7 +136,7 @@ do {                                                            \
                 RETURN(-EINVAL);                                \
         }                                                       \
                                                                 \
-        export = gen_client(conn);\
+        export = class_conn2export(conn);\
         if (!(export)) {                                \
                 CERROR("No export\n");                        \
                 RETURN(-EINVAL);                                \
@@ -179,7 +172,7 @@ do {                                                            \
         }                                                       \
 } while (0)
 
-static inline int obd_get_info(struct obd_conn *conn, obd_count keylen,
+static inline int obd_get_info(struct lustre_handle *conn, obd_count keylen,
                                void *key, obd_count *vallen, void **val)
 {
         int rc;
@@ -191,7 +184,7 @@ static inline int obd_get_info(struct obd_conn *conn, obd_count keylen,
         RETURN(rc);
 }
 
-static inline int obd_set_info(struct obd_conn *conn, obd_count keylen,
+static inline int obd_set_info(struct lustre_handle *conn, obd_count keylen,
                                void *key, obd_count vallen, void *val)
 {
         int rc;
@@ -224,7 +217,7 @@ static inline int obd_cleanup(struct obd_device *obd)
         RETURN(rc);
 }
 
-static inline int obd_create(struct obd_conn *conn, struct obdo *obdo)
+static inline int obd_create(struct lustre_handle *conn, struct obdo *obdo)
 {
         int rc;
         struct obd_export *export;
@@ -235,7 +228,7 @@ static inline int obd_create(struct obd_conn *conn, struct obdo *obdo)
         RETURN(rc);
 }
 
-static inline int obd_destroy(struct obd_conn *conn, struct obdo *obdo)
+static inline int obd_destroy(struct lustre_handle *conn, struct obdo *obdo)
 {
         int rc;
         struct obd_export *export;
@@ -246,7 +239,7 @@ static inline int obd_destroy(struct obd_conn *conn, struct obdo *obdo)
         RETURN(rc);
 }
 
-static inline int obd_getattr(struct obd_conn *conn, struct obdo *obdo)
+static inline int obd_getattr(struct lustre_handle *conn, struct obdo *obdo)
 {
         int rc;
         struct obd_export *export;
@@ -257,7 +250,7 @@ static inline int obd_getattr(struct obd_conn *conn, struct obdo *obdo)
         RETURN(rc);
 }
 
-static inline int obd_close(struct obd_conn *conn, struct obdo *obdo)
+static inline int obd_close(struct lustre_handle *conn, struct obdo *obdo)
 {
         int rc;
         struct obd_export *export;
@@ -267,7 +260,7 @@ static inline int obd_close(struct obd_conn *conn, struct obdo *obdo)
         rc = OBP(export->export_obd, close)(conn, obdo);
         RETURN(rc);
 }
-static inline int obd_open(struct obd_conn *conn, struct obdo *obdo)
+static inline int obd_open(struct lustre_handle *conn, struct obdo *obdo)
 {
         int rc;
         struct obd_export *export;
@@ -278,7 +271,7 @@ static inline int obd_open(struct obd_conn *conn, struct obdo *obdo)
         RETURN(rc);
 }
 
-static inline int obd_setattr(struct obd_conn *conn, struct obdo *obdo)
+static inline int obd_setattr(struct lustre_handle *conn, struct obdo *obdo)
 {
         int rc;
         struct obd_export *export;
@@ -289,7 +282,7 @@ static inline int obd_setattr(struct obd_conn *conn, struct obdo *obdo)
         RETURN(rc);
 }
 
-static inline int obd_connect(struct obd_conn *conn, struct obd_device *obd)
+static inline int obd_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         int rc;
         OBD_CHECK_DEVSETUP(obd);
@@ -299,7 +292,7 @@ static inline int obd_connect(struct obd_conn *conn, struct obd_device *obd)
         RETURN(rc);
 }
 
-static inline int obd_disconnect(struct obd_conn *conn)
+static inline int obd_disconnect(struct lustre_handle *conn)
 {
         int rc;
         struct obd_export *export;
@@ -310,7 +303,7 @@ static inline int obd_disconnect(struct obd_conn *conn)
         RETURN(rc);
 }
 
-static inline int obd_statfs(struct obd_conn *conn, struct statfs *buf)
+static inline int obd_statfs(struct lustre_handle *conn, struct statfs *buf)
 {
         int rc;
         struct obd_export *export;
@@ -321,7 +314,7 @@ static inline int obd_statfs(struct obd_conn *conn, struct statfs *buf)
         RETURN(rc);
 }
 
-static inline int obd_punch(struct obd_conn *conn, struct obdo *tgt,
+static inline int obd_punch(struct lustre_handle *conn, struct obdo *tgt,
                             obd_size count, obd_off offset)
 {
         int rc;
@@ -333,7 +326,7 @@ static inline int obd_punch(struct obd_conn *conn, struct obdo *tgt,
         RETURN(rc);
 }
 
-static inline int obd_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
+static inline int obd_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
                           struct obdo **oa, obd_count *oa_bufs,
                           struct page **buf, obd_size *count, obd_off *offset,
                           obd_flag *flags, void *callback)
@@ -353,7 +346,7 @@ static inline int obd_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
         RETURN(rc);
 }
 
-static inline int obd_preprw(int cmd, struct obd_conn *conn,
+static inline int obd_preprw(int cmd, struct lustre_handle *conn,
                              int objcount, struct obd_ioobj *obj,
                              int niocount, struct niobuf_remote *remote,
                              struct niobuf_local *local, void **desc_private)
@@ -368,7 +361,7 @@ static inline int obd_preprw(int cmd, struct obd_conn *conn,
         RETURN(rc);
 }
 
-static inline int obd_commitrw(int cmd, struct obd_conn *conn,
+static inline int obd_commitrw(int cmd, struct lustre_handle *conn,
                                int objcount, struct obd_ioobj *obj,
                                int niocount, struct niobuf_local *local,
                                void *desc_private)
@@ -383,7 +376,7 @@ static inline int obd_commitrw(int cmd, struct obd_conn *conn,
         RETURN(rc);
 }
 
-static inline int obd_iocontrol(int cmd, struct obd_conn *conn,
+static inline int obd_iocontrol(int cmd, struct lustre_handle *conn,
                                 int len, void *karg, void *uarg)
 {
         int rc;
@@ -395,7 +388,7 @@ static inline int obd_iocontrol(int cmd, struct obd_conn *conn,
         RETURN(rc);
 }
 
-static inline int obd_enqueue(struct obd_conn *conn,
+static inline int obd_enqueue(struct lustre_handle *conn,
                               struct lustre_handle *parent_lock, __u64 *res_id,
                               __u32 type, void *cookie, int cookielen,
                               __u32 mode, int *flags, void *cb, void *data,
@@ -412,7 +405,7 @@ static inline int obd_enqueue(struct obd_conn *conn,
         RETURN(rc);
 }
 
-static inline int obd_cancel(struct obd_conn *conn, __u32 mode,
+static inline int obd_cancel(struct lustre_handle *conn, __u32 mode,
                              struct lustre_handle *lockh)
 {
         int rc;
@@ -433,23 +426,15 @@ static inline int obd_cancel(struct obd_conn *conn, __u32 mode,
 extern int obd_init_caches(void);
 extern void obd_cleanup_caches(void);
 
-
 static inline int obdo_has_inline(struct obdo *obdo)
 {
         return (obdo->o_valid & OBD_MD_FLINLINE &&
                 obdo->o_obdflags & OBD_FL_INLINEDATA);
 };
 
-static inline int obdo_has_obdmd(struct obdo *obdo)
-{
-        return (obdo->o_valid & OBD_MD_FLOBDMD &&
-                obdo->o_obdflags & OBD_FL_OBDMDEXISTS);
-};
-
 #ifdef __KERNEL__
 /* support routines */
 extern kmem_cache_t *obdo_cachep;
-
 static __inline__ struct obdo *obdo_alloc(void)
 {
         struct obdo *oa = NULL;
@@ -461,7 +446,6 @@ static __inline__ struct obdo *obdo_alloc(void)
 
         return oa;
 }
-
 static __inline__ void obdo_free(struct obdo *oa)
 {
         if (!oa)
@@ -469,27 +453,6 @@ static __inline__ void obdo_free(struct obdo *oa)
         kmem_cache_free(obdo_cachep, oa);
 }
 
-static __inline__ struct obdo *obdo_fromid(struct obd_conn *conn, obd_id id,
-                                           obd_mode mode, obd_flag valid)
-{
-        struct obdo *oa;
-        int err;
-
-        ENTRY;
-        oa = obdo_alloc();
-        if ( !oa ) {
-                RETURN(ERR_PTR(-ENOMEM));
-        }
-
-        oa->o_id = id;
-        oa->o_mode = mode;
-        oa->o_valid = valid;
-        if ((err = obd_getattr(conn, oa))) {
-                obdo_free(oa);
-                RETURN(ERR_PTR(err));
-        }
-        RETURN(oa);
-}
 
 static inline void obdo_from_iattr(struct obdo *oa, struct iattr *attr)
 {
@@ -720,29 +683,18 @@ static __inline__ int obdo_cmp_md(struct obdo *dst, struct obdo *src,
 
 
 #ifdef __KERNEL__
-int obd_register_type(struct obd_ops *ops, char *nm);
-int obd_unregister_type(char *nm);
-int obd_class_name2dev(char *name);
-int obd_class_uuid2dev(char *name);
-
-
-struct obd_prealloc_inode {
-        struct list_head obd_prealloc_chain;
-        unsigned long inode;
-};
+int class_register_type(struct obd_ops *ops, char *nm);
+int class_unregister_type(char *nm);
+int class_name2dev(char *name);
+int class_uuid2dev(char *name);
+int class_connect (struct lustre_handle *conn, struct obd_device *obd);
+int class_disconnect(struct lustre_handle *conn);
+struct obd_export *class_conn2export(struct lustre_handle *);
 
 /* generic operations shared by various OBD types */
-int gen_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
-int gen_multi_cleanup(struct obd_device *obddev);
-int gen_multi_attach(struct obd_device *obddev, uint32_t len, void *data);
-int gen_multi_detach(struct obd_device *obddev);
-int gen_connect (struct obd_conn *conn, struct obd_device *obd);
-int gen_disconnect(struct obd_conn *conn);
-struct obd_export *gen_client(struct obd_conn *);
-int gen_cleanup(struct obd_device *obddev);
-int gen_copy_data(struct obd_conn *dst_conn, struct obdo *dst,
-                  struct obd_conn *src_conn, struct obdo *src,
-                  obd_size count, obd_off offset);
+int class_multi_setup(struct obd_device *obddev, uint32_t len, void *data);
+int class_multi_cleanup(struct obd_device *obddev);
+
 
 #endif
 
diff --git a/lustre/include/linux/obd_raid1.h b/lustre/include/linux/obd_raid1.h
deleted file mode 100644 (file)
index 97aa870..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _OBD_RAID1
-#define _OBD_RAID1
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <linux/obd_class.h>
-
-#define MAX_RAID1 16
-
-#ifndef OBD_RAID1_DEVICENAME
-#define OBD_RAID1_DEVICENAME "obdraid1"
-#endif
-
-/* development definitions */
-extern struct obdfs_sb_info *obd_sbi;
-extern struct file_operations *obd_fso;
-
-/* obd_raid1.c */
-extern struct obd_ops raid1_obd_ops;
-inline long ext2_block_map (struct inode * inode, long block);
-
-#endif
diff --git a/lustre/include/linux/obd_rpc.h b/lustre/include/linux/obd_rpc.h
deleted file mode 100644 (file)
index e0847bc..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-#ifndef __OBD_RPC_H
-#define __OBD_RPC_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-#include <linux/sunrpc/svc.h>
-#define OBD_TGT_VERSION  001
-
-#define OBD_TGT_TCP  0x1
-#define OBD_TGT_INTR 0x2
-#define OBD_TGT_SOFT 0x4
-
-
-/* generic wrappable next */
-
-#define NEXT_INDEX(index, max)                                 \
-       (((index + 1) >= max) ? 0 : (index + 1))
-
-
-/* error codes */
-
-enum obd_stat {
- OBD_OK = 0,
- OBDERR_PERM = 1, 
- OBDERR_NOENT = 2,
- OBDERR_IO = 5,
- OBDERR_NXIO = 6,
- OBDERR_ACCESS = 13,
- OBDERR_EXIST = 17,
- OBDERR_XDEV = 18, 
- OBDERR_NODEV = 19,
- OBDERR_INVAL = 22,
- OBDERR_FBIG = 27,
- OBDERR_NOSPC = 28,
- OBDERR_ROFS = 30,
- OBDERR_OPNOTSUPP = 45,
- OBDERR_DQUOT = 69
-};
-
-
-extern struct rpc_program obd_program;
-
-
-struct obd_target {
-        struct sockaddr_in tgt_addr;
-        int tgt_flags;
-        int tgt_timeo;
-        int tgt_retrans;
-        int tgt_hostnamelen;
-        char tgt_hostname[0];
-        
-};
-
-
-struct rpc_obd {
-        struct rpc_clnt *       handle;         /* RPC client handle */
-        struct sockaddr_in      addr;
-        int                     flags;          /* various flags */
-        int                     timeo;
-        int                     retrans;
-        int                     rsize;          /* read size */
-        int                     wsize;          /* write size */
-        unsigned int            bsize;          /* server block size */
-        char *                  hostname;       /* remote hostname */
-};
-
-
-#define OBD_PROGRAM             300001
-#define OBD_VERSION             1
-#define OBDPROC_NULL            0
-#define OBDPROC_ECHOINT         1
-
-#ifdef  OBD_NEED_XDR_TYPES
-
-struct obd_echoint_in {
-        __u32                   in;
-};
-
-struct obd_echoint_out {
-        __u32                   out;
-};
-
-
-#endif /* OBD_NEED_XDR_TYPES */
-
-
-int obd_proc_echoint(struct rpc_obd *target, __u32 in, __u32 *out);
-
-
-#endif
index e7dd012..bd8ca7b 100644 (file)
@@ -60,8 +60,8 @@ struct snap_table {
 };
 
 struct snap_iterdata {
-       struct obd_conn *conn;
-       struct obd_conn *ch_conn;
+       struct lustre_handle *conn;
+       struct lustre_handle *ch_conn;
        int index;
        int previndex;
        int currentindex;
@@ -69,11 +69,11 @@ struct snap_iterdata {
        time_t prevtime;
 };
 
-inline struct obd_conn *child_conn(struct obd_conn *conn);
+inline struct lustre_handle *child_conn(struct lustre_handle *conn);
 int snap_deleteobj(obd_id id, obd_gr group, void *data);
 int snap_restoreobj(obd_id id, obd_gr group, void *data);
 int snap_printobj(obd_id id, obd_gr group, void *data);
-int snap_iocontrol(int cmd, struct obd_conn *conn, int len, void *karg, void *uarg);
+int snap_iocontrol(int cmd, struct lustre_handle *conn, int len, void *karg, void *uarg);
 
 /* In the future, this function may have to deal with offsets into the obdmd.
  * Currently, we assume we have the whole obdmd struct.
index 4e68938..27e6dc9 100644 (file)
 #ifndef _OBDFS_H
 #define _OBDFS_H
 #include <linux/obd_class.h>
-#include <linux/obdo.h>
 #include <linux/list.h>
 
+static __inline__ struct obdo *obdo_fromid(struct lustre_handle *conn, obd_id id,
+                                           obd_mode mode, obd_flag valid)
+{
+        struct obdo *oa;
+        int err;
+
+        ENTRY;
+        oa = obdo_alloc();
+        if ( !oa ) {
+                RETURN(ERR_PTR(-ENOMEM));
+        }
+
+        oa->o_id = id;
+        oa->o_mode = mode;
+        oa->o_valid = valid;
+        if ((err = obd_getattr(conn, oa))) {
+                obdo_free(oa);
+                RETURN(ERR_PTR(err));
+        }
+        RETURN(oa);
+}
+
+
+struct obdfs_inode_info {
+        int              oi_flags;
+        struct list_head oi_inodes;
+        struct list_head oi_pages;
+        char             oi_inline[OBD_INLINESZ];
+};
+
+struct obdfs_sb_info {
+        struct list_head         osi_list;      /* list of supers */
+        struct lustre_handle          osi_conn;
+        struct super_block      *osi_super;
+        struct obd_device       *osi_obd;
+        ino_t                    osi_rootino;   /* number of root inode */
+        int                      osi_minor;     /* minor of /dev/obdX */
+        struct list_head         osi_inodes;    /* list of dirty inodes */
+        unsigned long            osi_cache_count;
+        struct semaphore         osi_list_mutex;
+};
+
+
+static inline struct obdfs_inode_info *obdfs_i2info(struct inode *inode)
+{
+        return (struct obdfs_inode_info *)&(inode->u.generic_ip);
+}
+
+static inline int obdfs_has_inline(struct inode *inode)
+{
+        return (obdfs_i2info(inode)->oi_flags & OBD_FL_INLINEDATA);
+}
+
+static void inline obdfs_from_inode(struct obdo *oa, struct inode *inode)
+{
+        struct obdfs_inode_info *oinfo = obdfs_i2info(inode);
+
+        CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
+               inode->i_ino, (long)oa->o_id, oa->o_valid);
+        obdo_from_inode(oa, inode);
+       if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
+                CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
+                      inode->i_rdev);
+               *((obd_rdev *)oa->o_inline) = kdev_t_to_nr(inode->i_rdev);
+                oa->o_obdflags |= OBD_FL_INLINEDATA;
+                oa->o_valid |= OBD_MD_FLINLINE;
+       } else if (obdfs_has_inline(inode)) {
+                CDEBUG(D_INODE, "copying inline data from inode to obdo\n");
+                memcpy(oa->o_inline, oinfo->oi_inline, OBD_INLINESZ);
+                oa->o_obdflags |= OBD_FL_INLINEDATA;
+                oa->o_valid |= OBD_MD_FLINLINE;
+        }
+} /* obdfs_from_inode */
+
+static void inline obdfs_to_inode(struct inode *inode, struct obdo *oa)
+{
+        struct obdfs_inode_info *oinfo = obdfs_i2info(inode);
+
+        CDEBUG(D_INFO, "src obdo %ld valid 0x%08x, dst inode %ld\n",
+               (long)oa->o_id, oa->o_valid, inode->i_ino);
+
+        obdo_to_inode(inode, oa);
+
+        if (obdo_has_inline(oa)) {
+               if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
+                   S_ISFIFO(inode->i_mode)) {
+                       obd_rdev rdev = *((obd_rdev *)oa->o_inline);
+                       CDEBUG(D_INODE,
+                              "copying device %x from obdo to inode\n", rdev);
+                       init_special_inode(inode, inode->i_mode, rdev);
+               } else {
+                       CDEBUG(D_INFO, "copying inline from obdo to inode\n");
+                       memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
+               }
+                oinfo->oi_flags |= OBD_FL_INLINEDATA;
+        }
+} /* obdfs_to_inode */
+
+#define NOLOCK 0
+#define LOCKED 1
+
+#ifdef OPS
+#warning "*** WARNING redefining OPS"
+#else
+#define OPS(sb,op) ((struct obdfs_sb_info *)(& (sb)->u.generic_sbp))->osi_ops->o_ ## op
+#define IOPS(inode,op) ((struct obdfs_sb_info *)(&(inode)->i_sb->u.generic_sbp))->osi_ops->o_ ## op
+#endif
+
+#ifdef ID
+#warning "*** WARNING redefining ID"
+#else
+#define ID(sb) (&((struct obdfs_sb_info *)( &(sb)->u.generic_sbp))->osi_conn)
+#define IID(inode) (&((struct obdfs_sb_info *)( &(inode)->i_sb->u.generic_sbp))->osi_conn)
+#endif
+
+#define OBDFS_SUPER_MAGIC 0x4711
+
 /* super.c */ 
 struct obdfs_pgrq {
         struct list_head         rq_plist;      /* linked list of req's */
@@ -108,58 +224,5 @@ static void inline obdfs_set_size (struct inode *inode, obd_size size)
                inode->i_sb->s_blocksize_bits;
 } /* obdfs_set_size */
 
-
-#if 0   /* PAGE CACHE DISABLED */
-
-#define obd_down(mutex) {                                               \
-        /* CDEBUG(D_INFO, "get lock\n"); */                             \
-        obdfs_mutex_start = jiffies;                                    \
-        down(mutex);                                                    \
-        if (jiffies - obdfs_mutex_start)                                \
-                CDEBUG(D_CACHE, "waited on mutex %ld jiffies\n",        \
-                       jiffies - obdfs_mutex_start);                    \
-}
-
-#define obd_up(mutex) {                                                 \
-        up(mutex);                                                      \
-        if (jiffies - obdfs_mutex_start > 1)                            \
-                CDEBUG(D_CACHE, "held mutex for %ld jiffies\n",         \
-                       jiffies - obdfs_mutex_start);                    \
-        /* CDEBUG(D_INFO, "free lock\n"); */                            \
-}
-
-/* We track if a page has been added to the OBD page cache by stting a
- * flag on the page.  We have chosen a bit that will hopefully not be
- * used for a while.
- */
-#define PG_obdcache 29
-#define OBDAddCachePage(page)   test_and_set_bit(PG_obdcache, &(page)->flags)
-#define OBDClearCachePage(page) clear_bit(PG_obdcache, &(page)->flags)
-
-static inline void obdfs_print_plist(struct inode *inode) 
-{
-        struct list_head *page_list = obdfs_iplist(inode);
-        struct list_head *tmp;
-
-        CDEBUG(D_INFO, "inode %ld: page", inode->i_ino);
-        /* obd_down(&obdfs_i2sbi(inode)->osi_list_mutex); */
-        if (list_empty(page_list)) {
-                CDEBUG(D_INFO, " list empty\n");
-                obd_up(&obdfs_i2sbi(inode)->osi_list_mutex);
-                return;
-        }
-
-        tmp = page_list;
-        while ( (tmp = tmp->next) != page_list) {
-                struct obdfs_pgrq *pgrq;
-                pgrq = list_entry(tmp, struct obdfs_pgrq, rq_plist);
-                CDEBUG(D_INFO, " %p", pgrq->rq_page);
-        }
-        CDEBUG(D_INFO, "\n");
-        /* obd_up(&obdfs_i2sbi(inode)->osi_list_mutex); */
-}
-#endif
-
-
 #endif
 
diff --git a/lustre/include/linux/obdo.h b/lustre/include/linux/obdo.h
deleted file mode 100644 (file)
index 4255482..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef OBD_H
-#define OBD_H
-/*
- * Copyright (C) 2001  Cluster File Systems, Inc.
- *
- * This code is issued under the GNU General Public License.
- * See the file COPYING in this distribution
- */
-
-struct obdfs_inode_info {
-        int              oi_flags;
-        struct list_head oi_inodes;
-        struct list_head oi_pages;
-        char             oi_inline[OBD_INLINESZ];
-};
-
-struct obdfs_sb_info {
-        struct list_head         osi_list;      /* list of supers */
-        struct obd_conn          osi_conn;
-        struct super_block      *osi_super;
-        struct obd_device       *osi_obd;
-        ino_t                    osi_rootino;   /* number of root inode */
-        int                      osi_minor;     /* minor of /dev/obdX */
-        struct list_head         osi_inodes;    /* list of dirty inodes */
-        unsigned long            osi_cache_count;
-        struct semaphore         osi_list_mutex;
-};
-
-
-static inline struct obdfs_inode_info *obdfs_i2info(struct inode *inode)
-{
-        return (struct obdfs_inode_info *)&(inode->u.generic_ip);
-}
-
-static inline int obdfs_has_inline(struct inode *inode)
-{
-        return (obdfs_i2info(inode)->oi_flags & OBD_FL_INLINEDATA);
-}
-
-static void inline obdfs_from_inode(struct obdo *oa, struct inode *inode)
-{
-        struct obdfs_inode_info *oinfo = obdfs_i2info(inode);
-
-        CDEBUG(D_INFO, "src inode %ld, dst obdo %ld valid 0x%08x\n",
-               inode->i_ino, (long)oa->o_id, oa->o_valid);
-        obdo_from_inode(oa, inode);
-       if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) {
-                CDEBUG(D_INODE, "copying device %x from inode to obdo\n",
-                      inode->i_rdev);
-               *((obd_rdev *)oa->o_inline) = kdev_t_to_nr(inode->i_rdev);
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-       } else if (obdfs_has_inline(inode)) {
-                CDEBUG(D_INODE, "copying inline data from inode to obdo\n");
-                memcpy(oa->o_inline, oinfo->oi_inline, OBD_INLINESZ);
-                oa->o_obdflags |= OBD_FL_INLINEDATA;
-                oa->o_valid |= OBD_MD_FLINLINE;
-        }
-} /* obdfs_from_inode */
-
-static void inline obdfs_to_inode(struct inode *inode, struct obdo *oa)
-{
-        struct obdfs_inode_info *oinfo = obdfs_i2info(inode);
-
-        CDEBUG(D_INFO, "src obdo %ld valid 0x%08x, dst inode %ld\n",
-               (long)oa->o_id, oa->o_valid, inode->i_ino);
-
-        obdo_to_inode(inode, oa);
-
-        if (obdo_has_inline(oa)) {
-               if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode) ||
-                   S_ISFIFO(inode->i_mode)) {
-                       obd_rdev rdev = *((obd_rdev *)oa->o_inline);
-                       CDEBUG(D_INODE,
-                              "copying device %x from obdo to inode\n", rdev);
-                       init_special_inode(inode, inode->i_mode, rdev);
-               } else {
-                       CDEBUG(D_INFO, "copying inline from obdo to inode\n");
-                       memcpy(oinfo->oi_inline, oa->o_inline, OBD_INLINESZ);
-               }
-                oinfo->oi_flags |= OBD_FL_INLINEDATA;
-        }
-} /* obdfs_to_inode */
-
-#define NOLOCK 0
-#define LOCKED 1
-
-#ifdef OPS
-#warning "*** WARNING redefining OPS"
-#else
-#define OPS(sb,op) ((struct obdfs_sb_info *)(& (sb)->u.generic_sbp))->osi_ops->o_ ## op
-#define IOPS(inode,op) ((struct obdfs_sb_info *)(&(inode)->i_sb->u.generic_sbp))->osi_ops->o_ ## op
-#endif
-
-#ifdef ID
-#warning "*** WARNING redefining ID"
-#else
-#define ID(sb) (&((struct obdfs_sb_info *)( &(sb)->u.generic_sbp))->osi_conn)
-#define IID(inode) (&((struct obdfs_sb_info *)( &(inode)->i_sb->u.generic_sbp))->osi_conn)
-#endif
-
-#define OBDFS_SUPER_MAGIC 0x4711
-
-#endif
index 496488f..381c755 100644 (file)
@@ -324,10 +324,10 @@ out:
         return 0;
 }
 
-static int ldlm_iocontrol(long cmd, struct obd_conn *conn, int len, void *karg,
+static int ldlm_iocontrol(long cmd, struct lustre_handle *conn, int len, void *karg,
                           void *uarg)
 {
-        struct obd_device *obddev = gen_conn2obd(conn);
+        struct obd_device *obddev = class_conn2obd(conn);
         struct ptlrpc_connection *connection;
         int err;
         ENTRY;
@@ -425,14 +425,14 @@ struct obd_ops ldlm_obd_ops = {
         o_iocontrol:   ldlm_iocontrol,
         o_setup:       ldlm_setup,
         o_cleanup:     ldlm_cleanup,
-        o_connect:     gen_connect,
-        o_disconnect:  gen_disconnect
+        o_connect:     class_connect,
+        o_disconnect:  class_disconnect
 };
 
 
 static int __init ldlm_init(void)
 {
-        int rc = obd_register_type(&ldlm_obd_ops, OBD_LDLM_DEVICENAME);
+        int rc = class_register_type(&ldlm_obd_ops, OBD_LDLM_DEVICENAME);
         if (rc != 0)
                 return rc;
 
@@ -455,7 +455,7 @@ static int __init ldlm_init(void)
 
 static void __exit ldlm_exit(void)
 {
-        obd_unregister_type(OBD_LDLM_DEVICENAME);
+        class_unregister_type(OBD_LDLM_DEVICENAME);
         if (kmem_cache_destroy(ldlm_resource_slab) != 0)
                 CERROR("couldn't free ldlm resource slab\n");
         if (kmem_cache_destroy(ldlm_lock_slab) != 0)
index 488eb95..a76605f 100644 (file)
@@ -43,7 +43,7 @@ int target_handle_connect(struct ptlrpc_request *req)
 {
         struct obd_device *target;
         struct obd_export *export;
-        struct obd_conn conn;
+        struct lustre_handle conn;
         char *uuid;
         int rc, i;
         ENTRY;
@@ -55,7 +55,7 @@ int target_handle_connect(struct ptlrpc_request *req)
                 RETURN(-EINVAL);
         }
 
-        i = obd_class_uuid2dev(uuid);
+        i = class_uuid2dev(uuid);
         if (i == -1) {
                 req->rq_status = -ENODEV;
                 RETURN(-NODEV);
@@ -78,7 +78,7 @@ int target_handle_connect(struct ptlrpc_request *req)
         req->rq_repmsg->addr = conn.addr;
         req->rq_repmsg->cookie = conn.cookie;
 
-        export = gen_client(&conn); 
+        export = class_conn2export(&conn); 
         if (!export)
                 LBUG();
 
@@ -90,7 +90,7 @@ int target_handle_connect(struct ptlrpc_request *req)
 
 int target_handle_disconnect(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         int rc;
         ENTRY;
 
index bb5df34..b5d1054 100644 (file)
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
 
 /* obd methods */
-static int lov_connect(struct obd_conn *conn)
+static int lov_connect(struct lustre_handle *conn)
 {
         int rc;
 
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn);
+        rc = class_connect(conn);
 
         if (rc)
                 MOD_DEC_USE_COUNT;
@@ -33,11 +33,11 @@ static int lov_connect(struct obd_conn *conn)
         return rc;
 }
 
-static int lov_disconnect(struct obd_conn *conn)
+static int lov_disconnect(struct lustre_handle *conn)
 {
         int rc;
 
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
@@ -45,24 +45,24 @@ static int lov_disconnect(struct obd_conn *conn)
         return rc;
 }
 
-static int lov_getattr(struct obd_conn *conn, struct obdo *oa)
+static int lov_getattr(struct lustre_handle *conn, struct obdo *oa)
 {
         int rc;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         rc = obd_getattr(&conn->oc_dev->obd_multi_conn[0], oa);
         RETURN(rc);
 }
 
-static int lov_setattr(struct obd_conn *conn, struct obdo *oa)
+static int lov_setattr(struct lustre_handle *conn, struct obdo *oa)
 {
         int rc, retval, i;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         for (i = 0; i < conn->oc_dev->obd_multi_count; i++) {
@@ -76,12 +76,12 @@ static int lov_setattr(struct obd_conn *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int lov_open(struct obd_conn *conn, struct obdo *oa)
+static int lov_open(struct lustre_handle *conn, struct obdo *oa)
 {
         int rc, retval, i;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         for (i = 0; i < conn->oc_dev->obd_multi_count; i++) {
@@ -95,12 +95,12 @@ static int lov_open(struct obd_conn *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int lov_close(struct obd_conn *conn, struct obdo *oa)
+static int lov_close(struct lustre_handle *conn, struct obdo *oa)
 {
         int rc, retval, i;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         for (i = 0; i < conn->oc_dev->obd_multi_count; i++) {
@@ -114,14 +114,14 @@ static int lov_close(struct obd_conn *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int lov_create(struct obd_conn *conn, struct obdo *oa)
+static int lov_create(struct lustre_handle *conn, struct obdo *oa)
 {
         int rc, retval, i, offset;
         struct obdo tmp;
         struct lov_md md;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         md.lmd_object_id = oa->o_id;
@@ -148,7 +148,7 @@ static int lov_create(struct obd_conn *conn, struct obdo *oa)
         return rc;
 }
 
-static int lov_destroy(struct obd_conn *conn, struct obdo *oa)
+static int lov_destroy(struct lustre_handle *conn, struct obdo *oa)
 {
         int rc, retval, i, offset;
         struct obdo tmp;
@@ -156,7 +156,7 @@ static int lov_destroy(struct obd_conn *conn, struct obdo *oa)
         struct lov_object_id lov_id;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         md = (struct lov_md *)oa->o_inline;
@@ -185,13 +185,13 @@ static int lov_destroy(struct obd_conn *conn, struct obdo *oa)
 /* FIXME: maybe we'll just make one node the authoritative attribute node, then
  * we can send this 'punch' to just the authoritative node and the nodes
  * that the punch will affect. */
-static int lov_punch(struct obd_conn *conn, struct obdo *oa,
+static int lov_punch(struct lustre_handle *conn, struct obdo *oa,
                      obd_size count, obd_off offset)
 {
         int rc, retval, i;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         for (i = 0; i < conn->oc_dev->obd_multi_count; i++) {
@@ -234,7 +234,7 @@ static int lov_read_check_status(struct lov_callback_data *cb_data)
 }
 
 /* buffer must lie in user memory here */
-static int lov_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
+static int lov_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
                    struct obdo **oa,
                    obd_count *oa_bufs, struct page **buf,
                    obd_size *count, obd_off *offset, obd_flag *flags,
@@ -249,7 +249,7 @@ static int lov_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
         if (num_oa != 1)
                 LBUG();
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         OBD_ALLOC(cb_data, sizeof(*cb_data));
@@ -319,7 +319,7 @@ static void lov_write_finished(struct ptlrpc_bulk_desc *desc, void *data)
 }
 
 /* buffer must lie in user memory here */
-static int filter_write(struct obd_conn *conn, struct obdo *oa, char *buf,
+static int filter_write(struct lustre_handle *conn, struct obdo *oa, char *buf,
                          obd_size *count, obd_off offset)
 {
         int err;
@@ -327,7 +327,7 @@ static int filter_write(struct obd_conn *conn, struct obdo *oa, char *buf,
         unsigned long retval;
 
         ENTRY;
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CDEBUG(D_IOCTL, "invalid client %u\n", conn->oc_id);
                 EXIT;
                 return -EINVAL;
@@ -356,7 +356,7 @@ static int filter_write(struct obd_conn *conn, struct obdo *oa, char *buf,
         return err;
 }
 
-static int lov_enqueue(struct obd_conn *conn, struct ldlm_namespace *ns,
+static int lov_enqueue(struct lustre_handle *conn, struct ldlm_namespace *ns,
                        struct ldlm_handle *parent_lock, __u64 *res_id,
                        __u32 type, struct ldlm_extent *extent, __u32 mode,
                        int *flags, void *data, int datalen,
@@ -365,7 +365,7 @@ static int lov_enqueue(struct obd_conn *conn, struct ldlm_namespace *ns,
         int rc;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         rc = obd_enqueue(&conn->oc_dev->obd_multi_conn[0], ns, parent_lock,
@@ -374,13 +374,13 @@ static int lov_enqueue(struct obd_conn *conn, struct ldlm_namespace *ns,
         RETURN(rc);
 }
 
-static int lov_cancel(struct obd_conn *conn, __u32 mode,
+static int lov_cancel(struct lustre_handle *conn, __u32 mode,
                       struct ldlm_handle *lockh)
 {
         int rc;
         ENTRY;
 
-        if (!gen_client(conn))
+        if (!class_conn2export(conn))
                 RETURN(-EINVAL);
 
         rc = obd_cancel(&conn->oc_dev->obd_multi_conn[0], oa);
@@ -389,8 +389,8 @@ static int lov_cancel(struct obd_conn *conn, __u32 mode,
 #endif
 
 struct obd_ops lov_obd_ops = {
-        o_setup:       gen_multi_setup,
-        o_cleanup:     gen_multi_cleanup,
+        o_setup:       class_multi_setup,
+        o_cleanup:     class_multi_cleanup,
         o_create:      lov_create,
         o_connect:     lov_connect,
         o_disconnect:  lov_disconnect,
@@ -414,12 +414,12 @@ static int __init lov_init(void)
 {
         printk(KERN_INFO "Lustre Logical Object Volume driver " LOV_VERSION
                ", phil@clusterfs.com\n");
-        return obd_register_type(&lov_obd_ops, OBD_LOV_DEVICENAME);
+        return class_register_type(&lov_obd_ops, OBD_LOV_DEVICENAME);
 }
 
 static void __exit lov_exit(void)
 {
-        obd_unregister_type(OBD_LOV_DEVICENAME);
+        class_unregister_type(OBD_LOV_DEVICENAME);
 }
 
 MODULE_AUTHOR("Phil Schwan <phil@clusterfs.com>");
index 61713b8..8cdd92c 100644 (file)
@@ -45,7 +45,7 @@ static int mdc_reint(struct ptlrpc_request *request, int level)
         return rc;
 }
 
-int mdc_setattr(struct obd_conn *conn,
+int mdc_setattr(struct lustre_handle *conn,
                 struct inode *inode, struct iattr *iattr,
                 struct ptlrpc_request **request)
 {
@@ -73,7 +73,7 @@ int mdc_setattr(struct obd_conn *conn,
         RETURN(rc);
 }
 
-int mdc_create(struct obd_conn *conn,
+int mdc_create(struct lustre_handle *conn,
                struct inode *dir, const char *name, int namelen,
                const char *tgt, int tgtlen, int mode, __u32 uid,
                __u32 gid, __u64 time, __u64 rdev, struct obdo *obdo,
@@ -134,7 +134,7 @@ int mdc_create(struct obd_conn *conn,
         RETURN(rc);
 }
 
-int mdc_unlink(struct obd_conn *conn,
+int mdc_unlink(struct lustre_handle *conn,
                struct inode *dir, struct inode *child, const char *name,
                int namelen, struct ptlrpc_request **request)
 {
@@ -161,7 +161,7 @@ int mdc_unlink(struct obd_conn *conn,
         RETURN(rc);
 }
 
-int mdc_link(struct obd_conn *conn,
+int mdc_link(struct lustre_handle *conn,
              struct dentry *src, struct inode *dir, const char *name,
              int namelen, struct ptlrpc_request **request)
 {
@@ -188,7 +188,7 @@ int mdc_link(struct obd_conn *conn,
         RETURN(rc);
 }
 
-int mdc_rename(struct obd_conn *conn,
+int mdc_rename(struct lustre_handle *conn,
                struct inode *src, struct inode *tgt, const char *old,
                int oldlen, const char *new, int newlen,
                struct ptlrpc_request **request)
index 996c1de..b9b672f 100644 (file)
@@ -34,7 +34,7 @@
 extern int mds_queue_req(struct ptlrpc_request *);
 
 
-int mdc_getstatus(struct obd_conn *conn, struct ll_fid *rootfid,
+int mdc_getstatus(struct lustre_handle *conn, struct ll_fid *rootfid,
                   __u64 *last_committed, __u64 *last_rcvd,
                   __u32 *last_xid, struct ptlrpc_request **request)
 {
@@ -80,7 +80,7 @@ int mdc_getstatus(struct obd_conn *conn, struct ll_fid *rootfid,
 }
 
 
-int mdc_getattr(struct obd_conn *conn,
+int mdc_getattr(struct lustre_handle *conn,
                 ino_t ino, int type, unsigned long valid, size_t ea_size,
                 struct ptlrpc_request **request)
 {
@@ -159,13 +159,13 @@ static int mdc_lock_callback(struct lustre_handle *lockh, struct ldlm_lock_desc
         RETURN(0);
 }
 
-int mdc_enqueue(struct obd_conn *conn, int lock_type, struct lookup_intent *it, 
+int mdc_enqueue(struct lustre_handle *conn, int lock_type, struct lookup_intent *it, 
                 int lock_mode, struct inode *dir, struct dentry *de,
                 struct lustre_handle *lockh, __u64 id, char *tgt, int tgtlen,
                 void *data, int datalen)
 {
         struct ptlrpc_request *req;
-        struct obd_device *obddev = gen_conn2obd(conn);
+        struct obd_device *obddev = class_conn2obd(conn);
         struct mdc_obd *mdc = mdc_conn2mdc(conn);
         __u64 res_id[RES_NAME_SIZE] = {dir->i_ino};
         int size[5] = {sizeof(struct ldlm_request), sizeof(struct ldlm_intent)};
@@ -354,7 +354,7 @@ int mdc_enqueue(struct obd_conn *conn, int lock_type, struct lookup_intent *it,
         RETURN(0);
 }
 
-int mdc_open(struct obd_conn *conn, ino_t ino, int type, int flags,
+int mdc_open(struct lustre_handle *conn, ino_t ino, int type, int flags,
              struct obdo *obdo,
              __u64 cookie, __u64 *fh, struct ptlrpc_request **request)
 {
@@ -402,7 +402,7 @@ int mdc_open(struct obd_conn *conn, ino_t ino, int type, int flags,
         return rc;
 }
 
-int mdc_close(struct obd_conn *conn, 
+int mdc_close(struct lustre_handle *conn, 
               ino_t ino, int type, __u64 fh, struct ptlrpc_request **request)
 {
         struct mdc_obd *mdc = mdc_conn2mdc(conn);
@@ -431,7 +431,7 @@ int mdc_close(struct obd_conn *conn,
         return rc;
 }
 
-int mdc_readpage(struct obd_conn *conn, ino_t ino, int type, __u64 offset,
+int mdc_readpage(struct lustre_handle *conn, ino_t ino, int type, __u64 offset,
                  char *addr, struct ptlrpc_request **request)
 {
         struct mdc_obd *mdc = mdc_conn2mdc(conn);
@@ -490,7 +490,7 @@ int mdc_readpage(struct obd_conn *conn, ino_t ino, int type, __u64 offset,
         return rc;
 }
 
-int mdc_statfs(struct obd_conn *conn, struct statfs *sfs,
+int mdc_statfs(struct lustre_handle *conn, struct statfs *sfs,
                struct ptlrpc_request **request)
 {
         struct mdc_obd *mdc = mdc_conn2mdc(conn);
@@ -522,7 +522,7 @@ out:
         return rc;
 }
 
-static int mdc_ioctl(long cmd, struct obd_conn *conn, int len, void *karg,
+static int mdc_ioctl(long cmd, struct lustre_handle *conn, int len, void *karg,
                      void *uarg)
 {
 #if 0
@@ -727,7 +727,7 @@ static int mdc_cleanup(struct obd_device * obddev)
         return 0;
 }
 
-static int mdc_connect(struct obd_conn *conn, struct obd_device *obd)
+static int mdc_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         struct mdc_obd *mdc = &obd->u.mdc;
         struct ptlrpc_request *request;
@@ -742,7 +742,7 @@ static int mdc_connect(struct obd_conn *conn, struct obd_device *obd)
                 RETURN(-ENOMEM);
 
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn, obd);
+        rc = class_connect(conn, obd);
         if (rc) 
                 GOTO(out, rc);
 
@@ -769,10 +769,10 @@ static int mdc_connect(struct obd_conn *conn, struct obd_device *obd)
         return rc;
 }
 
-static int mdc_disconnect(struct obd_conn *conn)
+static int mdc_disconnect(struct lustre_handle *conn)
 {
         struct mdc_obd *mdc = mdc_conn2mdc(conn);
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct ptlrpc_request *request;
         int rc;
         ENTRY;
@@ -788,7 +788,7 @@ static int mdc_disconnect(struct obd_conn *conn)
         rc = ptlrpc_queue_wait(request);
         if (rc) 
                 GOTO(out, rc);
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
  out:
@@ -806,12 +806,12 @@ struct obd_ops mdc_obd_ops = {
 
 static int __init ptlrpc_request_init(void)
 {
-        return obd_register_type(&mdc_obd_ops, LUSTRE_MDC_NAME);
+        return class_register_type(&mdc_obd_ops, LUSTRE_MDC_NAME);
 }
 
 static void __exit ptlrpc_request_exit(void)
 {
-        obd_unregister_type(LUSTRE_MDC_NAME);
+        class_unregister_type(LUSTRE_MDC_NAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems <info@clusterfs.com>");
index 98f1408..48ba352 100644 (file)
@@ -151,12 +151,12 @@ struct dentry *mds_fid2dentry(struct mds_obd *mds, struct ll_fid *fid,
         return result;
 }
 
-static int mds_connect(struct obd_conn *conn, struct obd_device *obd)
+static int mds_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         int rc;
 
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn, obd);
+        rc = class_connect(conn, obd);
 
         if (rc)
                 MOD_DEC_USE_COUNT;
@@ -164,11 +164,11 @@ static int mds_connect(struct obd_conn *conn, struct obd_device *obd)
         return rc;
 }
 
-static int mds_disconnect(struct obd_conn *conn)
+static int mds_disconnect(struct lustre_handle *conn)
 {
         int rc;
 
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
@@ -928,10 +928,10 @@ static int mds_setup(struct obd_device *obddev, obd_count len, void *buf)
         if (rc)
                 GOTO(err_thread, rc);
 
-        rc = gen_connect(&mds->mds_connh, obddev);
+        rc = class_connect(&mds->mds_connh, obddev);
         if (rc)
                 GOTO(err_thread, rc);
-        export = gen_client(&mds->mds_connh);
+        export = class_conn2export(&mds->mds_connh);
         if (!export)
                 LBUG();
         export->export_connection = mds->mds_ldlm_conn;
@@ -964,7 +964,7 @@ static int mds_cleanup(struct obd_device * obddev)
         struct mds_obd *mds = &obddev->u.mds;
 
         ENTRY;
-        gen_disconnect(&mds->mds_connh);
+        class_disconnect(&mds->mds_connh);
 
 
         if ( !list_empty(&obddev->obd_exports) ) {
@@ -1025,7 +1025,7 @@ static int __init mds_init(void)
         inter_module_register("mds_reint", THIS_MODULE, &mds_reint);
         inter_module_register("mds_getattr_name", THIS_MODULE,
                               &mds_getattr_name);
-        obd_register_type(&mds_obd_ops, LUSTRE_MDS_NAME);
+        class_register_type(&mds_obd_ops, LUSTRE_MDS_NAME);
         return 0;
 }
 
@@ -1033,7 +1033,7 @@ static void __exit mds_exit(void)
 {
         inter_module_unregister("mds_reint");
         inter_module_unregister("mds_getattr_name");
-        obd_unregister_type(LUSTRE_MDS_NAME);
+        class_unregister_type(LUSTRE_MDS_NAME);
 }
 
 MODULE_AUTHOR("Cluster File Systems <info@clusterfs.com>");
index 206c8d1..5cbacde 100644 (file)
@@ -1,32 +1,16 @@
 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
  * vim:expandtab:shiftwidth=8:tabstop=8:
+ * 
+ * Copyright (C) 2001  Cluster File Systems, Inc.
  *
- *              An implementation of a loadable kernel mode driver providing
- *              multiple kernel/user space bidirectional communications links.
- *
- *              Author:         Alan Cox <alan@cymru.net>
- *
- *              This program is free software; you can redistribute it and/or
- *              modify it under the terms of the GNU General Public License
- *              version 2 as published by the Free Software Foundation.
- *
- *              Adapted to become the Linux 2.0 Coda pseudo device
- *              Peter  Braam  <braam@maths.ox.ac.uk>
- *              Michael Callahan <mjc@emmy.smith.edu>
- *
- *              Changes for Linux 2.1
- *              Copyright (c) 1997 Carnegie-Mellon University
- *
- *              Redone again for Intermezzo
- *              Copyright (c) 1998 Peter J. Braam
- *
- *              Hacked up again for simulated OBD
- *              Copyright (c) 1999 Stelias Computing, Inc.
- *                (authors {pschwan,braam}@stelias.com)
- *              Copyright (C) 1999 Seagate Technology, Inc.
- *              Copyright (C) 2001 Cluster File Systems, Inc.
+ * This code is issued under the GNU General Public License.
+ * See the file COPYING in this distribution
  *
+ * These are the only exported functions, they provide some generic
+ * infrastructure for managing object devices
  *
+ * Object Devices Class Driver
+ *              Copyright (C) 2002 Cluster File Systems, Inc.
  */
 
 #define EXPORT_SYMTAB
 #include <linux/obd_support.h>
 #include <linux/obd_class.h>
 
-static int obd_init_magic;
-unsigned long obd_memory = 0;
-unsigned long obd_fail_loc = 0;
 struct obd_device obd_dev[MAX_OBD_DEVICES];
+extern struct obd_type *class_nm_to_type(char *nm);
 struct list_head obd_types;
 
+unsigned long obd_memory = 0;
+unsigned long obd_fail_loc = 0;
+
 
 /*  opening /dev/obd */
 static int obd_class_open(struct inode * inode, struct file * file)
@@ -88,91 +73,20 @@ static int obd_class_release(struct inode * inode, struct file * file)
         RETURN(0);
 }
 
-int obd_class_name2dev(char *name)
-{
-        int res = -1;
-        int i;
-
-        for (i=0; i < MAX_OBD_DEVICES; i++) {
-                struct obd_device *obd = &obd_dev[i];
-                if (obd->obd_name && strcmp(name, obd->obd_name) == 0) {
-                        res = i;
-                        return res;
-                }
-        }
-
-        return res;
-}
-
-int obd_class_uuid2dev(char *name)
-{
-        int res = -1;
-        int i;
-
-        for (i=0; i < MAX_OBD_DEVICES; i++) {
-                struct obd_device *obd = &obd_dev[i];
-                if (obd->obd_name && strncmp(name, obd->obd_uuid, 37) == 0) {
-                        res = i;
-                        return res;
-                }
-        }
-
-        return res;
-}
-
-/*
- * support functions: we could use inter-module communication, but this
- * is more portable to other OS's
- */
-static struct obd_type *obd_search_type(char *nm)
-{
-        struct list_head *tmp;
-        struct obd_type *type;
-        CDEBUG(D_INFO, "SEARCH %s\n", nm);
-
-        tmp = &obd_types;
-        while ( (tmp = tmp->next) != &obd_types ) {
-                type = list_entry(tmp, struct obd_type, typ_chain);
-                CDEBUG(D_INFO, "TYP %s\n", type->typ_name);
-                if (strlen(type->typ_name) == strlen(nm) &&
-                    strcmp(type->typ_name, nm) == 0 ) {
-                        return type;
-                }
-        }
-        return NULL;
-}
-
-static struct obd_type *obd_nm_to_type(char *nm)
-{
-        struct obd_type *type = obd_search_type(nm);
 
-#ifdef CONFIG_KMOD
-        if ( !type ) {
-                if ( !request_module(nm) ) {
-                        CDEBUG(D_INFO, "Loaded module '%s'\n", nm);
-                        type = obd_search_type(nm);
-                } else {
-                        CDEBUG(D_INFO, "Can't load module '%s'\n", nm);
-                }
-        }
-#endif
-        return type;
-}
-
-inline void obd_data2conn(struct obd_conn *conn, struct obd_ioctl_data *data)
+inline void obd_data2conn(struct lustre_handle *conn, struct obd_ioctl_data *data)
 {
         conn->addr = data->ioc_addr;
         conn->cookie = data->ioc_cookie;
 }
 
 
-inline void obd_conn2data(struct obd_ioctl_data *data, struct obd_conn *conn)
+inline void obd_conn2data(struct obd_ioctl_data *data, struct lustre_handle *conn)
 {
         data->ioc_addr = conn->addr;
         data->ioc_cookie = conn->cookie;
 }
 
-
 /* to control /dev/obd */
 static int obd_class_ioctl (struct inode * inode, struct file * filp,
                             unsigned int cmd, unsigned long arg)
@@ -182,7 +96,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
         int len = 1024;
         struct obd_ioctl_data *data;
         struct obd_device *obd = filp->private_data;
-        struct obd_conn conn;
+        struct lustre_handle conn;
         int rw = OBD_BRW_READ;
         int err = 0;
         ENTRY;
@@ -259,7 +173,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                         RETURN(-EINVAL);
                 }
                 CDEBUG(D_IOCTL, "device name %s\n", data->ioc_inlbuf1);
-                dev = obd_class_name2dev(data->ioc_inlbuf1);
+                dev = class_name2dev(data->ioc_inlbuf1);
                 data->ioc_dev = dev;
                 if (dev == -1) {
                         CDEBUG(D_IOCTL, "No device for name %s!\n",
@@ -284,7 +198,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                         RETURN(-EINVAL);
                 }
                 CDEBUG(D_IOCTL, "device name %s\n", data->ioc_inlbuf1);
-                dev = obd_class_uuid2dev(data->ioc_inlbuf1);
+                dev = class_uuid2dev(data->ioc_inlbuf1);
                 data->ioc_dev = dev;
                 if (dev == -1) {
                         CDEBUG(D_IOCTL, "No device for name %s!\n",
@@ -336,7 +250,7 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
                        MKSTR(data->ioc_inlbuf2), MKSTR(data->ioc_inlbuf3));
 
                 /* find the type */
-                type = obd_nm_to_type(data->ioc_inlbuf1);
+                type = class_nm_to_type(data->ioc_inlbuf1);
                 if (!type) {
                         CERROR("OBD: unknown type dev %d\n", obd->obd_minor);
                         RETURN(-EINVAL);
@@ -626,57 +540,6 @@ static int obd_class_ioctl (struct inode * inode, struct file * filp,
 } /* obd_class_ioctl */
 
 
-/* Driver interface done, utility functions follow */
-int obd_register_type(struct obd_ops *ops, char *nm)
-{
-        struct obd_type *type;
-
-        ENTRY;
-
-        if (obd_init_magic != 0x11223344) {
-                CERROR("bad magic for type\n");
-                RETURN(-EINVAL);
-        }
-
-        if (obd_nm_to_type(nm)) {
-                CDEBUG(D_IOCTL, "Type %s already registered\n", nm);
-                RETURN(-EEXIST);
-        }
-
-        OBD_ALLOC(type, sizeof(*type));
-        if (!type)
-                RETURN(-ENOMEM);
-        INIT_LIST_HEAD(&type->typ_chain);
-        MOD_INC_USE_COUNT;
-        list_add(&type->typ_chain, obd_types.next);
-        type->typ_ops = ops;
-        type->typ_name = nm;
-        RETURN(0);
-}
-
-int obd_unregister_type(char *nm)
-{
-        struct obd_type *type = obd_nm_to_type(nm);
-
-        ENTRY;
-
-        if ( !type ) {
-                MOD_DEC_USE_COUNT;
-                CERROR("unknown obd type\n");
-                RETURN(-EINVAL);
-        }
-
-        if ( type->typ_refcnt ) {
-                MOD_DEC_USE_COUNT;
-                CERROR("type %s has refcount (%d)\n", nm, type->typ_refcnt);
-                RETURN(-EBUSY);
-        }
-
-        list_del(&type->typ_chain);
-        OBD_FREE(type, sizeof(*type));
-        MOD_DEC_USE_COUNT;
-        RETURN(0);
-} /* obd_unregister_type */
 
 /* declare character device */
 static struct file_operations obd_psdev_fops = {
@@ -693,26 +556,23 @@ static struct miscdevice obd_psdev = {
         &obd_psdev_fops
 };
 
-EXPORT_SYMBOL(obd_register_type);
-EXPORT_SYMBOL(obd_unregister_type);
 
 EXPORT_SYMBOL(obd_dev);
-EXPORT_SYMBOL(obd_class_name2dev);
-EXPORT_SYMBOL(obd_class_uuid2dev);
-EXPORT_SYMBOL(gen_connect);
-EXPORT_SYMBOL(gen_client);
-EXPORT_SYMBOL(gen_conn2obd);
-EXPORT_SYMBOL(gen_cleanup);
-EXPORT_SYMBOL(gen_disconnect);
-EXPORT_SYMBOL(gen_copy_data);
 EXPORT_SYMBOL(obdo_cachep);
-
-/* EXPORT_SYMBOL(gen_multi_attach); */
-EXPORT_SYMBOL(gen_multi_setup);
-EXPORT_SYMBOL(gen_multi_cleanup);
 EXPORT_SYMBOL(obd_memory);
 EXPORT_SYMBOL(obd_fail_loc);
 
+EXPORT_SYMBOL(class_register_type);
+EXPORT_SYMBOL(class_unregister_type);
+EXPORT_SYMBOL(class_name2dev);
+EXPORT_SYMBOL(class_uuid2dev);
+EXPORT_SYMBOL(class_connect);
+EXPORT_SYMBOL(class_conn2export);
+EXPORT_SYMBOL(class_conn2obd);
+EXPORT_SYMBOL(class_disconnect);
+EXPORT_SYMBOL(class_multi_setup);
+EXPORT_SYMBOL(class_multi_cleanup);
+
 static int __init init_obdclass(void)
 {
         int err;
@@ -737,7 +597,6 @@ static int __init init_obdclass(void)
         if (err)
                 return err;
         obd_sysctl_init();
-        obd_init_magic = 0x11223344;
         return 0;
 }
 
@@ -759,11 +618,10 @@ static void __exit cleanup_obdclass(void)
         obd_cleanup_caches();
         obd_sysctl_clean();
         CERROR("obd memory leaked: %ld bytes\n", obd_memory);
-        obd_init_magic = 0;
         EXIT;
 }
 
-MODULE_AUTHOR("Cluster File Systems, Inc. <braam@clusterfs.com>");
+MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
 MODULE_DESCRIPTION("Lustre Class Driver v1.0");
 MODULE_LICENSE("GPL");
 
index ef37c75..591ee3f 100644 (file)
  * This code is issued under the GNU General Public License.
  * See the file COPYING in this distribution
  *
- * These are the only exported functions; they provide the simulated object-
- * oriented disk.
+ * These are the only exported functions, they provide some generic
+ * infrastructure for managing object devices
  *
  */
 
 #define DEBUG_SUBSYSTEM S_CLASS
-
+#include <linux/module.h>
 #include <linux/obd_class.h>
 #include <linux/random.h>
 #include <linux/slab.h>
 
+extern struct list_head obd_types; 
 extern struct obd_device obd_dev[MAX_OBD_DEVICES];
 kmem_cache_t *obdo_cachep = NULL;
 kmem_cache_t *export_cachep = NULL;
 kmem_cache_t *import_cachep = NULL;
 
+/*
+ * support functions: we could use inter-module communication, but this
+ * is more portable to other OS's
+ */
+static struct obd_type *class_search_type(char *nm)
+{
+        struct list_head *tmp;
+        struct obd_type *type;
+        CDEBUG(D_INFO, "SEARCH %s\n", nm);
+
+        tmp = &obd_types;
+        while ( (tmp = tmp->next) != &obd_types ) {
+                type = list_entry(tmp, struct obd_type, typ_chain);
+                CDEBUG(D_INFO, "TYP %s\n", type->typ_name);
+                if (strlen(type->typ_name) == strlen(nm) &&
+                    strcmp(type->typ_name, nm) == 0 ) {
+                        return type;
+                }
+        }
+        return NULL;
+}
+
+struct obd_type *class_nm_to_type(char *nm)
+{
+        struct obd_type *type = class_search_type(nm);
+
+#ifdef CONFIG_KMOD
+        if ( !type ) {
+                if ( !request_module(nm) ) {
+                        CDEBUG(D_INFO, "Loaded module '%s'\n", nm);
+                        type = obd_search_type(nm);
+                } else {
+                        CDEBUG(D_INFO, "Can't load module '%s'\n", nm);
+                }
+        }
+#endif
+        return type;
+}
+
+int class_register_type(struct obd_ops *ops, char *nm)
+{
+        struct obd_type *type;
+
+        ENTRY;
+
+        if (class_nm_to_type(nm)) {
+                CDEBUG(D_IOCTL, "Type %s already registered\n", nm);
+                RETURN(-EEXIST);
+        }
+
+        OBD_ALLOC(type, sizeof(*type));
+        if (!type)
+                RETURN(-ENOMEM);
+        INIT_LIST_HEAD(&type->typ_chain);
+        MOD_INC_USE_COUNT;
+        list_add(&type->typ_chain, obd_types.next);
+        type->typ_ops = ops;
+        type->typ_name = nm;
+        RETURN(0);
+}
+
+int class_unregister_type(char *nm)
+{
+        struct obd_type *type = class_nm_to_type(nm);
+
+        ENTRY;
+
+        if ( !type ) {
+                MOD_DEC_USE_COUNT;
+                CERROR("unknown obd type\n");
+                RETURN(-EINVAL);
+        }
+
+        if ( type->typ_refcnt ) {
+                MOD_DEC_USE_COUNT;
+                CERROR("type %s has refcount (%d)\n", nm, type->typ_refcnt);
+                RETURN(-EBUSY);
+        }
+
+        list_del(&type->typ_chain);
+        OBD_FREE(type, sizeof(*type));
+        MOD_DEC_USE_COUNT;
+        RETURN(0);
+} /* class_unregister_type */
+
+int class_name2dev(char *name)
+{
+        int res = -1;
+        int i;
+
+        for (i=0; i < MAX_OBD_DEVICES; i++) {
+                struct obd_device *obd = &obd_dev[i];
+                if (obd->obd_name && strcmp(name, obd->obd_name) == 0) {
+                        res = i;
+                        return res;
+                }
+        }
+
+        return res;
+}
+
+int class_uuid2dev(char *name)
+{
+        int res = -1;
+        int i;
+
+        for (i=0; i < MAX_OBD_DEVICES; i++) {
+                struct obd_device *obd = &obd_dev[i];
+                if (obd->obd_name && strncmp(name, obd->obd_uuid, 37) == 0) {
+                        res = i;
+                        return res;
+                }
+        }
+
+        return res;
+}
+
 void obd_cleanup_caches(void)
 {
         int rc;
@@ -82,9 +200,8 @@ int obd_init_caches(void)
 
 }
 
-
 /* map connection to client */
-struct obd_export *gen_client(struct obd_conn *conn)
+struct obd_export *class_conn2export(struct lustre_handle *conn)
 {
         struct obd_export * export;
 
@@ -103,20 +220,21 @@ struct obd_export *gen_client(struct obd_conn *conn)
         if (export->export_cookie != conn->cookie)
                 return NULL;
         return export;
-} /* gen_client */
+} /* class_conn2export */
 
-struct obd_device *gen_conn2obd(struct obd_conn *conn)
+struct obd_device *class_conn2obd(struct lustre_handle *conn)
 {
         struct obd_export *export;
-        export = gen_client(conn); 
+        export = class_conn2export(conn); 
         if (export) 
                 return export->export_obd;
         fixme();
         return NULL;
 }
 
-/* a connection defines a context in which preallocation can be managed. */
-int gen_connect (struct obd_conn *conn, struct obd_device *obd)
+/* a connection defines an export context in which preallocation can
+   be managed. */
+int class_connect (struct lustre_handle *conn, struct obd_device *obd)
 {
         struct obd_export * export;
 
@@ -140,15 +258,14 @@ int gen_connect (struct obd_conn *conn, struct obd_device *obd)
         conn->addr = (__u64) (unsigned long)export;
         conn->cookie = export->export_cookie;
         return 0;
-} /* gen_connect */
-
+} /* class_connect */
 
-int gen_disconnect(struct obd_conn *conn)
+int class_disconnect(struct lustre_handle *conn)
 {
         struct obd_export * export;
         ENTRY;
 
-        if (!(export = gen_client(conn))) {
+        if (!(export = class_conn2export(conn))) {
                 fixme();
                 CDEBUG(D_IOCTL, "disconnect: attempting to free "
                        "nonexistent client %Lx\n", conn->addr);
@@ -162,7 +279,7 @@ int gen_disconnect(struct obd_conn *conn)
 
 /* FIXME: Data is a space- or comma-separated list of device IDs.  This will
  * have to change. */
-int gen_multi_setup(struct obd_device *obddev, uint32_t len, void *data)
+int class_multi_setup(struct obd_device *obddev, uint32_t len, void *data)
 {
         int count, rc;
         char *p;
@@ -211,13 +328,13 @@ int gen_multi_setup(struct obd_device *obddev, uint32_t len, void *data)
  *    close all connections to lower devices
  *    needed for forced unloads of OBD client drivers
  */
-int gen_multi_cleanup(struct obd_device *obddev)
+int class_multi_cleanup(struct obd_device *obddev)
 {
         int i;
 
         for (i = 0; i < obddev->obd_multi_count; i++) {
                 int rc;
-                struct obd_device *obd = gen_conn2obd(&obddev->obd_multi_conn[i]);
+                struct obd_device *obd = class_conn2obd(&obddev->obd_multi_conn[i]);
 
                 if (!obd) { 
                         CERROR("no such device [i %d]\n", i); 
@@ -231,92 +348,3 @@ int gen_multi_cleanup(struct obd_device *obddev)
         return 0;
 }
 
-
-/*
- *    forced cleanup of the device:
- *    - remove connections from the device
- *    - cleanup the device afterwards
- */
-int gen_cleanup(struct obd_device * obddev)
-{
-        struct list_head * lh, * tmp;
-        struct obd_export * export;
-
-        ENTRY;
-
-        lh = tmp = &obddev->obd_exports;
-        while ((tmp = tmp->next) != lh) {
-                export = list_entry(tmp, struct obd_export, export_chain);
-                CDEBUG(D_INFO, "Disconnecting obd_connection %d, at %p\n",
-                       export->export_id, export);
-        }
-        return 0;
-} /* sim_cleanup_device */
-
-void lck_page(struct page *page)
-{
-        while (TryLockPage(page))
-                ___wait_on_page(page);
-}
-
-int gen_copy_data(struct obd_conn *dst_conn, struct obdo *dst,
-                  struct obd_conn *src_conn, struct obdo *src,
-                  obd_size count, obd_off offset)
-{
-        struct page *page;
-        unsigned long index = 0;
-        int err = 0;
-
-        ENTRY;
-        CDEBUG(D_INFO, "src: ino %Ld blocks %Ld, size %Ld, dst: ino %Ld\n",
-               (unsigned long long)src->o_id, (unsigned long long)src->o_blocks,
-               (unsigned long long)src->o_size, (unsigned long long)dst->o_id);
-        page = alloc_page(GFP_USER);
-        if (page == NULL)
-                RETURN(-ENOMEM);
-
-        lck_page(page);
-
-        /* XXX with brw vector I/O, we could batch up reads and writes here,
-         *     all we need to do is allocate multiple pages to handle the I/Os
-         *     and arrays to handle the request parameters.
-         */
-        while (index < ((src->o_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
-                obd_count        num_oa = 1;
-                obd_count        num_buf = 1;
-                obd_size         brw_count = PAGE_SIZE;
-                obd_off          brw_offset = (page->index) << PAGE_SHIFT;
-                obd_flag         flagr = 0;
-                obd_flag         flagw = OBD_BRW_CREATE;
-
-                page->index = index;
-                err = obd_brw(OBD_BRW_READ, src_conn, num_oa, &src, &num_buf,
-                             &page, &brw_count, &brw_offset, &flagr, NULL);
-
-                if ( err ) {
-                        EXIT;
-                        break;
-                }
-                CDEBUG(D_INFO, "Read page %ld ...\n", page->index);
-
-                err = obd_brw(OBD_BRW_WRITE, dst_conn, num_oa, &dst, &num_buf,
-                             &page, &brw_count, &brw_offset, &flagw, NULL);
-
-                /* XXX should handle dst->o_size, dst->o_blocks here */
-                if ( err ) {
-                        EXIT;
-                        break;
-                }
-
-                CDEBUG(D_INFO, "Wrote page %ld ...\n", page->index);
-
-                index++;
-        }
-        dst->o_size = src->o_size;
-        dst->o_blocks = src->o_blocks;
-        dst->o_valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS);
-        UnlockPage(page);
-        __free_page(page);
-
-        RETURN(err);
-}
index d49a7a5..66ff902 100644 (file)
 
 #ifdef CONFIG_PROC_FS
 extern struct proc_dir_entry proc_root;
-
 static struct proc_dir_entry *proc_lustre_dir_entry = 0;
 static struct proc_dir_entry *proc_lustre_obd_dir_entry = 0;
 
-static struct proc_dir_entry *
-proc_lustre_mkdir(const char* dname, struct proc_dir_entry *parent)
-{
-       struct proc_dir_entry *child_dir_entry;
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,3,0) /*0x20300 */
-       child_dir_entry = proc_mkdir(dname, parent);
-#else
-       child_dir_entry = create_proc_entry(dname,
-                                           S_IFDIR | S_IRUGO | S_IXUGO,
-                                           &proc_root);
-#endif
-       if (!child_dir_entry)
-                CERROR("lustre: failed to create /proc entry %s\n", dname);
-       
-       return child_dir_entry;
-}
 
 static int read_lustre_status(char *page, char **start, off_t offset,
                              int count, int *eof, void *data)
@@ -77,7 +59,7 @@ static int read_lustre_status(char *page, char **start, off_t offset,
        struct obd_device * obddev = (struct obd_device *) data;
        int p;
 
-       p = sprintf(&page[0], "/dev/obd%d: ", obddev->obd_minor);
+       p = sprintf(&page[0], "device %d: ", obddev->obd_minor);
        
         if  (obddev->obd_flags & OBD_ATTACHED) {
                 p += sprintf(&page[p], ", attached(%s)", 
@@ -102,7 +84,7 @@ static int read_lustre_status(char *page, char **start, off_t offset,
                 free_page((unsigned long) pathpage);
         }
         
-        /* print connections */
+        /* print exports */
         {
                 struct list_head * lh;
                 struct obd_export * export=0;
@@ -112,8 +94,8 @@ static int read_lustre_status(char *page, char **start, off_t offset,
                         p += sprintf(&page[p],
                                      ((export==0) ? ", connections(" : ",") );
                         export = list_entry(lh, struct obd_export, export_chain);
-                        p += sprintf(&page[p], "%d", export->export_id);
-                } /* while */
+                        p += sprintf(&page[p], "%p", export);
+                } 
                 if (export!=0) { /* there was at least one export */
                         p += sprintf(&page[p], ")");
                 }
@@ -138,21 +120,20 @@ proc_lustre_register_obd_device(struct obd_device *obd)
        struct proc_dir_entry *obd_status = 0;
 
        if (!proc_lustre_dir_entry) {
-               proc_lustre_dir_entry = 
-                       proc_lustre_mkdir("lustre", &proc_root);
-               if (!proc_lustre_dir_entry)
+               proc_lustre_dir_entry = proc_mkdir("lustre", &proc_root);
+               if (IS_ERR(proc_lustre_dir_entry))
                        return 0;
        
                proc_lustre_obd_dir_entry = 
-                       proc_lustre_mkdir("obd", proc_lustre_dir_entry);
-               if (!proc_lustre_obd_dir_entry)
+                       proc_mkdir("obd", proc_lustre_dir_entry);
+               if (IS_ERR(proc_lustre_obd_dir_entry))
                        return 0;
        }
 
        sprintf(obdname, "%d", obd->obd_minor);
 
-       obd_dir =  proc_lustre_mkdir(obdname, proc_lustre_obd_dir_entry);
-       
+
+       obd_dir =  proc_mkdir(obdname, proc_lustre_obd_dir_entry);
         if (obd_dir) 
                obd_status = create_proc_entry("status", S_IRUSR | S_IFREG, obd_dir);
 
index c3be848..3924eea 100644 (file)
@@ -33,12 +33,12 @@ static struct obdo OA;
 static obd_count GEN;
 static long echo_pages = 0;
 
-static int echo_connect(struct obd_conn *conn, struct obd_device *obd)
+static int echo_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         int rc;
 
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn, obd);
+        rc = class_connect(conn, obd);
 
         if (rc)
                 MOD_DEC_USE_COUNT;
@@ -46,18 +46,18 @@ static int echo_connect(struct obd_conn *conn, struct obd_device *obd)
         return rc;
 }
 
-static int echo_disconnect(struct obd_conn *conn)
+static int echo_disconnect(struct lustre_handle *conn)
 {
         int rc;
 
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
         return rc;
 }
 
-static int echo_getattr(struct obd_conn *conn, struct obdo *oa)
+static int echo_getattr(struct lustre_handle *conn, struct obdo *oa)
 {
         memcpy(oa, &OA, sizeof(*oa));
         oa->o_mode = ++GEN;
@@ -65,7 +65,7 @@ static int echo_getattr(struct obd_conn *conn, struct obdo *oa)
         return 0;
 }
 
-int echo_preprw(int cmd, struct obd_conn *conn, int objcount,
+int echo_preprw(int cmd, struct lustre_handle *conn, int objcount,
                 struct obd_ioobj *obj, int niocount, struct niobuf_remote *nb,
                 struct niobuf_local *res, void **desc_private)
 {
@@ -122,7 +122,7 @@ preprw_cleanup:
         return rc;
 }
 
-int echo_commitrw(int cmd, struct obd_conn *conn, int objcount,
+int echo_commitrw(int cmd, struct lustre_handle *conn, int objcount,
                   struct obd_ioobj *obj, int niocount, struct niobuf_local *res,
                   void *desc_private)
 {
@@ -190,13 +190,13 @@ static int __init obdecho_init(void)
 {
         printk(KERN_INFO "Echo OBD driver  v0.001, braam@clusterfs.com\n");
 
-        return obd_register_type(&echo_obd_ops, OBD_ECHO_DEVICENAME);
+        return class_register_type(&echo_obd_ops, OBD_ECHO_DEVICENAME);
 }
 
 static void __exit obdecho_exit(void)
 {
         CERROR("%ld prep/commitrw pages leaked\n", echo_pages);
-        obd_unregister_type(OBD_ECHO_DEVICENAME);
+        class_unregister_type(OBD_ECHO_DEVICENAME);
 }
 
 MODULE_AUTHOR("Cluster Filesystems Inc. <info@clusterfs.com>");
index a390c51..b86e3d6 100644 (file)
@@ -353,12 +353,12 @@ static struct inode *filter_inode_from_obj(struct obd_device *obddev,
 }
 
 /* obd methods */
-static int filter_connect(struct obd_conn *conn, struct obd_device *obd)
+static int filter_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         int rc;
 
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn, obd);
+        rc = class_connect(conn, obd);
 
         if (rc)
                 MOD_DEC_USE_COUNT;
@@ -366,11 +366,11 @@ static int filter_connect(struct obd_conn *conn, struct obd_device *obd)
         return rc;
 }
 
-static int filter_disconnect(struct obd_conn *conn)
+static int filter_disconnect(struct lustre_handle *conn)
 {
         int rc;
 
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
@@ -503,18 +503,18 @@ static inline void filter_from_inode(struct obdo *oa, struct inode *inode)
         EXIT;
 }
 
-static int filter_getattr(struct obd_conn *conn, struct obdo *oa)
+static int filter_getattr(struct lustre_handle *conn, struct obdo *oa)
 {
-        struct obd_device *obddev = gen_conn2obd(conn);
+        struct obd_device *obddev = class_conn2obd(conn);
         struct dentry *dentry;
         ENTRY;
 
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obddev = gen_conn2obd(conn);
+        obddev = class_conn2obd(conn);
         dentry = filter_fid2dentry(obddev, filter_parent(obddev, oa->o_mode),
                                    oa->o_id, oa->o_mode);
         if (IS_ERR(dentry))
@@ -527,10 +527,10 @@ static int filter_getattr(struct obd_conn *conn, struct obdo *oa)
         RETURN(0);
 }
 
-static int filter_setattr(struct obd_conn *conn, struct obdo *oa)
+static int filter_setattr(struct lustre_handle *conn, struct obdo *oa)
 {
         struct obd_run_ctxt saved;
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct dentry *dentry;
         struct iattr iattr;
         struct inode *inode;
@@ -568,18 +568,18 @@ static int filter_setattr(struct obd_conn *conn, struct obdo *oa)
         RETURN(rc);
 }
 
-static int filter_open(struct obd_conn *conn, struct obdo *oa)
+static int filter_open(struct lustre_handle *conn, struct obdo *oa)
 {
         struct obd_device *obd;
         struct dentry *dentry;
         /* ENTRY; */
 
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
         dentry = filter_fid2dentry(obd, filter_parent(obd, oa->o_mode),
                                    oa->o_id, oa->o_mode);
         if (IS_ERR(dentry))
@@ -588,18 +588,18 @@ static int filter_open(struct obd_conn *conn, struct obdo *oa)
         return 0;
 } /* filter_open */
 
-static int filter_close(struct obd_conn *conn, struct obdo *oa)
+static int filter_close(struct lustre_handle *conn, struct obdo *oa)
 {
         struct obd_device *obd;
         struct dentry *dentry;
         /* ENTRY; */
 
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CDEBUG(D_IOCTL, "fatal: invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
         dentry = filter_fid2dentry(obd, filter_parent(obd, oa->o_mode),
                                    oa->o_id, oa->o_mode);
         if (IS_ERR(dentry))
@@ -614,17 +614,17 @@ static int filter_close(struct obd_conn *conn, struct obdo *oa)
         return 0;
 } /* filter_close */
 
-static int filter_create(struct obd_conn* conn, struct obdo *oa)
+static int filter_create(struct lustre_handle* conn, struct obdo *oa)
 {
         char name[64];
         struct obd_run_ctxt saved;
         struct file *file;
         int mode;
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct iattr;
         ENTRY;
 
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CERROR("invalid client %Lx\n", conn->addr);
                 return -EINVAL;
         }
@@ -655,7 +655,7 @@ static int filter_create(struct obd_conn* conn, struct obdo *oa)
         return 0;
 }
 
-static int filter_destroy(struct obd_conn *conn, struct obdo *oa)
+static int filter_destroy(struct lustre_handle *conn, struct obdo *oa)
 {
         struct obd_run_ctxt saved;
         struct obd_device *obd;
@@ -665,13 +665,13 @@ static int filter_destroy(struct obd_conn *conn, struct obdo *oa)
         int rc;
         ENTRY;
 
-        if (!(export = gen_client(conn))) {
+        if (!(export = class_conn2export(conn))) {
                 CERROR("invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
         CDEBUG(D_INODE, "destroying object %Ld\n",oa->o_id);
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
 
         dir_dentry = filter_parent(obd, oa->o_mode);
         down(&dir_dentry->d_inode->i_sem);
@@ -703,7 +703,7 @@ out:
 }
 
 /* NB count and offset are used for punch, but not truncate */
-static int filter_truncate(struct obd_conn *conn, struct obdo *oa,
+static int filter_truncate(struct lustre_handle *conn, struct obdo *oa,
                            obd_size count, obd_off offset)
 {
         int error;
@@ -716,7 +716,7 @@ static int filter_truncate(struct obd_conn *conn, struct obdo *oa,
         RETURN(error);
 }
 
-static int filter_pgcache_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
+static int filter_pgcache_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
                                struct obdo **oa, obd_count *oa_bufs,
                                struct page **pages, obd_size *count,
                                obd_off *offset, obd_flag *flags, void *callback)
@@ -728,10 +728,10 @@ static int filter_pgcache_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
         unsigned long            retval;
         int                      error;
         struct file             *file;
-        struct obd_device      *obd = gen_conn2obd(conn);
+        struct obd_device      *obd = class_conn2obd(conn);
         ENTRY;
 
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
@@ -795,9 +795,9 @@ out:
 }
 
 
-struct inode *ioobj_to_inode(struct obd_conn *conn, struct obd_ioobj *o)
+struct inode *ioobj_to_inode(struct lustre_handle *conn, struct obd_ioobj *o)
 {
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct super_block *sb = obd->u.filter.fo_sb;
         struct inode *inode = NULL;
         ENTRY;
@@ -1080,7 +1080,7 @@ static int filter_commit_write(struct page *page, unsigned from, unsigned to,
         return lustre_commit_write(page, from, to);
 }
 
-static int filter_preprw(int cmd, struct obd_conn *conn,
+static int filter_preprw(int cmd, struct lustre_handle *conn,
                          int objcount, struct obd_ioobj *obj,
                          int niocount, struct niobuf_remote *nb,
                          struct niobuf_local *res, void **desc_private)
@@ -1096,7 +1096,7 @@ static int filter_preprw(int cmd, struct obd_conn *conn,
         ENTRY;
 
         memset(res, 0, sizeof(*res) * niocount);
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
 
         push_ctxt(&saved, &obd->u.filter.fo_ctxt);
 
@@ -1211,7 +1211,7 @@ out:
         return rc;
 }
 
-static int filter_commitrw(int cmd, struct obd_conn *conn,
+static int filter_commitrw(int cmd, struct lustre_handle *conn,
                            int objcount, struct obd_ioobj *obj,
                            int niocount, struct niobuf_local *res,
                            void *private)
@@ -1219,7 +1219,7 @@ static int filter_commitrw(int cmd, struct obd_conn *conn,
         struct obd_run_ctxt saved;
         struct obd_ioobj *o = obj;
         struct niobuf_local *r = res;
-        struct obd_device *obd = gen_conn2obd(conn); 
+        struct obd_device *obd = class_conn2obd(conn); 
         void *journal_save;
         int found_locked = 0;
         int rc = 0;
@@ -1284,37 +1284,37 @@ out_ctxt:
         RETURN(0);
 }
 
-static int filter_statfs(struct obd_conn *conn, struct statfs * statfs)
+static int filter_statfs(struct lustre_handle *conn, struct statfs * statfs)
 {
         struct super_block *sb;
         int err;
         ENTRY;
 
-        if (!gen_client(conn)) {
+        if (!class_conn2export(conn)) {
                 CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        sb = gen_conn2obd(conn)->u.filter.fo_sb;
+        sb = class_conn2obd(conn)->u.filter.fo_sb;
 
         err = sb->s_op->statfs(sb, statfs);
         RETURN(err);
 } /* filter_statfs */
 
 
-static int filter_get_info(struct obd_conn *conn, obd_count keylen,
+static int filter_get_info(struct lustre_handle *conn, obd_count keylen,
                            void *key, obd_count *vallen, void **val)
 {
         struct obd_device *obd;
         struct obd_export * export;
         ENTRY;
 
-        if (!(export = gen_client(conn))) {
+        if (!(export = class_conn2export(conn))) {
                 CDEBUG(D_IOCTL, "invalid client %Lx\n", conn->addr);
                 RETURN(-EINVAL);
         }
 
-        obd = gen_conn2obd(conn);
+        obd = class_conn2obd(conn);
 
         if ( keylen == strlen("blocksize") &&
              memcmp(key, "blocksize", keylen) == 0 ) {
@@ -1341,6 +1341,69 @@ static int filter_get_info(struct obd_conn *conn, obd_count keylen,
         RETURN(-EINVAL);
 }
 
+int filter_copy_data(struct lustre_handle *dst_conn, struct obdo *dst,
+                  struct lustre_handle *src_conn, struct obdo *src,
+                  obd_size count, obd_off offset)
+{
+        struct page *page;
+        unsigned long index = 0;
+        int err = 0;
+
+        ENTRY;
+        CDEBUG(D_INFO, "src: ino %Ld blocks %Ld, size %Ld, dst: ino %Ld\n",
+               (unsigned long long)src->o_id, (unsigned long long)src->o_blocks,
+               (unsigned long long)src->o_size, (unsigned long long)dst->o_id);
+        page = alloc_page(GFP_USER);
+        if (page == NULL)
+                RETURN(-ENOMEM);
+
+        while (TryLockPage(page))
+                ___wait_on_page(page);
+
+        /* XXX with brw vector I/O, we could batch up reads and writes here,
+         *     all we need to do is allocate multiple pages to handle the I/Os
+         *     and arrays to handle the request parameters.
+         */
+        while (index < ((src->o_size + PAGE_SIZE - 1) >> PAGE_SHIFT)) {
+                obd_count        num_oa = 1;
+                obd_count        num_buf = 1;
+                obd_size         brw_count = PAGE_SIZE;
+                obd_off          brw_offset = (page->index) << PAGE_SHIFT;
+                obd_flag         flagr = 0;
+                obd_flag         flagw = OBD_BRW_CREATE;
+
+                page->index = index;
+                err = obd_brw(OBD_BRW_READ, src_conn, num_oa, &src, &num_buf,
+                             &page, &brw_count, &brw_offset, &flagr, NULL);
+
+                if ( err ) {
+                        EXIT;
+                        break;
+                }
+                CDEBUG(D_INFO, "Read page %ld ...\n", page->index);
+
+                err = obd_brw(OBD_BRW_WRITE, dst_conn, num_oa, &dst, &num_buf,
+                             &page, &brw_count, &brw_offset, &flagw, NULL);
+
+                /* XXX should handle dst->o_size, dst->o_blocks here */
+                if ( err ) {
+                        EXIT;
+                        break;
+                }
+
+                CDEBUG(D_INFO, "Wrote page %ld ...\n", page->index);
+
+                index++;
+        }
+        dst->o_size = src->o_size;
+        dst->o_blocks = src->o_blocks;
+        dst->o_valid |= (OBD_MD_FLSIZE | OBD_MD_FLBLOCKS);
+        UnlockPage(page);
+        __free_page(page);
+
+        RETURN(err);
+}
+
 
 static struct obd_ops filter_obd_ops = {
         o_get_info:    filter_get_info,
@@ -1362,7 +1425,7 @@ static struct obd_ops filter_obd_ops = {
 #if 0
         o_preallocate: filter_preallocate_inodes,
         o_migrate:     filter_migrate,
-        o_copy:        gen_copy_data,
+        o_copy:        filter_copy_data,
         o_iterate:     filter_iterate
 #endif
 };
@@ -1371,12 +1434,12 @@ static struct obd_ops filter_obd_ops = {
 static int __init obdfilter_init(void)
 {
         printk(KERN_INFO "Filtering OBD driver  v0.001, braam@clusterfs.com\n");
-        return obd_register_type(&filter_obd_ops, OBD_FILTER_DEVICENAME);
+        return class_register_type(&filter_obd_ops, OBD_FILTER_DEVICENAME);
 }
 
 static void __exit obdfilter_exit(void)
 {
-        obd_unregister_type(OBD_FILTER_DEVICENAME);
+        class_unregister_type(OBD_FILTER_DEVICENAME);
 }
 
 MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
index b20654e..08ab867 100644 (file)
@@ -33,23 +33,23 @@ static void osc_obd2cl(struct obd_device *obd, struct ptlrpc_client **cl,
         *connection = osc->osc_conn;
 }
 
-static void osc_con2cl(struct obd_conn *conn, struct ptlrpc_client **cl,
+static void osc_con2cl(struct lustre_handle *conn, struct ptlrpc_client **cl,
                        struct ptlrpc_connection **connection)
 {
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         *cl = osc->osc_client;
         *connection = osc->osc_conn;
 }
 
-static void osc_con2dlmcl(struct obd_conn *conn, struct ptlrpc_client **cl,
+static void osc_con2dlmcl(struct lustre_handle *conn, struct ptlrpc_client **cl,
                           struct ptlrpc_connection **connection)
 {
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         *cl = osc->osc_ldlm_client;
         *connection = osc->osc_conn;
 }
 
-static int osc_connect(struct obd_conn *conn, struct obd_device *obd)
+static int osc_connect(struct lustre_handle *conn, struct obd_device *obd)
 {
         struct osc_obd *osc = &obd->u.osc;
         struct obd_import *import;
@@ -65,7 +65,7 @@ static int osc_connect(struct obd_conn *conn, struct obd_device *obd)
                 RETURN(-ENOMEM);
                   
         MOD_INC_USE_COUNT;
-        rc = gen_connect(conn, obd);
+        rc = class_connect(conn, obd);
         if (rc) 
                 GOTO(out, rc);
 
@@ -96,12 +96,12 @@ static int osc_connect(struct obd_conn *conn, struct obd_device *obd)
         return rc;
 }
 
-static int osc_disconnect(struct obd_conn *conn)
+static int osc_disconnect(struct lustre_handle *conn)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
         struct ptlrpc_connection *connection;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         int rc;
         ENTRY;
 
@@ -115,7 +115,7 @@ static int osc_disconnect(struct obd_conn *conn)
         rc = ptlrpc_queue_wait(request);
         if (rc) 
                 GOTO(out, rc);
-        rc = gen_disconnect(conn);
+        rc = class_disconnect(conn);
         if (!rc)
                 MOD_DEC_USE_COUNT;
 
@@ -124,11 +124,11 @@ static int osc_disconnect(struct obd_conn *conn)
         return rc;
 }
 
-static int osc_getattr(struct obd_conn *conn, struct obdo *oa)
+static int osc_getattr(struct lustre_handle *conn, struct obdo *oa)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ptlrpc_connection *connection;
         struct ost_body *body;
         int rc, size = sizeof(*body);
@@ -164,11 +164,11 @@ static int osc_getattr(struct obd_conn *conn, struct obdo *oa)
         return 0;
 }
 
-static int osc_open(struct obd_conn *conn, struct obdo *oa)
+static int osc_open(struct lustre_handle *conn, struct obdo *oa)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ptlrpc_connection *connection;
         struct ost_body *body;
         int rc, size = sizeof(*body);
@@ -202,11 +202,11 @@ static int osc_open(struct obd_conn *conn, struct obdo *oa)
         return 0;
 }
 
-static int osc_close(struct obd_conn *conn, struct obdo *oa)
+static int osc_close(struct lustre_handle *conn, struct obdo *oa)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ptlrpc_connection *connection;
         struct ost_body *body;
         int rc, size = sizeof(*body);
@@ -239,11 +239,11 @@ static int osc_close(struct obd_conn *conn, struct obdo *oa)
         return 0;
 }
 
-static int osc_setattr(struct obd_conn *conn, struct obdo *oa)
+static int osc_setattr(struct lustre_handle *conn, struct obdo *oa)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ptlrpc_connection *connection;
         struct ost_body *body;
         int rc, size = sizeof(*body);
@@ -269,12 +269,12 @@ static int osc_setattr(struct obd_conn *conn, struct obdo *oa)
         return 0;
 }
 
-static int osc_create(struct obd_conn *conn, struct obdo *oa)
+static int osc_create(struct lustre_handle *conn, struct obdo *oa)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
         struct ptlrpc_connection *connection;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ost_body *body;
         struct mds_objid *objid;
         struct lov_object_id *lov_id;
@@ -318,13 +318,13 @@ static int osc_create(struct obd_conn *conn, struct obdo *oa)
         return 0;
 }
 
-static int osc_punch(struct obd_conn *conn, struct obdo *oa, obd_size count,
+static int osc_punch(struct lustre_handle *conn, struct obdo *oa, obd_size count,
                      obd_off offset)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
         struct ptlrpc_connection *connection;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ost_body *body;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -360,12 +360,12 @@ static int osc_punch(struct obd_conn *conn, struct obdo *oa, obd_size count,
         return 0;
 }
 
-static int osc_destroy(struct obd_conn *conn, struct obdo *oa)
+static int osc_destroy(struct lustre_handle *conn, struct obdo *oa)
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
         struct ptlrpc_connection *connection;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ost_body *body;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -422,14 +422,14 @@ static void brw_read_finish(struct ptlrpc_bulk_desc *desc, void *data)
         OBD_FREE(cb_data, sizeof(*cb_data));
 }
 
-static int osc_brw_read(struct obd_conn *conn, obd_count num_oa,
+static int osc_brw_read(struct lustre_handle *conn, obd_count num_oa,
                         struct obdo **oa, obd_count *oa_bufs, struct page **buf,
                         obd_size *count, obd_off *offset, obd_flag *flags,
                         bulk_callback_t callback)
 {
         struct ptlrpc_client *cl;
         struct ptlrpc_connection *connection;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct ptlrpc_request *request;
         struct ost_body *body;
         struct list_head *tmp;
@@ -527,7 +527,7 @@ static void brw_write_finish(struct ptlrpc_bulk_desc *desc, void *data)
         EXIT;
 }
 
-static int osc_brw_write(struct obd_conn *conn, obd_count num_oa,
+static int osc_brw_write(struct lustre_handle *conn, obd_count num_oa,
                          struct obdo **oa, obd_count *oa_bufs,
                          struct page **pagearray, obd_size *count,
                          obd_off *offset, obd_flag *flags,
@@ -537,7 +537,7 @@ static int osc_brw_write(struct obd_conn *conn, obd_count num_oa,
         struct ptlrpc_connection *connection;
         struct ptlrpc_request *request;
         struct ptlrpc_bulk_desc *desc;
-        struct osc_obd *osc = &gen_conn2obd(conn)->u.osc;
+        struct osc_obd *osc = &class_conn2obd(conn)->u.osc;
         struct obd_ioobj ioo;
         struct ost_body *body;
         struct niobuf_local *local;
@@ -654,7 +654,7 @@ static int osc_brw_write(struct obd_conn *conn, obd_count num_oa,
         return rc;
 }
 
-static int osc_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
+static int osc_brw(int cmd, struct lustre_handle *conn, obd_count num_oa,
                    struct obdo **oa, obd_count *oa_bufs, struct page **buf,
                    obd_size *count, obd_off *offset, obd_flag *flags,
                    void *callback)
@@ -670,13 +670,13 @@ static int osc_brw(int cmd, struct obd_conn *conn, obd_count num_oa,
                                     offset, flags, (bulk_callback_t)callback);
 }
 
-static int osc_enqueue(struct obd_conn *oconn,
+static int osc_enqueue(struct lustre_handle *oconn,
                        struct lustre_handle *parent_lock, __u64 *res_id,
                        __u32 type, void *extentp, int extent_len, __u32 mode,
                        int *flags, void *callback, void *data, int datalen,
                        struct lustre_handle *lockh)
 {
-        struct obd_device *obddev = gen_conn2obd(oconn);
+        struct obd_device *obddev = class_conn2obd(oconn);
         struct osc_obd *osc = &obddev->u.osc;
         struct ptlrpc_connection *conn;
         struct ptlrpc_client *cl;
@@ -735,7 +735,7 @@ static int osc_enqueue(struct obd_conn *oconn,
         return rc;
 }
 
-static int osc_cancel(struct obd_conn *oconn, __u32 mode,
+static int osc_cancel(struct lustre_handle *oconn, __u32 mode,
                       struct lustre_handle *lockh)
 {
         ENTRY;
@@ -830,7 +830,7 @@ static int osc_cleanup(struct obd_device * obddev)
 }
 
 #if 0
-static int osc_statfs(struct obd_conn *conn, struct statfs *sfs);
+static int osc_statfs(struct lustre_handle *conn, struct statfs *sfs);
 {
         struct ptlrpc_request *request;
         struct ptlrpc_client *cl;
@@ -880,12 +880,12 @@ struct obd_ops osc_obd_ops = {
 
 static int __init osc_init(void)
 {
-        return obd_register_type(&osc_obd_ops, LUSTRE_OSC_NAME);
+        return class_register_type(&osc_obd_ops, LUSTRE_OSC_NAME);
 }
 
 static void __exit osc_exit(void)
 {
-        obd_unregister_type(LUSTRE_OSC_NAME);
+        class_unregister_type(LUSTRE_OSC_NAME);
 }
 
 MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
index 14b8517..848ddac 100644 (file)
@@ -40,7 +40,7 @@
 
 static int ost_destroy(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -57,7 +57,7 @@ static int ost_destroy(struct ptlrpc_request *req)
 
 static int ost_getattr(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body, *repbody;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -76,7 +76,7 @@ static int ost_getattr(struct ptlrpc_request *req)
 
 static int ost_open(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body, *repbody;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -95,7 +95,7 @@ static int ost_open(struct ptlrpc_request *req)
 
 static int ost_close(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body, *repbody;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -114,7 +114,7 @@ static int ost_close(struct ptlrpc_request *req)
 
 static int ost_create(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body, *repbody;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -133,7 +133,7 @@ static int ost_create(struct ptlrpc_request *req)
 
 static int ost_punch(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body, *repbody;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -153,7 +153,7 @@ static int ost_punch(struct ptlrpc_request *req)
 
 static int ost_setattr(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body, *repbody;
         int rc, size = sizeof(*body);
         ENTRY;
@@ -172,7 +172,7 @@ static int ost_setattr(struct ptlrpc_request *req)
 
 static int ost_get_info(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ost_body *body;
         int rc, size[2] = {sizeof(*body)};
         char *bufs[2] = {NULL, NULL}, *ptr;
@@ -196,7 +196,7 @@ static int ost_get_info(struct ptlrpc_request *req)
 
 static int ost_brw_read(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ptlrpc_bulk_desc *desc;
         void *tmp1, *tmp2, *end2;
         struct niobuf_remote *remote_nb;
@@ -284,7 +284,7 @@ out:
 
 static int ost_brw_write(struct ptlrpc_request *req)
 {
-        struct obd_conn *conn = (struct obd_conn *)req->rq_reqmsg;
+        struct lustre_handle *conn = (struct lustre_handle *)req->rq_reqmsg;
         struct ptlrpc_bulk_desc *desc;
         struct niobuf_remote *remote_nb;
         struct niobuf_local *local_nb, *lnb;
@@ -603,13 +603,13 @@ static struct obd_ops ost_obd_ops = {
 
 static int __init ost_init(void)
 {
-        obd_register_type(&ost_obd_ops, LUSTRE_OST_NAME);
+        class_register_type(&ost_obd_ops, LUSTRE_OST_NAME);
         return 0;
 }
 
 static void __exit ost_exit(void)
 {
-        obd_unregister_type(LUSTRE_OST_NAME);
+        class_unregister_type(LUSTRE_OST_NAME);
 }
 
 MODULE_AUTHOR("Peter J. Braam <braam@clusterfs.com>");
index ec61517..f99cbc8 100644 (file)
@@ -46,7 +46,7 @@ int connmgr_setup(struct obd_device *obddev, obd_count len, void *buf)
         if (err)
                 GOTO(err_free, err);
 
-        recovd->recovd_service = ptlrpc_init_svc(128 * 1024,
+        recovd->recovd_service = ptlrpc_init_svc(16* 1024,
                                                  CONNMGR_REQUEST_PORTAL,
                                                  CONNMGR_REPLY_PORTAL,
                                                  "self", connmgr_handle);
@@ -98,10 +98,10 @@ int connmgr_cleanup(struct obd_device *dev)
 }
 
 
-int connmgr_iocontrol(long cmd, struct obd_conn *conn, int len, void *karg,
+int connmgr_iocontrol(long cmd, struct lustre_handle *conn, int len, void *karg,
                       void *uarg)
 {
-        struct obd_device *obd = gen_conn2obd(conn);
+        struct obd_device *obd = class_conn2obd(conn);
         struct recovd_obd *recovd = &obd->u.recovd;
 
         ENTRY;
@@ -131,13 +131,13 @@ static int __init ptlrpc_init(void)
         if (rc) 
                 RETURN(rc);
         ptlrpc_init_connection();
-        obd_register_type(&recovd_obd_ops, LUSTRE_HA_NAME);
+        class_register_type(&recovd_obd_ops, LUSTRE_HA_NAME);
         return 0;
 }
 
 static void __exit ptlrpc_exit(void)
 {
-        obd_unregister_type(LUSTRE_HA_NAME);
+        class_unregister_type(LUSTRE_HA_NAME);
         ptlrpc_exit_portals();
         ptlrpc_cleanup_connection();
 }
index 6106a4c..f7e8559 100644 (file)
@@ -180,7 +180,7 @@ static int handle_incoming_request(struct obd_device *obddev,
          * We don't know how to find that from here. */
         peer.peer_ni = svc->srv_self.peer_ni;
 
-        request.rq_export = gen_client((struct obd_conn *) request.rq_reqmsg); 
+        request.rq_export = class_conn2export((struct lustre_handle *) request.rq_reqmsg); 
 
         if (request.rq_export) {
                 request.rq_connection = request.rq_export->export_connection;