struct lprocfs_static_vars lvars;
lprocfs_init_vars(cobd, &lvars);
- return lprocfs_obd_attach(dev, lvars.obd_vars);
+ return lprocfs_obd_attach(dev, lvars.obd_vars);
}
static int cobd_detach(struct obd_device *dev)
{
- return lprocfs_obd_detach(dev);
+ return lprocfs_obd_detach(dev);
}
static int
static int cobd_disconnect(struct lustre_handle *conn, int flags)
{
- int rc = class_disconnect(conn, flags);
+ int rc = class_disconnect(conn, flags);
CERROR ("rc %d\n", rc);
- return (rc);
+ return (rc);
}
static int
return obd_get_info(&cobd->cobd_target, keylen, key, vallen, val);
}
-static int cobd_statfs(struct obd_export *exp, struct obd_statfs *osfs)
+static int cobd_statfs(struct obd_device *obd, struct obd_statfs *osfs,
+ unsigned long max_age)
{
- struct obd_export *cobd_exp;
- int rc;
-
- if (exp->exp_obd == NULL)
- return -EINVAL;
-
- cobd_exp = class_conn2export(&exp->exp_obd->u.cobd.cobd_target);
- rc = obd_statfs(cobd_exp, osfs);
- class_export_put(cobd_exp);
- return rc;
+ return obd_statfs(class_conn2obd(&obd->u.cobd.cobd_target), osfs,
+ max_age);
}
-static int
-cobd_getattr(struct lustre_handle *conn, struct obdo *oa,
- struct lov_stripe_md *lsm)
+static int cobd_getattr(struct lustre_handle *conn, struct obdo *oa,
+ struct lov_stripe_md *lsm)
{
struct obd_device *obd = class_conn2obd(conn);
struct cache_obd *cobd;
struct lprocfs_static_vars lvars;
ENTRY;
- printk(KERN_INFO "Lustre Caching OBD driver; info@clusterfs.com\n");
+ printk(KERN_INFO "Lustre Caching OBD driver; info@clusterfs.com\n");
lprocfs_init_vars(cobd, &lvars);
RETURN(class_register_type(&cobd_ops, lvars.module_vars,
static void /*__exit*/ cobd_exit(void)
{
- class_unregister_type(OBD_CACHE_DEVICENAME);
+ class_unregister_type(OBD_CACHE_DEVICENAME);
}
MODULE_AUTHOR("Cluster File Systems, Inc. <info@clusterfs.com>");
static struct lprocfs_vars lprocfs_module_vars[] = { {0} };
#else
/* Common STATUS namespace */
-static int rd_target(char *page, char **start, off_t off, int count,
- int *eof, void *data)
+static int cobd_rd_target(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
{
- struct obd_device *dev = (struct obd_device*)data;
- struct lustre_handle *conn;
- struct obd_export *exp;
- int rc;
+ struct obd_device *cobd = (struct obd_device *)data;
+ int rc;
- LASSERT(dev != NULL);
- conn = &dev->u.cobd.cobd_target;
+ LASSERT(cobd != NULL);
- if (!dev->obd_set_up) {
- rc = snprintf (page, count, "not set up\n");
- } else {
- exp = class_conn2export(conn);
- LASSERT(exp != NULL);
- rc = snprintf(page, count, "%s\n",
- exp->exp_obd->obd_uuid.uuid);
- class_export_put(exp);
- }
- return (rc);
+ if (!cobd->obd_set_up) {
+ rc = snprintf(page, count, "not set up\n");
+ } else {
+ struct obd_device *tgt =
+ class_conn2obd(&cobd->u.cobd.cobd_target);
+ LASSERT(tgt != NULL);
+ rc = snprintf(page, count, "%s\n", tgt->obd_uuid.uuid);
+ }
+ return rc;
}
-static int rd_cache(char *page, char **start, off_t off, int count,
- int *eof, void *data)
+static int cobd_rd_cache(char *page, char **start, off_t off, int count,
+ int *eof, void *data)
{
- struct obd_device *dev = (struct obd_device*)data;
- struct lustre_handle *conn;
- struct obd_export *exp;
- int rc;
+ struct obd_device *cobd = (struct obd_device*)data;
+ int rc;
- LASSERT(dev != NULL);
- conn = &dev->u.cobd.cobd_cache;
+ LASSERT(cobd != NULL);
- if (!dev->obd_set_up) {
- rc = snprintf (page, count, "not set up\n");
+ if (!cobd->obd_set_up) {
+ rc = snprintf(page, count, "not set up\n");
} else {
- exp = class_conn2export(conn);
- LASSERT (exp != NULL);
- rc = snprintf(page, count, "%s\n",
- exp->exp_obd->obd_uuid.uuid);
- class_export_put(exp);
- }
- return (rc);
+ struct obd_device *cache =
+ class_conn2obd(&cobd->u.cobd.cobd_cache);
+ LASSERT(cache != NULL);
+ rc = snprintf(page, count, "%s\n", cache->obd_uuid.uuid);
+ }
+ return rc;
}
static struct lprocfs_vars lprocfs_obd_vars[] = {
- { "uuid", lprocfs_rd_uuid, 0, 0 },
- { "target_uuid", rd_target, 0, 0 },
- { "cache_uuid", rd_cache, 0, 0 },
+ { "uuid", lprocfs_rd_uuid, 0, 0 },
+ { "target_uuid", cobd_rd_target, 0, 0 },
+ { "cache_uuid", cobd_rd_cache, 0, 0 },
{ 0 }
};
-static struct lprocfs_vars lprocfs_module_vars[] = {
- { "num_refs", lprocfs_rd_numrefs, 0, 0 },
+struct lprocfs_vars lprocfs_module_vars[] = {
+ { "num_refs", lprocfs_rd_numrefs, 0, 0 },
{ 0 }
};
#endif /* LPROCFS */
void statfs_pack(struct obd_statfs *osfs, struct kstatfs *sfs)
{
+ memset(osfs, 0, sizeof(*osfs));
osfs->os_type = sfs->f_type;
osfs->os_blocks = sfs->f_blocks;
osfs->os_bfree = sfs->f_bfree;
void statfs_unpack(struct kstatfs *sfs, struct obd_statfs *osfs)
{
+ memset(sfs, 0, sizeof(*sfs));
sfs->f_type = osfs->os_type;
sfs->f_blocks = osfs->os_blocks;
sfs->f_bfree = osfs->os_bfree;
sfs->f_namelen = osfs->os_namelen;
}
-int obd_self_statfs(struct obd_device *obd, struct kstatfs *sfs)
-{
- struct obd_export *export, *my_export = NULL;
- struct obd_statfs osfs = { 0 };
- int rc;
- ENTRY;
-
- LASSERT( obd != NULL );
-
- spin_lock(&obd->obd_dev_lock);
- if (list_empty(&obd->obd_exports)) {
- spin_unlock(&obd->obd_dev_lock);
- export = my_export = class_new_export(obd);
- if (export == NULL)
- RETURN(-ENOMEM);
- } else {
- export = list_entry(obd->obd_exports.next, typeof(*export),
- exp_obd_chain);
- export = class_export_get(export);
- spin_unlock(&obd->obd_dev_lock);
- }
-
- rc = obd_statfs(export, &osfs);
- if (!rc)
- statfs_unpack(sfs, &osfs);
-
- if (my_export)
- class_unlink_export(my_export);
-
- class_export_put(export);
- RETURN(rc);
-}
-
EXPORT_SYMBOL(statfs_pack);
EXPORT_SYMBOL(statfs_unpack);
-EXPORT_SYMBOL(obd_self_statfs);