Whamcloud - gitweb
LU-3285 mdc: add IO stats in mdc 19/28019/26
authorMikhal Pershin <mike.pershin@intel.com>
Fri, 11 Dec 2015 10:18:17 +0000 (13:18 +0300)
committerMike Pershin <mike.pershin@intel.com>
Tue, 17 Oct 2017 20:22:29 +0000 (20:22 +0000)
Add IO statistic into MDC like in OSC

Signed-off-by: Mikhal Pershin <mike.pershin@intel.com>
Change-Id: I2763ef56fe5dac5c7f04309ce81bbed7b71af37d
Reviewed-on: https://review.whamcloud.com/28019
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
12 files changed:
lustre/include/lustre_dlm.h
lustre/include/lustre_osc.h
lustre/ldlm/ldlm_lockd.c
lustre/ldlm/ldlm_request.c
lustre/mdc/lproc_mdc.c
lustre/mdc/mdc_request.c
lustre/mdt/mdt_handler.c
lustre/obdclass/genops.c
lustre/ofd/ofd_dlm.c
lustre/osc/osc_cache.c
lustre/osc/osc_internal.h
lustre/osc/osc_page.c

index 5f1dc20..1c6a8d8 100644 (file)
@@ -1490,8 +1490,41 @@ void ldlm_namespace_put(struct ldlm_namespace *ns);
 int ldlm_proc_setup(void);
 #ifdef CONFIG_PROC_FS
 void ldlm_proc_cleanup(void);
 int ldlm_proc_setup(void);
 #ifdef CONFIG_PROC_FS
 void ldlm_proc_cleanup(void);
+
+static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,
+                                    struct lprocfs_stats *srv_stats)
+{
+       int lock_type = 0, op = 0;
+
+       lock_type = dlm_req->lock_desc.l_resource.lr_type;
+
+       switch (lock_type) {
+       case LDLM_PLAIN:
+               op = PTLRPC_LAST_CNTR + LDLM_PLAIN_ENQUEUE;
+               break;
+       case LDLM_EXTENT:
+               op = PTLRPC_LAST_CNTR + LDLM_EXTENT_ENQUEUE;
+               break;
+       case LDLM_FLOCK:
+               op = PTLRPC_LAST_CNTR + LDLM_FLOCK_ENQUEUE;
+               break;
+       case LDLM_IBITS:
+               op = PTLRPC_LAST_CNTR + LDLM_IBITS_ENQUEUE;
+               break;
+       default:
+               op = 0;
+               break;
+       }
+
+       if (op != 0)
+               lprocfs_counter_incr(srv_stats, op);
+
+       return;
+}
 #else
 static inline void ldlm_proc_cleanup(void) {}
 #else
 static inline void ldlm_proc_cleanup(void) {}
+static inline void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,
+                                    struct lprocfs_stats *srv_stats) {}
 #endif
 
 /* resource.c - internal */
 #endif
 
 /* resource.c - internal */
index f9777bb..d2a3d8d 100644 (file)
@@ -565,6 +565,8 @@ void osc_lru_add_batch(struct client_obd *cli, struct list_head *list);
 void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
                     enum cl_req_type crt, int brw_flags);
 int lru_queue_work(const struct lu_env *env, void *data);
 void osc_page_submit(const struct lu_env *env, struct osc_page *opg,
                     enum cl_req_type crt, int brw_flags);
 int lru_queue_work(const struct lu_env *env, void *data);
+long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
+                   long target, bool force);
 
 /* osc_cache.c */
 int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops);
 
 /* osc_cache.c */
 int osc_cancel_async_page(const struct lu_env *env, struct osc_page *ops);
@@ -591,6 +593,7 @@ int osc_cache_wait_range(const struct lu_env *env, struct osc_object *obj,
                         pgoff_t start, pgoff_t end);
 int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli,
                   struct osc_object *osc, int async);
                         pgoff_t start, pgoff_t end);
 int osc_io_unplug0(const struct lu_env *env, struct client_obd *cli,
                   struct osc_object *osc, int async);
