-
-int obd_self_statfs(struct obd_device *obd, struct statfs *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);