+++ /dev/null
-/* 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
-
#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 {
#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;
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;
}
}
-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);
}
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 **);
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;
+++ /dev/null
-/* -*- 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
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 {
#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;
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;
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 */
};
#if 0
int lov_count;
- struct obd_conn *lov_targets;
+ struct lustre_handle *lov_targets;
#endif
};
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 */
};
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
#include <linux/lustre_idl.h>
#endif
+
/*
* ======== OBD Device Declarations ===========
*/
#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 */
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);
RETURN(-EINVAL); \
} \
\
- export = gen_client(conn);\
+ export = class_conn2export(conn);\
if (!(export)) { \
CERROR("No export\n"); \
RETURN(-EINVAL); \
} \
} 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;
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;
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;
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;
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;
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;
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;
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;
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);
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;
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;
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;
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)
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)
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)
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;
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,
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;
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;
return oa;
}
-
static __inline__ void obdo_free(struct obdo *oa)
{
if (!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)
{
#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
+++ /dev/null
-#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
+++ /dev/null
-#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
};
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;
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.
#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 */
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
+++ /dev/null
-#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
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;
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;
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)
{
struct obd_device *target;
struct obd_export *export;
- struct obd_conn conn;
+ struct lustre_handle conn;
char *uuid;
int rc, i;
ENTRY;
RETURN(-EINVAL);
}
- i = obd_class_uuid2dev(uuid);
+ i = class_uuid2dev(uuid);
if (i == -1) {
req->rq_status = -ENODEV;
RETURN(-NODEV);
req->rq_repmsg->addr = conn.addr;
req->rq_repmsg->cookie = conn.cookie;
- export = gen_client(&conn);
+ export = class_conn2export(&conn);
if (!export)
LBUG();
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;
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;
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;
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++) {
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++) {
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++) {
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;
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;
struct lov_object_id lov_id;
ENTRY;
- if (!gen_client(conn))
+ if (!class_conn2export(conn))
RETURN(-EINVAL);
md = (struct lov_md *)oa->o_inline;
/* 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++) {
}
/* 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,
if (num_oa != 1)
LBUG();
- if (!gen_client(conn))
+ if (!class_conn2export(conn))
RETURN(-EINVAL);
OBD_ALLOC(cb_data, sizeof(*cb_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;
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;
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,
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,
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);
#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,
{
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>");
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)
{
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,
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)
{
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)
{
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)
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)
{
}
-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)
{
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)};
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)
{
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);
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);
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);
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
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;
RETURN(-ENOMEM);
MOD_INC_USE_COUNT;
- rc = gen_connect(conn, obd);
+ rc = class_connect(conn, obd);
if (rc)
GOTO(out, rc);
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;
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:
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>");
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;
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;
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;
struct mds_obd *mds = &obddev->u.mds;
ENTRY;
- gen_disconnect(&mds->mds_connh);
+ class_disconnect(&mds->mds_connh);
if ( !list_empty(&obddev->obd_exports) ) {
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;
}
{
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>");
/* -*- 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)
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)
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;
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",
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",
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);
} /* 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 = {
&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;
if (err)
return err;
obd_sysctl_init();
- obd_init_magic = 0x11223344;
return 0;
}
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");
* 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;
}
-
/* 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;
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;
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);
/* 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;
* 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);
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);
-}
#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)
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)",
free_page((unsigned long) pathpage);
}
- /* print connections */
+ /* print exports */
{
struct list_head * lh;
struct obd_export * export=0;
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], ")");
}
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);
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;
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;
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)
{
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)
{
{
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>");
}
/* 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;
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;
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))
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;
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))
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))
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;
}
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;
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);
}
/* 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;
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)
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);
}
}
-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;
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)
ENTRY;
memset(res, 0, sizeof(*res) * niocount);
- obd = gen_conn2obd(conn);
+ obd = class_conn2obd(conn);
push_ctxt(&saved, &obd->u.filter.fo_ctxt);
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)
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;
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 ) {
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,
#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
};
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>");
*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;
RETURN(-ENOMEM);
MOD_INC_USE_COUNT;
- rc = gen_connect(conn, obd);
+ rc = class_connect(conn, obd);
if (rc)
GOTO(out, rc);
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;
rc = ptlrpc_queue_wait(request);
if (rc)
GOTO(out, rc);
- rc = gen_disconnect(conn);
+ rc = class_disconnect(conn);
if (!rc)
MOD_DEC_USE_COUNT;
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);
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);
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);
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);
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;
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;
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;
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;
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,
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;
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)
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;
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;
}
#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;
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>");
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;
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;
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;
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;
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;
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;
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;
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;
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;
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;
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>");
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);
}
-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;
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();
}
* 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;