+void osc_wake_cache_waiters(struct client_obd *cli);
 
 static inline int osc_io_unplug_async(const struct lu_env *env,
                                      struct client_obd *cli,
 
 static inline int osc_io_unplug_async(const struct lu_env *env,
                                      struct client_obd *cli,
index 2396a6c..383b391 100644 (file)
@@ -1185,40 +1185,6 @@ struct ldlm_lock *ldlm_request_lock(struct ptlrpc_request *req)
 }
 EXPORT_SYMBOL(ldlm_request_lock);
 
 }
 EXPORT_SYMBOL(ldlm_request_lock);
 
-static void ldlm_svc_get_eopc(const struct ldlm_request *dlm_req,
-                       struct lprocfs_stats *srv_stats)
-{
-        int lock_type = 0, op = 0;
-
-        lock_type = dlm_req->lock_desc.l_resource.lr_type;
-
-        switch (lock_type) {
-        case LDLM_PLAIN:
-                op = PTLRPC_LAST_CNTR + LDLM_PLAIN_ENQUEUE;
-                break;
-        case LDLM_EXTENT:
-                if (dlm_req->lock_flags & LDLM_FL_HAS_INTENT)
-                        op = PTLRPC_LAST_CNTR + LDLM_GLIMPSE_ENQUEUE;
-                else
-                        op = PTLRPC_LAST_CNTR + LDLM_EXTENT_ENQUEUE;
-                break;
-        case LDLM_FLOCK:
-                op = PTLRPC_LAST_CNTR + LDLM_FLOCK_ENQUEUE;
-                break;
-        case LDLM_IBITS:
-                op = PTLRPC_LAST_CNTR + LDLM_IBITS_ENQUEUE;
-                break;
-        default:
-                op = 0;
-                break;
-        }
-
-        if (op)
-                lprocfs_counter_incr(srv_stats, op);
-
-        return;
-}
-
 /**
  * Main server-side entry point into LDLM for enqueue. This is called by ptlrpc
  * service threads to carry out client lock enqueueing requests.
 /**
  * Main server-side entry point into LDLM for enqueue. This is called by ptlrpc
  * service threads to carry out client lock enqueueing requests.
@@ -1244,7 +1210,9 @@ int ldlm_handle_enqueue0(struct ldlm_namespace *ns,
 
        LASSERT(req->rq_export);
 
 
        LASSERT(req->rq_export);
 
-       if (ptlrpc_req2svc(req)->srv_stats != NULL)
+       /* for intent enqueue the stat will be updated inside intent policy */
+       if (ptlrpc_req2svc(req)->srv_stats != NULL &&
+           !(dlm_req->lock_flags & LDLM_FL_HAS_INTENT))
                ldlm_svc_get_eopc(dlm_req, ptlrpc_req2svc(req)->srv_stats);
 
         if (req->rq_export && req->rq_export->exp_nid_stats &&
                ldlm_svc_get_eopc(dlm_req, ptlrpc_req2svc(req)->srv_stats);
 
         if (req->rq_export && req->rq_export->exp_nid_stats &&
index 2d0835f..72f0049 100644 (file)
@@ -976,6 +976,28 @@ int ldlm_cli_enqueue(struct obd_export *exp, struct ptlrpc_request **reqp,
        body->lock_flags = ldlm_flags_to_wire(*flags);
        body->lock_handle[0] = *lockh;
 
        body->lock_flags = ldlm_flags_to_wire(*flags);
        body->lock_handle[0] = *lockh;
 
+       /* extended LDLM opcodes in client stats */
+       if (exp->exp_obd->obd_svc_stats != NULL) {
+               bool glimpse = *flags & LDLM_FL_HAS_INTENT;
+
+               /* OST glimpse has no intent buffer */
+               if (req_capsule_has_field(&req->rq_pill, &RMF_LDLM_INTENT,
+                                         RCL_CLIENT)) {
+                       struct ldlm_intent *it;
+
+                       it = req_capsule_client_get(&req->rq_pill,
+                                                   &RMF_LDLM_INTENT);
+                       glimpse = (it && (it->opc == IT_GLIMPSE));
+               }
+
+               if (!glimpse)
+                       ldlm_svc_get_eopc(body, exp->exp_obd->obd_svc_stats);
+               else
+                       lprocfs_counter_incr(exp->exp_obd->obd_svc_stats,
+                                            PTLRPC_LAST_CNTR +
+                                            LDLM_GLIMPSE_ENQUEUE);
+       }
+
        if (async) {
                LASSERT(reqp != NULL);
                RETURN(0);
        if (async) {
                LASSERT(reqp != NULL);
                RETURN(0);
index f9818e3..ff148f1 100644 (file)
@@ -35,6 +35,8 @@
 #include <linux/vfs.h>
 #include <obd_class.h>
 #include <lprocfs_status.h>
 #include <linux/vfs.h>
 #include <obd_class.h>
 #include <lprocfs_status.h>
+#include <lustre_osc.h>
+#include <cl_object.h>
 
 #include "mdc_internal.h"
 
 
 #include "mdc_internal.h"
 
@@ -75,6 +77,161 @@ static ssize_t mdc_active_seq_write(struct file *file,
 }
 LPROC_SEQ_FOPS(mdc_active);
 
 }
 LPROC_SEQ_FOPS(mdc_active);
 
+static int mdc_max_dirty_mb_seq_show(struct seq_file *m, void *v)
+{
+       struct obd_device *dev = m->private;
+       struct client_obd *cli = &dev->u.cli;
+       long val;
+       int mult;
+
+       spin_lock(&cli->cl_loi_list_lock);
+       val = cli->cl_dirty_max_pages;
+       spin_unlock(&cli->cl_loi_list_lock);
+
+       mult = 1 << (20 - PAGE_SHIFT);
+       return lprocfs_seq_read_frac_helper(m, val, mult);
+}
+
+static ssize_t mdc_max_dirty_mb_seq_write(struct file *file,
+                                         const char __user *buffer,
+                                         size_t count, loff_t *off)
+{
+       struct seq_file *sfl = file->private_data;
+       struct obd_device *dev = sfl->private;
+       struct client_obd *cli = &dev->u.cli;
+       __s64 pages_number;
+       int rc;
+
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &pages_number, 'M');
+       if (rc)
+               return rc;
+
+       pages_number >>= PAGE_SHIFT;
+
+       if (pages_number <= 0 ||
+           pages_number >= OSC_MAX_DIRTY_MB_MAX << (20 - PAGE_SHIFT) ||
+           pages_number > totalram_pages / 4) /* 1/4 of RAM */
+               return -ERANGE;
+
+       spin_lock(&cli->cl_loi_list_lock);
+       cli->cl_dirty_max_pages = pages_number;
+       osc_wake_cache_waiters(cli);
+       spin_unlock(&cli->cl_loi_list_lock);
+
+       return count;
+}
+LPROC_SEQ_FOPS(mdc_max_dirty_mb);
+
+static int mdc_cached_mb_seq_show(struct seq_file *m, void *v)
+{
+       struct obd_device *dev = m->private;
+       struct client_obd *cli = &dev->u.cli;
+       int shift = 20 - PAGE_SHIFT;
+
+       seq_printf(m, "used_mb: %ld\n"
+                  "busy_cnt: %ld\n"
+                  "reclaim: %llu\n",
+                  (atomic_long_read(&cli->cl_lru_in_list) +
+                   atomic_long_read(&cli->cl_lru_busy)) >> shift,
+                   atomic_long_read(&cli->cl_lru_busy),
+                  cli->cl_lru_reclaim);
+
+       return 0;
+}
+
+/* shrink the number of caching pages to a specific number */
+static ssize_t
+mdc_cached_mb_seq_write(struct file *file, const char __user *buffer,
+                       size_t count, loff_t *off)
+{
+       struct seq_file *sfl = file->private_data;
+       struct obd_device *dev = sfl->private;
+       struct client_obd *cli = &dev->u.cli;
+       __s64 pages_number;
+       long rc;
+       char kernbuf[128];
+
+       if (count >= sizeof(kernbuf))
+               return -EINVAL;
+
+       if (copy_from_user(kernbuf, buffer, count))
+               return -EFAULT;
+       kernbuf[count] = 0;
+
+       buffer += lprocfs_find_named_value(kernbuf, "used_mb:", &count) -
+                 kernbuf;
+       rc = lprocfs_str_with_units_to_s64(buffer, count, &pages_number, 'M');
+       if (rc)
+               return rc;
+
+       pages_number >>= PAGE_SHIFT;
+
+       if (pages_number < 0)
+               return -ERANGE;
+
+       rc = atomic_long_read(&cli->cl_lru_in_list) - pages_number;
+       if (rc > 0) {
+               struct lu_env *env;
+               __u16 refcheck;
+
+               env = cl_env_get(&refcheck);
+               if (!IS_ERR(env)) {
+                       (void)osc_lru_shrink(env, cli, rc, true);
+                       cl_env_put(env, &refcheck);
+               }
+       }
+
+       return count;
+}
+LPROC_SEQ_FOPS(mdc_cached_mb);
+
+static int mdc_contention_seconds_seq_show(struct seq_file *m, void *v)
+{
+       struct obd_device *obd = m->private;
+       struct osc_device *od  = obd2osc_dev(obd);
+
+       seq_printf(m, "%u\n", od->od_contention_time);
+       return 0;
+}
+
+static ssize_t mdc_contention_seconds_seq_write(struct file *file,
+                                               const char __user *buffer,
+                                               size_t count, loff_t *off)
+{
+       struct seq_file *sfl = file->private_data;
+       struct obd_device *obd = sfl->private;
+       struct osc_device *od  = obd2osc_dev(obd);
+       int rc;
+       __s64 val;
+
+       rc = lprocfs_str_to_s64(buffer, count, &val);
+       if (rc)
+               return rc;
+       if (val < 0 || val > INT_MAX)
+               return -ERANGE;
+
+       od->od_contention_time = val;
+
+       return count;
+}
+LPROC_SEQ_FOPS(mdc_contention_seconds);
+
+static int mdc_unstable_stats_seq_show(struct seq_file *m, void *v)
+{
+       struct obd_device *dev = m->private;
+       struct client_obd *cli = &dev->u.cli;
+       long pages;
+       int mb;
+
+       pages = atomic_long_read(&cli->cl_unstable_count);
+       mb    = (pages * PAGE_SIZE) >> 20;
+
+       seq_printf(m, "unstable_pages: %20ld\n"
+                  "unstable_mb:              %10d\n", pages, mb);
+       return 0;
+}
+LPROC_SEQ_FOPS_RO(mdc_unstable_stats);
+
 static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device *dev = m->private;
 static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
 {
        struct obd_device *dev = m->private;
@@ -125,11 +282,11 @@ static ssize_t mdc_max_mod_rpcs_in_flight_seq_write(struct file *file,
                                                    const char __user *buffer,
                                                    size_t count, loff_t *off)
 {
                                                    const char __user *buffer,
                                                    size_t count, loff_t *off)
 {
-       struct obd_device *dev =
-                       ((struct seq_file *)file->private_data)->private;
+       struct obd_device *dev;
        __s64 val;
        int rc;
 
        __s64 val;
        int rc;
 
+       dev =  ((struct seq_file *)file->private_data)->private;
        rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
        rc = lprocfs_str_to_s64(buffer, count, &val);
        if (rc)
                return rc;
@@ -145,13 +302,6 @@ static ssize_t mdc_max_mod_rpcs_in_flight_seq_write(struct file *file,
 }
 LPROC_SEQ_FOPS(mdc_max_mod_rpcs_in_flight);
 
 }
 LPROC_SEQ_FOPS(mdc_max_mod_rpcs_in_flight);
 
-static int mdc_rpc_stats_seq_show(struct seq_file *seq, void *v)
-{
-       struct obd_device *dev = seq->private;
-
-       return obd_mod_rpc_stats_seq_show(&dev->u.cli, seq);
-}
-
 static ssize_t mdc_rpc_stats_seq_write(struct file *file,
                                       const char __user *buf,
                                       size_t len, loff_t *off)
 static ssize_t mdc_rpc_stats_seq_write(struct file *file,
                                       const char __user *buf,
                                       size_t len, loff_t *off)
@@ -162,10 +312,144 @@ static ssize_t mdc_rpc_stats_seq_write(struct file *file,
 
        lprocfs_oh_clear(&cli->cl_mod_rpcs_hist);
 
 
        lprocfs_oh_clear(&cli->cl_mod_rpcs_hist);
 
+       lprocfs_oh_clear(&cli->cl_read_rpc_hist);
+       lprocfs_oh_clear(&cli->cl_write_rpc_hist);
+       lprocfs_oh_clear(&cli->cl_read_page_hist);
+       lprocfs_oh_clear(&cli->cl_write_page_hist);
+       lprocfs_oh_clear(&cli->cl_read_offset_hist);
+       lprocfs_oh_clear(&cli->cl_write_offset_hist);
+
        return len;
 }
        return len;
 }
+
+#define pct(a, b) (b ? a * 100 / b : 0)
+static int mdc_rpc_stats_seq_show(struct seq_file *seq, void *v)
+{
+       struct obd_device *dev = seq->private;
+       struct client_obd *cli = &dev->u.cli;
+       unsigned long read_tot = 0, write_tot = 0, read_cum, write_cum;
+       int i;
+
+       obd_mod_rpc_stats_seq_show(&dev->u.cli, seq);
+
+       spin_lock(&cli->cl_loi_list_lock);
+
+       seq_printf(seq, "\nread RPCs in flight:  %d\n",
+                  cli->cl_r_in_flight);
+       seq_printf(seq, "write RPCs in flight: %d\n",
+                  cli->cl_w_in_flight);
+       seq_printf(seq, "pending write pages:  %d\n",
+                  atomic_read(&cli->cl_pending_w_pages));
+       seq_printf(seq, "pending read pages:   %d\n",
+                  atomic_read(&cli->cl_pending_r_pages));
+
+       seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+       seq_printf(seq, "pages per rpc         rpcs   %% cum %% |");
+       seq_printf(seq, "       rpcs   %% cum %%\n");
+
+       read_tot = lprocfs_oh_sum(&cli->cl_read_page_hist);
+       write_tot = lprocfs_oh_sum(&cli->cl_write_page_hist);
+
+       read_cum = 0;
+       write_cum = 0;
+       for (i = 0; i < OBD_HIST_MAX; i++) {
+               unsigned long r = cli->cl_read_page_hist.oh_buckets[i];
+               unsigned long w = cli->cl_write_page_hist.oh_buckets[i];
+
+               read_cum += r;
+               write_cum += w;
+               seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                          1 << i, r, pct(r, read_tot),
+                          pct(read_cum, read_tot), w,
+                          pct(w, write_tot),
+                          pct(write_cum, write_tot));
+               if (read_cum == read_tot && write_cum == write_tot)
+                       break;
+       }
+
+       seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+       seq_printf(seq, "rpcs in flight        rpcs   %% cum %% |");
+       seq_printf(seq, "       rpcs   %% cum %%\n");
+
+       read_tot = lprocfs_oh_sum(&cli->cl_read_rpc_hist);
+       write_tot = lprocfs_oh_sum(&cli->cl_write_rpc_hist);
+
+       read_cum = 0;
+       write_cum = 0;
+       for (i = 0; i < OBD_HIST_MAX; i++) {
+               unsigned long r = cli->cl_read_rpc_hist.oh_buckets[i];
+               unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
+
+               read_cum += r;
+               write_cum += w;
+               seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                          i, r, pct(r, read_tot), pct(read_cum, read_tot), w,
+                          pct(w, write_tot), pct(write_cum, write_tot));
+               if (read_cum == read_tot && write_cum == write_tot)
+                       break;
+       }
+
+       seq_printf(seq, "\n\t\t\tread\t\t\twrite\n");
+       seq_printf(seq, "offset                rpcs   %% cum %% |");
+       seq_printf(seq, "       rpcs   %% cum %%\n");
+
+       read_tot = lprocfs_oh_sum(&cli->cl_read_offset_hist);
+       write_tot = lprocfs_oh_sum(&cli->cl_write_offset_hist);
+
+       read_cum = 0;
+       write_cum = 0;
+       for (i = 0; i < OBD_HIST_MAX; i++) {
+               unsigned long r = cli->cl_read_offset_hist.oh_buckets[i];
+               unsigned long w = cli->cl_write_offset_hist.oh_buckets[i];
+
+               read_cum += r;
+               write_cum += w;
+               seq_printf(seq, "%d:\t\t%10lu %3lu %3lu   | %10lu %3lu %3lu\n",
+                          (i == 0) ? 0 : 1 << (i - 1),
+                          r, pct(r, read_tot), pct(read_cum, read_tot),
+                          w, pct(w, write_tot), pct(write_cum, write_tot));
+               if (read_cum == read_tot && write_cum == write_tot)
+                       break;
+       }
+       spin_unlock(&cli->cl_loi_list_lock);
+
+       return 0;
+}
+#undef pct
 LPROC_SEQ_FOPS(mdc_rpc_stats);
 
 LPROC_SEQ_FOPS(mdc_rpc_stats);
 
+static int mdc_stats_seq_show(struct seq_file *seq, void *v)
+{
+       struct timeval now;
+       struct obd_device *dev = seq->private;
+       struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
+
+       do_gettimeofday(&now);
+
+       seq_printf(seq, "snapshot_time:         %lu.%lu (secs.usecs)\n",
+                  now.tv_sec, now.tv_usec);
+       seq_printf(seq, "lockless_write_bytes\t\t%llu\n",
+                  stats->os_lockless_writes);
+       seq_printf(seq, "lockless_read_bytes\t\t%llu\n",
+                  stats->os_lockless_reads);
+       seq_printf(seq, "lockless_truncate\t\t%llu\n",
+                  stats->os_lockless_truncates);
+       return 0;
+}
+
+static ssize_t mdc_stats_seq_write(struct file *file,
+                                  const char __user *buf,
+                                  size_t len, loff_t *off)
+{
+       struct seq_file *seq = file->private_data;
+       struct obd_device *dev = seq->private;
+       struct osc_stats *stats = &obd2osc_dev(dev)->od_stats;
+
+       memset(stats, 0, sizeof(*stats));
+       return len;
+}
+LPROC_SEQ_FOPS(mdc_stats);
+
 LPROC_SEQ_FOPS_WR_ONLY(mdc, ping);
 
 LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags);
 LPROC_SEQ_FOPS_WR_ONLY(mdc, ping);
 
 LPROC_SEQ_FOPS_RO_TYPE(mdc, connect_flags);
