#include <linux/lustre_export.h>
#include <linux/lustre_quota.h>
+#include <linux/lu_object.h>
+
/* this is really local to the OSC */
struct loi_oap_pages {
struct list_head lop_pending;
struct proc_dir_entry *typ_procroot;
char *typ_name;
int typ_refcnt;
+ struct lu_device_type *typ_lu;
};
struct brw_page {
char *obd_name;
struct obd_uuid obd_uuid;
+ struct lu_device *obd_lu_dev;
+
int obd_minor;
unsigned int obd_attached:1, obd_set_up:1, obd_recovering:1,
obd_abort_recovery:1, obd_replayable:1, obd_no_transno:1,
__u32 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_setup) (struct obd_device *dev, struct lustre_cfg *cfg);
int (*o_precleanup)(struct obd_device *dev, int cleanup_stage);
int (*o_cleanup)(struct obd_device *dev);
int (*o_process_config)(struct obd_device *dev, obd_count len,
int (*o_packmd)(struct obd_export *exp, struct lov_mds_md **disk_tgt,
struct lov_stripe_md *mem_src);
int (*o_unpackmd)(struct obd_export *exp,struct lov_stripe_md **mem_tgt,
- struct lov_mds_md *disk_src, int disk_len);
- int (*o_checkmd)(struct obd_export *exp, struct obd_export *md_exp,
+ struct lov_mds_md *disk_src, int disk_len);
+ int (*o_checkmd)(struct obd_export *exp, struct obd_export *md_exp,
struct lov_stripe_md *mem_tgt);
int (*o_preallocate)(struct lustre_handle *, obd_count *req,
obd_id *ids);
int (*o_create)(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md **ea, struct obd_trans_info *oti);
int (*o_destroy)(struct obd_export *exp, struct obdo *oa,
- struct lov_stripe_md *ea, struct obd_trans_info *oti,
+ struct lov_stripe_md *ea, struct obd_trans_info *oti,
struct obd_export *md_exp);
int (*o_setattr)(struct obd_export *exp, struct obdo *oa,
struct lov_stripe_md *ea, struct obd_trans_info *oti);
struct lsm_operations {
void (*lsm_free)(struct lov_stripe_md *);
- int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa,
+ int (*lsm_destroy)(struct lov_stripe_md *, struct obdo *oa,
struct obd_export *md_exp);
void (*lsm_stripe_by_index)(struct lov_stripe_md *, int *, obd_off *,
unsigned long *);
struct super_block *cfg_sb;
struct obd_uuid cfg_uuid;
int cfg_last_idx; /* for partial llog processing */
- int cfg_flags;
+ int cfg_flags;
};
int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
struct config_llog_instance *cfg);
RETURN(rc);
}
-static inline int obd_setup(struct obd_device *obd, int datalen, void *data)
+static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
{
int rc;
+ struct lu_device_type *ldt;
ENTRY;
- OBD_CHECK_OP(obd, setup, -EOPNOTSUPP);
- OBD_COUNTER_INCREMENT(obd, setup);
+ ldt = obd->obd_type->typ_lu;
+ if (ldt != NULL) {
+ struct lu_device *d;
- rc = OBP(obd, setup)(obd, datalen, data);
+ d = ldt->ldt_ops->ldto_device_alloc(ldt, cfg);
+ if (!IS_ERR(d)) {
+ obd->obd_lu_dev = d;
+ rc = 0;
+ } else
+ rc = PTR_ERR(d);
+ } else {
+ OBD_CHECK_OP(obd, setup, -EOPNOTSUPP);
+ OBD_COUNTER_INCREMENT(obd, setup);
+ rc = OBP(obd, setup)(obd, cfg);
+ }
RETURN(rc);
}
static inline int obd_cleanup(struct obd_device *obd)
{
int rc;
+ struct lu_device *d;
+ struct lu_device_type *ldt;
ENTRY;
OBD_CHECK_DEV(obd);
- OBD_CHECK_OP(obd, cleanup, 0);
- OBD_COUNTER_INCREMENT(obd, cleanup);
- rc = OBP(obd, cleanup)(obd);
+ ldt = obd->obd_type->typ_lu;
+ d = obd->obd_lu_dev;
+ if (ldt != NULL && d != NULL) {
+ ldt->ldt_ops->ldto_device_free(d);
+ obd->obd_lu_dev = NULL;
+ rc = 0;
+ } else {
+ OBD_CHECK_OP(obd, cleanup, 0);
+ rc = OBP(obd, cleanup)(obd);
+ }
+ OBD_COUNTER_INCREMENT(obd, cleanup);
RETURN(rc);
}
exp->exp_obd);
}
-static inline int
+static inline int
obd_lvfs_open_llog(struct obd_export *exp, __u64 id_ino, struct dentry *dentry)
{
LASSERT(exp->exp_obd);
CERROR("FIXME what's the story here? This needs to be an obd fn?\n");
#if 0
- return lvfs_open_llog(&exp->exp_obd->obd_lvfs_ctxt, id_ino,
+ return lvfs_open_llog(&exp->exp_obd->obd_lvfs_ctxt, id_ino,
dentry, exp->exp_obd);
#endif
return 0;
{
int rc;
ENTRY;
-
+
OBD_CHECK_OP(exp->exp_obd, merge_lvb, -EOPNOTSUPP);
OBD_COUNTER_INCREMENT(exp->exp_obd, merge_lvb);
/* the check for async_recov is a complete hack - I'm hereby
overloading the meaning to also mean "this was called from
mds_postsetup". I know that my mds is able to handle notifies
- by this point, and it needs to get them to execute mds_postrecov. */
+ by this point, and it needs to get them to execute mds_postrecov. */
if (!obd->obd_set_up && !obd->obd_async_recov) {
CDEBUG(D_HA, "obd %s not set up\n", obd->obd_name);
return -EINVAL;
#ifdef CONFIG_KMOD
if (!type) {
char *modname = name;
- if (strcmp(modname, LUSTRE_MDT_NAME) == 0)
+ if (strcmp(modname, LUSTRE_MDT_NAME) == 0)
modname = LUSTRE_MDS_NAME;
if (!request_module(modname)) {
CDEBUG(D_INFO, "Loaded module '%s'\n", modname);
type->typ_procroot = NULL;
}
+ if (type->typ_lu)
+ type->typ_lu->ldt_ops->ldto_fini(type->typ_lu);
+
spin_lock(&obd_types_lock);
list_del(&type->typ_chain);
spin_unlock(&obd_types_lock);
{
if (exp->exp_connection != NULL)
return libcfs_nid2str(exp->exp_connection->c_peer.nid);
-
+
return "(no nid)";
}
EXPORT_SYMBOL(obd_export_nid2str);