]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
config: rename logger/dout config fields to make more sense
authorSage Weil <sage@newdream.net>
Sun, 1 Mar 2009 05:58:34 +0000 (21:58 -0800)
committerSage Weil <sage@newdream.net>
Sun, 1 Mar 2009 05:58:34 +0000 (21:58 -0800)
'logger' is the common/Logger.cc stats/instrumentation.  'log' is the
dout() log business.

src/common/Logger.cc
src/common/debug.cc
src/config.cc
src/config.h
src/dstart.sh
src/mds/MDCache.cc

index 488573d7887f1e1fdef84e6cae411c9d3e140802..fcc7e7212f41e37d7b4d22338505da30c8387576 100644 (file)
@@ -81,18 +81,18 @@ static void flush_all_loggers()
   int now_sec = fromstart.sec();
 
   // do any catching up we need to
-  while (now_sec - last_flush >= g_conf.log_interval) {
+  while (now_sec - last_flush >= g_conf.logger_interval) {
     generic_dout(20) << "fromstart " << fromstart << " last_flush " << last_flush << " flushing" << dendl;
     for (list<Logger*>::iterator p = logger_list.begin();
         p != logger_list.end();
         ++p) 
       (*p)->_flush();
-    last_flush += g_conf.log_interval;
+    last_flush += g_conf.logger_interval;
   }
 
   // schedule next flush event
   utime_t next;
-  next.sec_ref() = start.sec() + last_flush + g_conf.log_interval;
+  next.sec_ref() = start.sec() + last_flush + g_conf.logger_interval;
   next.usec_ref() = start.usec();
   generic_dout(20) << "logger now=" << now
                   << "  start=" << start 
@@ -111,7 +111,7 @@ void Logger::_open_log()
   Mutex::Locker l(logger_lock);
   struct stat st;
 
-  if (!g_conf.log)
+  if (!g_conf.logger)
     return;
 
   filename = "";
@@ -129,8 +129,8 @@ void Logger::_open_log()
     ::mkdir(filename.c_str(), 0750);
 
   filename += "/";
-  if (g_conf.log_name) {
-    filename += g_conf.log_name;
+  if (g_conf.logger_subdir) {
+    filename += g_conf.logger_subdir;
     ::mkdir( filename.c_str(), 0755 );   // make sure dir exists
     filename += "/";
   }
@@ -225,7 +225,7 @@ void Logger::_flush()
 
 long Logger::inc(int key, long v)
 {
-  if (!open || !g_conf.log)
+  if (!open || !g_conf.logger)
     return 0;
   logger_lock.Lock();
   int i = type->lookup_key(key);
@@ -237,7 +237,7 @@ long Logger::inc(int key, long v)
 
 double Logger::finc(int key, double v)
 {
-  if (!open || !g_conf.log)
+  if (!open || !g_conf.logger)
     return 0;
   logger_lock.Lock();
   int i = type->lookup_key(key);
@@ -249,7 +249,7 @@ double Logger::finc(int key, double v)
 
 long Logger::set(int key, long v)
 {
-  if (!open || !g_conf.log)
+  if (!open || !g_conf.logger)
     return 0;
   logger_lock.Lock();
   int i = type->lookup_key(key);
@@ -262,7 +262,7 @@ long Logger::set(int key, long v)
 
 double Logger::fset(int key, double v)
 {
-  if (!open || !g_conf.log)
+  if (!open || !g_conf.logger)
     return 0;
   logger_lock.Lock();
   int i = type->lookup_key(key);
@@ -274,7 +274,7 @@ double Logger::fset(int key, double v)
 
 double Logger::favg(int key, double v)
 {
-  if (!open || !g_conf.log)
+  if (!open || !g_conf.logger)
     return 0;
   logger_lock.Lock();
   int i = type->lookup_key(key);
@@ -288,7 +288,7 @@ double Logger::favg(int key, double v)
 
 long Logger::get(int key)
 {
-  if (!open || !g_conf.log)
+  if (!open || !g_conf.logger)
     return 0;
   logger_lock.Lock();
   int i = type->lookup_key(key);
index 1a73f83369b680b0f29cf51ce10312cd34429dc3..b76b34c7f6a5bf5377ce973fd631f5493a989541 100644 (file)
@@ -23,27 +23,27 @@ bool _dout_need_open = true;
 void _dout_open_log()
 {
   // logging enabled?
-  if (!(g_conf.dout_dir && g_conf.file_logs)) {
+  if (!(g_conf.log_dir && g_conf.file_logs)) {
     _dout_need_open = false;
     return;
   }
 
   // calculate log dir, filename, etc.
   if (!_dout_path[0]) {
-    if (g_conf.dout_dir[0] == '/') 
-      strcpy(_dout_dir, g_conf.dout_dir);
+    if (g_conf.log_dir[0] == '/') 
+      strcpy(_dout_dir, g_conf.log_dir);
     else {
       getcwd(_dout_dir, 100);
       strcat(_dout_dir, "/");
-      strcat(_dout_dir, g_conf.dout_dir);
+      strcat(_dout_dir, g_conf.log_dir);
     }
 
-    if (g_conf.dout_sym_dir[0] == '/') 
-      strcpy(_dout_symlink_dir, g_conf.dout_sym_dir);
+    if (g_conf.log_sym_dir[0] == '/') 
+      strcpy(_dout_symlink_dir, g_conf.log_sym_dir);
     else {
       getcwd(_dout_symlink_dir, 100);
       strcat(_dout_symlink_dir, "/");
-      strcat(_dout_symlink_dir, g_conf.dout_sym_dir);
+      strcat(_dout_symlink_dir, g_conf.log_sym_dir);
     }
 
     char hostname[80];
@@ -69,7 +69,7 @@ void _dout_open_log()
 
 int _dout_rename_output_file()  // after calling daemon()
 {
-  if (g_conf.dout_dir && g_conf.file_logs) {
+  if (g_conf.log_dir && g_conf.file_logs) {
     char oldpath[1000];
     char hostname[80];
     gethostname(hostname, 79);
@@ -90,7 +90,7 @@ int _dout_rename_output_file()  // after calling daemon()
 
 int _dout_create_courtesy_output_symlink(const char *type, int n)
 {
-  if (g_conf.dout_dir && g_conf.file_logs) {
+  if (g_conf.log_dir && g_conf.file_logs) {
     if (_dout_need_open)
       _dout_open_log();
 
index b6e214a57ae1fdcafeb85c217751ea3c2f32c028..d82eed844f4ee5d5ad20932cdb4f2f53d0a0e95e 100644 (file)
@@ -200,18 +200,15 @@ md_config_t g_conf = {
   file_logs: false,
 
   // profiling and debugging
-  log: true,
-  log_interval: 1,
-  log_name: (char*)0,
-
-  log_messages: true,
-  log_pins: true,
-
+  logger: true,
+  logger_interval: 1,
   logger_calc_variance: true,
-
-  dout_dir: INSTALL_PREFIX "/var/log/ceph",        // if daemonize == true
-  dout_sym_dir: INSTALL_PREFIX "/var/log/ceph",    // if daemonize == true
+  logger_subdir: 0,
   logger_dir: INSTALL_PREFIX "/var/log/ceph/stat",
+
+  log_dir: INSTALL_PREFIX "/var/log/ceph",        // if daemonize == true
+  log_sym_dir: INSTALL_PREFIX "/var/log/ceph",    // if daemonize == true
+
   pid_file: 0,
 
   conf_file: INSTALL_PREFIX "/etc/ceph/ceph.conf",
@@ -630,18 +627,20 @@ void parse_config_file(ConfFile *cf, bool auto_update)
   CF_READ("global", "num mds", num_mds);
   CF_READ("global", "num osd", num_osd);
   CF_READ("global", "mkfs", mkfs);
+  CF_READ_STR("global", "monmap file", monmap_file);
   CF_READ("global", "daemonize", daemonize);
   CF_READ("global", "file logs", file_logs);
-  CF_READ("global", "log", log);
-  CF_READ("global", "log interval", log_interval);
-  CF_READ_STR("global", "log name", log_name);
-  CF_READ("global", "log messages", log_messages);
-  CF_READ("global", "log pins", log_pins);
-  CF_READ_STR("global", "dout dir", dout_dir);
-  CF_READ_STR("global", "dout sym dir", dout_sym_dir);
+  CF_READ("global", "logger", logger);
+  CF_READ("global", "logger interval", logger_interval);
+  CF_READ_STR("global", "logger calc variance", logger_subdir);
+  CF_READ_STR("global", "logger subdir", logger_subdir);
   CF_READ_STR("global", "logger dir", logger_dir);
+
+  CF_READ_STR("global", "log dir", log_dir);
+  CF_READ_STR("global", "log sym dir", log_sym_dir);
+
   CF_READ_STR("global", "pid file", pid_file);
-  CF_READ_STR("global", "monmap file", monmap_file);
+
   CF_READ("global", "chdir root", chdir_root);
 
   CF_READ("debug", "debug", debug);
@@ -950,11 +949,11 @@ void parse_config_options(std::vector<const char*>& args, bool open)
     //g_conf.fake_osd_sync = atoi(args[++i]);
 
         
-    else if (strcmp(args[i], "--dout_dir") == 0 && isarg) 
-      g_conf.dout_dir = args[++i];
+    else if (strcmp(args[i], "--log_dir") == 0 && isarg) 
+      g_conf.log_dir = args[++i];
     else if (//strcmp(args[i], "-o") == 0 ||
-            strcmp(args[i], "--dout_sym_dir") == 0 && isarg) 
-      g_conf.dout_sym_dir = args[++i];
+            strcmp(args[i], "--log_sym_dir") == 0 && isarg) 
+      g_conf.log_sym_dir = args[++i];
     else if (strcmp(args[i], "--logger_dir") == 0 && isarg) 
       g_conf.logger_dir = args[++i];
     else if ((strcmp(args[i], "--pid_file") == 0 ||
@@ -1085,10 +1084,10 @@ void parse_config_options(std::vector<const char*>& args, bool open)
       g_debug_after_conf = g_conf;
     }
 
-    else if (strcmp(args[i], "--log") == 0 && isarg) 
-      g_conf.log = atoi(args[++i]);
-    else if (strcmp(args[i], "--log_name") == 0 && isarg) 
-      g_conf.log_name = args[++i];
+    else if (strcmp(args[i], "--logger") == 0 && isarg) 
+      g_conf.logger = atoi(args[++i]);
+    else if (strcmp(args[i], "--logger_subdir") == 0 && isarg) 
+      g_conf.logger_subdir = args[++i];
 
     else if (strcmp(args[i], "--fakemessenger_serialize") == 0 && isarg) 
       g_conf.fakemessenger_serialize = atoi(args[++i]);
index da8df5cdd15c3557c9e26cb7ae8a85f711beac79..1395520484904328d58dd938454404119c708bfe 100644 (file)
@@ -40,10 +40,10 @@ extern const char *get_pool_name(int pool);
 extern entity_addr_t g_my_addr;
 
 struct md_config_t {
-  int  num_mon;
-  int  num_mds;
-  int  num_osd;
-  int  num_client;
+  int num_mon;
+  int num_mds;
+  int num_osd;
+  int num_client;
 
   bool mkfs;
   
@@ -52,19 +52,16 @@ struct md_config_t {
   bool daemonize;
   bool file_logs;
 
-  // profiling
-  bool  log;
-  int   log_interval;
-  const char *log_name;
-
-  bool log_messages;
-  bool log_pins;
-
+  // logger (profiling)
+  bool logger;
+  int logger_interval;
   bool logger_calc_variance;
-
-  const char *dout_dir;
-  const char *dout_sym_dir;
+  const char *logger_subdir;
   const char *logger_dir;
+
+  const char *log_dir;
+  const char *log_sym_dir;
+
   const char *pid_file;
 
   const char *conf_file;
index 71aabcdce151f61c5ddc2a8a52608320e4d84514..f74a72f05f61e8490e0a281ef73d4652beb541e9 100755 (executable)
@@ -33,7 +33,7 @@ while [ $# -ge 1 ]; do
 done
 
 
-ARGS="--dout_dir /data/`hostname`"
+ARGS="--log_dir /data/`hostname`"
 
 MOUNTOPTIONS="-o notreelog,flushoncommit"
 
@@ -144,7 +144,7 @@ do
        ssh root@$host cd $HOME/ceph/src \; ./cosd --mkfs_for_osd $osd $devm # --osd_auto_weight 1
    fi
    echo starting cosd
-   ssh root@$host cd $HOME/ceph/src \; ulimit -c unlimited \; ./crun $norestart ./cosd $devm --dout_dir /data/$host $COSD_ARGS -f &
+   ssh root@$host cd $HOME/ceph/src \; ulimit -c unlimited \; ./crun $norestart ./cosd $devm --log_dir /data/$host $COSD_ARGS -f &
 
  done
 done
index 44b4b9bc3f42befab5f6573f758cfb68693ba528..8ac83388fd2b367ac494bd4499c7108d9d024b20 100644 (file)
@@ -6092,7 +6092,7 @@ void MDCache::request_cleanup(MDRequest *mdr)
     //mds->logger->set("buf",buffer_total_alloc);
   }
 
-  if (g_conf.log_pins) {
+  //if (g_conf.log_pins) {
     // pin
     /*
 for (int i=0; i<CInode::NUM_PINS; i++) {
@@ -6111,7 +6111,7 @@ for (int i=0; i<CInode::NUM_PINS; i++) {
       it->second);
       }
     */
-  }
+  //}
 
 }