@@ -192,9 +476,15 @@ struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
        { .name =       "max_rpcs_in_flight",
          .fops =       &mdc_max_rpcs_in_flight_fops    },
        { .name =       "max_mod_rpcs_in_flight",
        { .name =       "max_rpcs_in_flight",
          .fops =       &mdc_max_rpcs_in_flight_fops    },
        { .name =       "max_mod_rpcs_in_flight",
-         .fops =       &mdc_max_mod_rpcs_in_flight_fops        },
+         .fops =       &mdc_max_mod_rpcs_in_flight_fops },
+       { .name =       "max_dirty_mb",
+         .fops =       &mdc_max_dirty_mb_fops          },
+       { .name =       "mdc_cached_mb",
+         .fops =       &mdc_cached_mb_fops             },
        { .name =       "timeouts",
          .fops =       &mdc_timeouts_fops              },
        { .name =       "timeouts",
          .fops =       &mdc_timeouts_fops              },
+       { .name =       "contention_seconds",
+         .fops =       &mdc_contention_seconds_fops    },
        { .name =       "import",
          .fops =       &mdc_import_fops                },
        { .name =       "state",
        { .name =       "import",
          .fops =       &mdc_import_fops                },
        { .name =       "state",
@@ -205,6 +495,11 @@ struct lprocfs_vars lprocfs_mdc_obd_vars[] = {
          .fops =       &mdc_rpc_stats_fops             },
        { .name =       "active",
          .fops =       &mdc_active_fops                },
          .fops =       &mdc_rpc_stats_fops             },
        { .name =       "active",
          .fops =       &mdc_active_fops                },
+       { .name =       "unstable_stats",
+         .fops =       &mdc_unstable_stats_fops        },
+       { .name =       "mdc_stats",
+         .fops =       &mdc_stats_fops                 },
        { NULL }
 };
        { NULL }
 };
