-static int mdc_statfs(struct obd_device *obd, struct obd_statfs *osfs,
- __u64 max_age, __u32 flags)
-{
- struct ptlrpc_request *req;
- struct obd_statfs *msfs;
- struct obd_import *imp = NULL;
- int rc;
- ENTRY;
-
-
- /*Since the request might also come from lprocfs, so we need
- *sync this with client_disconnect_export Bug15684*/
- cfs_down_read(&obd->u.cli.cl_sem);
- if (obd->u.cli.cl_import)
- imp = class_import_get(obd->u.cli.cl_import);
- cfs_up_read(&obd->u.cli.cl_sem);
- if (!imp)
- RETURN(-ENODEV);
-
- req = ptlrpc_request_alloc_pack(imp, &RQF_MDS_STATFS,
- LUSTRE_MDS_VERSION, MDS_STATFS);
- if (req == NULL)
- GOTO(output, rc = -ENOMEM);
-
- ptlrpc_request_set_replen(req);
-
- if (flags & OBD_STATFS_NODELAY) {
- /* procfs requests not want stay in wait for avoid deadlock */
- req->rq_no_resend = 1;
- req->rq_no_delay = 1;
- }
-
- rc = ptlrpc_queue_wait(req);
- if (rc) {
- /* check connection error first */
- if (imp->imp_connect_error)
- rc = imp->imp_connect_error;
- GOTO(out, rc);
- }
-
- msfs = req_capsule_server_get(&req->rq_pill, &RMF_OBD_STATFS);
- if (msfs == NULL)
- GOTO(out, rc = -EPROTO);
-
- *osfs = *msfs;
- EXIT;
-out:
- ptlrpc_req_finished(req);
-output:
- class_import_put(imp);
- return rc;
-}
-