Whamcloud - gitweb
LU-694 ptlrpc: Job Stats
[fs/lustre-release.git] / lustre / obdfilter / filter_internal.h
index 27c41a0..67f40a7 100644 (file)
@@ -113,6 +113,24 @@ enum {
         LPROC_FILTER_LAST,
 };
 
+/* for job stats */
+enum {
+       LPROC_FILTER_STATS_READ = 0,
+       LPROC_FILTER_STATS_WRITE = 1,
+       LPROC_FILTER_STATS_SETATTR = 2,
+       LPROC_FILTER_STATS_PUNCH = 3,
+       LPROC_FILTER_STATS_SYNC = 4,
+       LPROC_FILTER_STATS_LAST,
+};
+
+static inline void filter_counter_incr(struct obd_export *exp, int opcode,
+                                      char *jobid, long amount)
+{
+       if (exp->exp_obd && exp->exp_obd->u.obt.obt_jobstats.ojs_hash &&
+           (exp->exp_connect_flags & OBD_CONNECT_JOBSTATS))
+               lprocfs_job_stats_log(exp->exp_obd, jobid, opcode, amount);
+}
+
 //#define FILTER_MAX_CACHE_SIZE (32 * 1024 * 1024) /* was OBD_OBJECT_EOF */
 #define FILTER_MAX_CACHE_SIZE OBD_OBJECT_EOF
 
@@ -220,6 +238,7 @@ void filter_tally(struct obd_export *exp, struct page **pages, int nr_pages,
                   unsigned long *blocks, int blocks_per_page, int wr);
 int lproc_filter_attach_seqstat(struct obd_device *dev);
 void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars);
+void filter_stats_counter_init(struct lprocfs_stats *stats);
 #else
 static inline void filter_tally(struct obd_export *exp, struct page **pages,
                                 int nr_pages, unsigned long *blocks,
@@ -229,6 +248,7 @@ static void lprocfs_filter_init_vars(struct lprocfs_static_vars *lvars)
 {
         memset(lvars, 0, sizeof(*lvars));
 }
+static inline void filter_stats_counter_init(struct lprocfs_stats *stats) {}
 #endif
 
 /* Quota stuff */