+
 #endif /* CONFIG_PROC_FS */
 #endif /* CONFIG_PROC_FS */
index 76e0247..411552c 100644 (file)
@@ -2511,6 +2511,7 @@ int mdc_setup(struct obd_device *obd, struct lustre_cfg *cfg)
        lprocfs_obd_setup(obd, false);
        lprocfs_alloc_md_stats(obd, 0);
 #endif
        lprocfs_obd_setup(obd, false);
        lprocfs_alloc_md_stats(obd, 0);
 #endif
+
        sptlrpc_lprocfs_cliobd_attach(obd);
        ptlrpc_lprocfs_register_obd(obd);
 
        sptlrpc_lprocfs_cliobd_attach(obd);
        ptlrpc_lprocfs_register_obd(obd);
 
index 7bd6531..2791ad3 100644 (file)
@@ -3983,6 +3983,18 @@ static int mdt_intent_opc(enum ldlm_intent_flags itopc,
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
+static void mdt_ptlrpc_stats_update(struct ptlrpc_request *req,
+                                   enum ldlm_intent_flags it_opc)
+{
+       struct lprocfs_stats *srv_stats = ptlrpc_req2svc(req)->srv_stats;
+
+       /* update stats when IT code is known */
+       if (srv_stats != NULL)
+               lprocfs_counter_incr(srv_stats,
+                               PTLRPC_LAST_CNTR + (it_opc == IT_GLIMPSE ?
+                               LDLM_GLIMPSE_ENQUEUE : LDLM_IBITS_ENQUEUE));
+}
+
 static int mdt_intent_policy(struct ldlm_namespace *ns,
                             struct ldlm_lock **lockp, void *req_cookie,
                             enum ldlm_mode mode, __u64 flags, void *data)
 static int mdt_intent_policy(struct ldlm_namespace *ns,
                             struct ldlm_lock **lockp, void *req_cookie,
                             enum ldlm_mode mode, __u64 flags, void *data)
@@ -4009,17 +4021,18 @@ static int mdt_intent_policy(struct ldlm_namespace *ns,
 
        if (req->rq_reqmsg->lm_bufcount > DLM_INTENT_IT_OFF) {
                req_capsule_extend(pill, &RQF_LDLM_INTENT_BASIC);
 
        if (req->rq_reqmsg->lm_bufcount > DLM_INTENT_IT_OFF) {
                req_capsule_extend(pill, &RQF_LDLM_INTENT_BASIC);
-                it = req_capsule_client_get(pill, &RMF_LDLM_INTENT);
-                if (it != NULL) {
-                        rc = mdt_intent_opc(it->opc, info, lockp, flags);
-                        if (rc == 0)
-                                rc = ELDLM_OK;
-
-                        /* Lock without inodebits makes no sense and will oops
-                         * later in ldlm. Let's check it now to see if we have
-                         * ibits corrupted somewhere in mdt_intent_opc().
-                         * The case for client miss to set ibits has been
-                         * processed by others. */
+               it = req_capsule_client_get(pill, &RMF_LDLM_INTENT);
+               if (it != NULL) {
+                       mdt_ptlrpc_stats_update(req, it->opc);
+                       rc = mdt_intent_opc(it->opc, info, lockp, flags);
+                       if (rc == 0)
+                               rc = ELDLM_OK;
+
+                       /* Lock without inodebits makes no sense and will oops
+                        * later in ldlm. Let's check it now to see if we have
+                        * ibits corrupted somewhere in mdt_intent_opc().
+                        * The case for client miss to set ibits has been
+                        * processed by others. */
                        LASSERT(ergo(ldesc->l_resource.lr_type == LDLM_IBITS,
                                ldesc->l_policy_data.l_inodebits.bits != 0));
                } else {
                        LASSERT(ergo(ldesc->l_resource.lr_type == LDLM_IBITS,
                                ldesc->l_policy_data.l_inodebits.bits != 0));
                } else {
index f5f17c4..6799c0c 100644 (file)
@@ -2085,6 +2085,8 @@ int obd_set_max_rpcs_in_flight(struct client_obd *cli, __u32 max)
        spin_lock(&cli->cl_loi_list_lock);
        old = cli->cl_max_rpcs_in_flight;
        cli->cl_max_rpcs_in_flight = max;
        spin_lock(&cli->cl_loi_list_lock);
        old = cli->cl_max_rpcs_in_flight;
        cli->cl_max_rpcs_in_flight = max;
+       client_adjust_max_dirty(cli);
+
        diff = max - old;
 
        /* We increase the max_rpcs_in_flight, then wakeup some waiters. */
        diff = max - old;
 
        /* We increase the max_rpcs_in_flight, then wakeup some waiters. */
index a96a91d..76e2bd7 100644 (file)
@@ -235,6 +235,11 @@ int ofd_intent_policy(struct ldlm_namespace *ns, struct ldlm_lock **lockp,
        struct ldlm_glimpse_work *pos, *tmp;
        ENTRY;
 
        struct ldlm_glimpse_work *pos, *tmp;
        ENTRY;
 
+       /* update stats for intent in intent policy */
+       if (ptlrpc_req2svc(req)->srv_stats != NULL)
+               lprocfs_counter_incr(ptlrpc_req2svc(req)->srv_stats,
+                                    PTLRPC_LAST_CNTR + LDLM_GLIMPSE_ENQUEUE);
+
        INIT_LIST_HEAD(&arg.gl_list);
        arg.no_glimpse_ast = false;
        arg.error = 0;
        INIT_LIST_HEAD(&arg.gl_list);
        arg.no_glimpse_ast = false;
        arg.error = 0;
index 814af07..f35d7bf 100644 (file)
@@ -1706,6 +1706,7 @@ wakeup:
 
        EXIT;
 }
 
        EXIT;
 }
+EXPORT_SYMBOL(osc_wake_cache_waiters);
 
 static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc)
 {
 
 static int osc_max_rpc_in_flight(struct client_obd *cli, struct osc_object *osc)
 {
@@ -2532,6 +2533,7 @@ int osc_queue_async_io(const struct lu_env *env, struct cl_io *io,
                list_add_tail(&oap->oap_pending_item, &ext->oe_pages);
                osc_object_unlock(osc);
        }
                list_add_tail(&oap->oap_pending_item, &ext->oe_pages);
                osc_object_unlock(osc);
        }
+
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
index 4fdfb13..16b8666 100644 (file)
@@ -79,8 +79,6 @@ int osc_ladvise_base(struct obd_export *exp, struct obdo *oa,
 int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *cfg);
 int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
                  struct list_head *ext_list, int cmd);
 int osc_process_config_base(struct obd_device *obd, struct lustre_cfg *cfg);
 int osc_build_rpc(const struct lu_env *env, struct client_obd *cli,
                  struct list_head *ext_list, int cmd);
-long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
-                  long target, bool force);
 unsigned long osc_lru_reserve(struct client_obd *cli, unsigned long npages);
 void osc_lru_unreserve(struct client_obd *cli, unsigned long npages);
 
 unsigned long osc_lru_reserve(struct client_obd *cli, unsigned long npages);
 void osc_lru_unreserve(struct client_obd *cli, unsigned long npages);
 
index d53725c..6813f12 100644 (file)
@@ -685,6 +685,7 @@ long osc_lru_shrink(const struct lu_env *env, struct client_obd *cli,
        }
        RETURN(count > 0 ? count : rc);
 }
        }
        RETURN(count > 0 ? count : rc);
 }
+EXPORT_SYMBOL(osc_lru_shrink);
 
 /**
  * Reclaim LRU pages by an IO thread. The caller wants to reclaim at least
 
 /**
  * Reclaim LRU pages by an IO thread. The caller wants to reclaim at least