Whamcloud - gitweb
LU-2395 ofd: Maintain per-export {read,write}_bytes counters
[fs/lustre-release.git] / lustre / ofd / ofd_internal.h
index 7b37b0d..5b8cd32 100644 (file)
@@ -27,7 +27,7 @@
  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2012, Whamcloud, Inc.
+ * Copyright (c) 2012, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
 #define OFD_MAX_GROUPS 256
 #define OFD_PRECREATE_BATCH_DEFAULT (FILTER_SUBDIR_COUNT * 4)
 
+/* on small filesystems we should not precreate too many objects in
+ * a single transaction, otherwise we can overflow transactions */
+#define OFD_PRECREATE_SMALL_FS         (1024ULL * 1024 * 1024)
+#define OFD_PRECREATE_BATCH_SMALL      8
+
 /* Limit the returned fields marked valid to those that we actually might set */
 #define OFD_VALID_FLAGS (LA_TYPE | LA_MODE | LA_SIZE | LA_BLOCKS | \
                         LA_BLKSIZE | LA_ATIME | LA_MTIME | LA_CTIME)
@@ -89,6 +94,16 @@ static inline void ofd_counter_incr(struct obd_export *exp, int opcode,
        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);
+
+       if (exp->exp_nid_stats != NULL &&
+           exp->exp_nid_stats->nid_stats != NULL) {
+               if (opcode == LPROC_OFD_STATS_READ)
+                       lprocfs_counter_add(exp->exp_nid_stats->nid_stats,
+                                           LPROC_OFD_READ_BYTES, amount);
+               else if (opcode == LPROC_OFD_STATS_WRITE)
+                       lprocfs_counter_add(exp->exp_nid_stats->nid_stats,
+                                           LPROC_OFD_WRITE_BYTES, amount);
+       }
 }
 
 struct ofd_device {