Whamcloud - gitweb
LU-3319 lprocfs: client side cleanups
[fs/lustre-release.git] / lustre / obdecho / echo.c
index dcddc39..8563e68 100644 (file)
@@ -445,7 +445,7 @@ static int echo_preprw(const struct lu_env *env, int cmd,
                 }
         }
 
-        cfs_atomic_add(*pages, &obd->u.echo.eo_prep);
+       atomic_add(*pages, &obd->u.echo.eo_prep);
 
         if (cmd & OBD_BRW_READ)
                 lprocfs_counter_add(obd->obd_stats, LPROC_ECHO_READ_BYTES,
@@ -455,7 +455,7 @@ static int echo_preprw(const struct lu_env *env, int cmd,
                                     tot_bytes);
 
         CDEBUG(D_PAGE, "%d pages allocated after prep\n",
-               cfs_atomic_read(&obd->u.echo.eo_prep));
+              atomic_read(&obd->u.echo.eo_prep));
 
         RETURN(0);
 
@@ -472,7 +472,7 @@ preprw_cleanup:
                  * lose the extra ref gained above */
                 OBD_PAGE_FREE(res[i].page);
                 res[i].page = NULL;
-                cfs_atomic_dec(&obd->u.echo.eo_prep);
+               atomic_dec(&obd->u.echo.eo_prep);
         }
 
         return rc;
@@ -534,14 +534,14 @@ static int echo_commitrw(const struct lu_env *env, int cmd,
 
        }
 
-        cfs_atomic_sub(pgs, &obd->u.echo.eo_prep);
+       atomic_sub(pgs, &obd->u.echo.eo_prep);
 
         CDEBUG(D_PAGE, "%d pages remain after commit\n",
-               cfs_atomic_read(&obd->u.echo.eo_prep));
+              atomic_read(&obd->u.echo.eo_prep));
         RETURN(rc);
 
 commitrw_cleanup:
-        cfs_atomic_sub(pgs, &obd->u.echo.eo_prep);
+       atomic_sub(pgs, &obd->u.echo.eo_prep);
 
         CERROR("cleaning up %d pages (%d obdos)\n",
                niocount - pgs - 1, objcount);
@@ -554,19 +554,25 @@ commitrw_cleanup:
 
                 /* NB see comment above regarding persistent pages */
                 OBD_PAGE_FREE(page);
-                cfs_atomic_dec(&obd->u.echo.eo_prep);
+               atomic_dec(&obd->u.echo.eo_prep);
         }
         return rc;
 }
 
+LPROC_SEQ_FOPS_RO_TYPE(echo, uuid);
+static struct lprocfs_seq_vars lprocfs_echo_obd_vars[] = {
+       { .name =       "uuid",
+         .fops =       &echo_uuid_fops         },
+       { 0 }
+};
+
 static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 {
-        struct lprocfs_static_vars lvars;
-        int                        rc;
-       __u64                      lock_flags = 0;
-        struct ldlm_res_id         res_id = {.name = {1}};
-        char                       ns_name[48];
-        ENTRY;
+       int                     rc;
+       __u64                   lock_flags = 0;
+       struct ldlm_res_id      res_id = {.name = {1}};
+       char                    ns_name[48];
+       ENTRY;
 
         obd->u.echo.eo_obt.obt_magic = OBT_MAGIC;
        spin_lock_init(&obd->u.echo.eo_lock);
@@ -588,8 +594,8 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                                    LVB_T_NONE, NULL, &obd->u.echo.eo_nl_lock);
         LASSERT (rc == ELDLM_OK);
 
-        lprocfs_echo_init_vars(&lvars);
-        if (lprocfs_obd_setup(obd, lvars.obd_vars) == 0 &&
+       obd->obd_vars = lprocfs_echo_obd_vars;
+       if (lprocfs_seq_obd_setup(obd) == 0 &&
             lprocfs_alloc_obd_stats(obd, LPROC_ECHO_LAST) == 0) {
                 lprocfs_counter_init(obd->obd_stats, LPROC_ECHO_READ_BYTES,
                                      LPROCFS_CNTR_AVGMINMAX,
@@ -606,26 +612,26 @@ static int echo_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
 
 static int echo_cleanup(struct obd_device *obd)
 {
-        int leaked;
-        ENTRY;
+       int leaked;
+       ENTRY;
 
-        lprocfs_obd_cleanup(obd);
-        lprocfs_free_obd_stats(obd);
+       lprocfs_obd_cleanup(obd);
+       lprocfs_free_obd_stats(obd);
 
-        ldlm_lock_decref(&obd->u.echo.eo_nl_lock, LCK_NL);
+       ldlm_lock_decref(&obd->u.echo.eo_nl_lock, LCK_NL);
 
-        /* XXX Bug 3413; wait for a bit to ensure the BL callback has
-         * happened before calling ldlm_namespace_free() */
-        cfs_schedule_timeout_and_set_state(CFS_TASK_UNINT, cfs_time_seconds(1));
+       /* XXX Bug 3413; wait for a bit to ensure the BL callback has
+        * happened before calling ldlm_namespace_free() */
+       schedule_timeout_and_set_state(TASK_UNINTERRUPTIBLE, cfs_time_seconds(1));
 
-        ldlm_namespace_free(obd->obd_namespace, NULL, obd->obd_force);
-        obd->obd_namespace = NULL;
+       ldlm_namespace_free(obd->obd_namespace, NULL, obd->obd_force);
+       obd->obd_namespace = NULL;
 
-        leaked = cfs_atomic_read(&obd->u.echo.eo_prep);
-        if (leaked != 0)
-                CERROR("%d prep/commitrw pages leaked\n", leaked);
+       leaked = atomic_read(&obd->u.echo.eo_prep);
+       if (leaked != 0)
+               CERROR("%d prep/commitrw pages leaked\n", leaked);
 
-        RETURN(0);
+       RETURN(0);
 }
 
 struct obd_ops echo_obd_ops = {