Whamcloud - gitweb
LU-12616 obclass: fix MDS start/stop race
[fs/lustre-release.git] / lustre / osp / osp_dev.c
index aeb1113..dc3249b 100644 (file)
@@ -730,7 +730,7 @@ const struct lu_device_operations osp_lu_ops = {
  * \retval negative    negative errno if get statfs failed.
  */
 static int osp_statfs(const struct lu_env *env, struct dt_device *dev,
-                     struct obd_statfs *sfs)
+                     struct obd_statfs *sfs, struct obd_statfs_info *info)
 {
        struct osp_device *d = dt2osp_dev(dev);
        struct obd_import *imp = d->opd_obd->u.cli.cl_import;
@@ -745,10 +745,25 @@ static int osp_statfs(const struct lu_env *env, struct dt_device *dev,
 
        /* return recently updated data */
        *sfs = d->opd_statfs;
+       if (info) {
+               info->os_reserved_mb_low = d->opd_reserved_mb_low;
+               info->os_reserved_mb_high = d->opd_reserved_mb_high;
+       }
 
        if (d->opd_pre == NULL)
                RETURN(0);
 
+       CDEBUG(D_OTHER, "%s: %llu blocks, %llu free, %llu avail, "
+              "%u reserved mb low, %u reserved mb high,"
+              "%llu files, %llu free files\n", d->opd_obd->obd_name,
+              sfs->os_blocks, sfs->os_bfree, sfs->os_bavail,
+              d->opd_reserved_mb_low, d->opd_reserved_mb_high,
+              sfs->os_files, sfs->os_ffree);
+
+
+       if (info && !info->os_enable_pre)
+               RETURN(0);
+
        /*
         * layer above osp (usually lod) can use ffree to estimate
         * how many objects are available for immediate creation
@@ -762,11 +777,6 @@ static int osp_statfs(const struct lu_env *env, struct dt_device *dev,
                 PFID(&d->opd_pre_last_created_fid), PFID(&d->opd_pre_used_fid),
                 d->opd_pre_reserved);
        spin_unlock(&d->opd_pre_lock);
-
-       CDEBUG(D_OTHER, "%s: %llu blocks, %llu free, %llu avail, "
-              "%llu files, %llu free files\n", d->opd_obd->obd_name,
-              sfs->os_blocks, sfs->os_bfree, sfs->os_bavail,
-              sfs->os_files, sfs->os_ffree);
        RETURN(0);
 }
 
@@ -1329,7 +1339,6 @@ static struct lu_device *osp_device_fini(const struct lu_env *env,
        }
 
        LASSERT(osp->opd_obd);
-       osp_tunables_fini(osp);
 
        rc = client_obd_cleanup(osp->opd_obd);
        if (rc != 0) {
@@ -1337,6 +1346,8 @@ static struct lu_device *osp_device_fini(const struct lu_env *env,
                RETURN(ERR_PTR(rc));
        }
 
+       osp_tunables_fini(osp);
+
        ptlrpcd_decref();
 
        RETURN(NULL);
@@ -1933,10 +1944,9 @@ static int __init osp_init(void)
  */
 static void __exit osp_exit(void)
 {
-       if (!IS_ERR_OR_NULL(sym)) {
-               ldebugfs_remove(&sym->typ_debugfs_entry);
+       if (!IS_ERR_OR_NULL(sym))
                kobject_put(&sym->typ_kobj);
-       }
+
        class_unregister_type(LUSTRE_LWP_NAME);
        class_unregister_type(LUSTRE_OSP_NAME);
        lu_kmem_fini(osp_caches);