]> git.sur5r.net Git - bacula/bacula/commitdiff
Change all sm_checks into Dsm_check for performance reasons
authorKern Sibbald <kern@sibbald.com>
Thu, 21 Apr 2011 10:57:20 +0000 (12:57 +0200)
committerKern Sibbald <kern@sibbald.com>
Thu, 21 Apr 2011 10:58:57 +0000 (12:58 +0200)
bacula/src/dird/job.c
bacula/src/filed/backup.c
bacula/src/filed/job.c
bacula/src/lib/bpipe.c
bacula/src/lib/bsock.c
bacula/src/stored/btape.c
bacula/src/stored/dev.c
bacula/src/stored/dvd.c
bacula/src/stored/job.c
bacula/src/stored/scan.c

index 056c4cb522cdfe007f43f67443e843676bffe2e3..d428bd064b6426a410022e1a496d0a604551be2a 100644 (file)
@@ -104,7 +104,7 @@ bool setup_job(JCR *jcr)
    int errstat;
 
    jcr->lock();
-   sm_check(__FILE__, __LINE__, true);
+   Dsm_check(100);
    init_msg(jcr, jcr->messages);
 
    /* Initialize termination condition variable */
@@ -234,7 +234,7 @@ bool setup_job(JCR *jcr)
 
    generate_job_event(jcr, "JobInit");
    generate_plugin_event(jcr, bEventJobInit);
-   Dsm_check(1);
+   Dsm_check(100);
    return true;
 
 bail_out:
@@ -259,7 +259,7 @@ static void *job_thread(void *arg)
    JCR *jcr = (JCR *)arg;
 
    pthread_detach(pthread_self());
-   Dsm_check(1);
+   Dsm_check(100);
 
    Dmsg0(200, "=====Start Job=========\n");
    jcr->setJobStatus(JS_Running);   /* this will be set only if no error */
@@ -360,7 +360,7 @@ static void *job_thread(void *arg)
    generate_daemon_event(jcr, "JobEnd");
    generate_plugin_event(jcr, bEventJobEnd);
    Dmsg1(50, "======== End Job stat=%c ==========\n", jcr->JobStatus);
-   sm_check(__FILE__, __LINE__, true);
+   Dsm_check(100);
    return NULL;
 }
 
@@ -531,7 +531,7 @@ static void job_monitor_watchdog(watchdog_t *self)
 
    control_jcr = (JCR *)self->data;
 
-   Dsm_check(1);
+   Dsm_check(100);
    Dmsg1(800, "job_monitor_watchdog %p called\n", self);
 
    foreach_jcr(jcr) {
index ab842c32808b26f44440f72ac3a84786a78fd93e..21b1906de13eec7f738ec6d136e4526aba29d26d 100644 (file)
@@ -1344,7 +1344,7 @@ void strip_path(FF_PKT *ff_pkt)
       pm_strcpy(ff_pkt->link_save, ff_pkt->link);
       Dmsg2(500, "strcpy link_save=%d link=%d\n", strlen(ff_pkt->link_save),
          strlen(ff_pkt->link));
-      sm_check(__FILE__, __LINE__, true);
+      Dsm_check(200);
    }
 
    /**
@@ -1383,7 +1383,7 @@ void unstrip_path(FF_PKT *ff_pkt)
       strcpy(ff_pkt->link, ff_pkt->link_save);
       Dmsg2(500, "strcpy link=%d link_save=%d\n", strlen(ff_pkt->link),
           strlen(ff_pkt->link_save));
-      sm_check(__FILE__, __LINE__, true);
+      Dsm_check(200);
    }
 }
 
index 3f862dcf8c6025072990e0762b66fc4e787388a0..0dd502ad7c107eeedd7f83aa459331c6ee2d8b1f 100644 (file)
@@ -405,7 +405,7 @@ void *handle_client_request(void *dirp)
    Dmsg0(100, "Done with term_find_files\n");
    free_jcr(jcr);                     /* destroy JCR record */
    Dmsg0(100, "Done with free_jcr\n");
-   Dsm_check(1);
+   Dsm_check(100);
    garbage_collect_memory_pool();
    return NULL;
 }
index 79a6c0cbceb5de4cb86389cc04217ff177e1129c..ad2e7ad36d0382b7983de9fb488cbb4511fd732a 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2002-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2002-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -394,7 +394,7 @@ int run_program_full_output(char *prog, int wait, POOLMEM *&results)
    const int bufsize = 32000;
 
    
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
 
    tmp = get_pool_memory(PM_MESSAGE);
    buf = (char *)malloc(bufsize+1);
@@ -407,7 +407,7 @@ int run_program_full_output(char *prog, int wait, POOLMEM *&results)
       goto bail_out;
    }
    
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
    tmp[0] = 0;
    while (1) {
       buf[0] = 0;
index b1550c14b3627d21dd50e0d01b4ec63ef08126dd..6fec7da6e829cfb9f8feb86acf41f08630e588ae 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2007-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2007-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -554,7 +554,11 @@ int32_t BSOCK::recv()
     * buffer is at least one byte longer than the message length.
     */
    msg[nbytes] = 0; /* terminate in case it is a string */
-   sm_check(__FILE__, __LINE__, false);
+   /*
+    * The following uses *lots* of resources so turn it on only for 
+    * serious debugging.
+    */
+   Dsm_check(300);
 
 get_out:
    if (m_use_locking) V(m_mutex);
index dc7ecabb47b641cb40e183f448b82be9b9225f2e..d70da195c28daed32218b989fcc4bb41ba8ef4a0 100644 (file)
@@ -317,7 +317,7 @@ int main(int margc, char *margv[])
 static void terminate_btape(int stat)
 {
 
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
    if (configfile) {
       free(configfile);
    }
@@ -748,7 +748,7 @@ static void rectestcmd()
       return;
    }
 
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
    block = new_block(dev);
    rec = new_record();
 
@@ -756,7 +756,7 @@ static void rectestcmd()
       rec->data = check_pool_memory_size(rec->data, i);
       memset(rec->data, i & 0xFF, i);
       rec->data_len = i;
-      sm_check(__FILE__, __LINE__, false);
+      Dsm_check(200);
       if (write_record_to_block(block, rec)) {
          empty_block(block);
          blkno++;
@@ -764,11 +764,11 @@ static void rectestcmd()
       } else {
          break;
       }
-      sm_check(__FILE__, __LINE__, false);
+      Dsm_check(200);
    }
    free_record(rec);
    free_block(block);
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
 }
 
 /*
@@ -1888,7 +1888,7 @@ static void wrcmd()
    if (!dev->is_open()) {
       open_the_device();
    }
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
    empty_block(block);
    if (verbose > 1) {
       dump_block(block, "test");
@@ -1899,7 +1899,7 @@ static void wrcmd()
    rec->data = check_pool_memory_size(rec->data, i);
    memset(rec->data, i & 0xFF, i);
    rec->data_len = i;
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
    if (!write_record_to_block(block, rec)) {
       Pmsg0(0, _("Error writing record to block.\n"));
       goto bail_out;
@@ -1913,8 +1913,7 @@ static void wrcmd()
    Pmsg0(0, _("Wrote block to device.\n"));
 
 bail_out:
-   sm_check(__FILE__, __LINE__, false);
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
 }
 
 /*
@@ -2798,7 +2797,7 @@ static void qfillcmd()
       count = 1000;
    }
 
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
 
    i = block->buf_len - 100;
    ASSERT (i > 0);
@@ -2833,7 +2832,7 @@ static void qfillcmd()
    scan_blocks();
 
 bail_out:
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(200);
 }
 
 /*
@@ -2921,7 +2920,7 @@ do_tape_cmds()
    bool found;
 
    while (!quit && get_cmd("*")) {
-      sm_check(__FILE__, __LINE__, false);
+      Dsm_check(200);
       found = false;
       parse_args(cmd, &args, &argc, argk, argv, MAX_CMD_ARGS);
       for (i=0; i<comsize; i++)       /* search for command */
index e40948d538a10cfae88c8552d31c09b562a4e876..7a3dafe03dbaca7f7a8c594c4d57243c5f23f530 100644 (file)
@@ -1958,7 +1958,7 @@ bool DEVICE::do_tape_mount(int mount, int dotimeout)
    int status, tries;
    berrno be;
 
-   Dsm_check(1);
+   Dsm_check(200);
    if (mount) {
       icmd = device->mount_command;
    } else {
@@ -1992,7 +1992,7 @@ bool DEVICE::do_tape_mount(int mount, int dotimeout)
       set_mounted(false);
       free_pool_memory(results);
       Dmsg0(200, "============ mount=0\n");
-      Dsm_check(1);
+      Dsm_check(200);
       return false;
    }
 
@@ -2015,7 +2015,7 @@ bool DEVICE::do_file_mount(int mount, int dotimeout)
    int status, tries, name_max, count;
    berrno be;
 
-   Dsm_check(1);
+   Dsm_check(200);
    if (mount) {
       icmd = device->mount_command;
    } else {
@@ -2115,7 +2115,7 @@ get_out:
       set_mounted(false);
       free_pool_memory(results);
       Dmsg0(200, "============ mount=0\n");
-      Dsm_check(1);
+      Dsm_check(200);
       return false;
    }
    
index dcb6a8e2d2edff9f0f3986342b84cba95adfb711..b0c7656a67c4c71e32bd229717e2e16beaa778e6 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2005-2010 Free Software Foundation Europe e.V.
+   Copyright (C) 2005-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -98,7 +98,7 @@ bool DEVICE::update_freespace()
    /* The device must be mounted in order to dvd-freespace to work */
    mount(1);
    
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(400);
    icmd = device->free_space_command;
    
    if (!icmd) {
@@ -165,7 +165,7 @@ bool DEVICE::update_freespace()
    free_pool_memory(results);
    Dmsg4(29, "leave update_freespace: free_space=%s freespace_ok=%d free_space_errno=%d have_media=%d\n", 
       edit_uint64(free_space, ed1), !!is_freespace_ok(), free_space_errno, !!have_media());
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(400);
    return ok;
 }
 
@@ -209,7 +209,7 @@ bool dvd_write_part(DCR *dcr)
       unlink(archive_name.c_str());
       dev->set_part_spooled(false);
       Dmsg1(29, "========= unlink(%s)\n", archive_name.c_str());
-      sm_check(__FILE__, __LINE__, false);
+      Dsm_check(400);
       return true;
    }
    
@@ -222,7 +222,7 @@ bool dvd_write_part(DCR *dcr)
    
    dev->clear_freespace_ok();             /* need to update freespace */
 
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(400);
    Dmsg3(29, "dvd_write_part: device is %s, part is %d, is_mounted=%d\n", dev->print_name(), dev->part, dev->is_mounted());
    icmd = dev->device->write_part_command;
    
@@ -267,7 +267,7 @@ bool dvd_write_part(DCR *dcr)
       if (!dev->truncating) {
          dcr->mark_volume_in_error();
       }
-      sm_check(__FILE__, __LINE__, false);
+      Dsm_check(400);
       return false;
    }
    Jmsg(dcr->jcr, M_INFO, 0, _("Part %d (%lld bytes) written to DVD.\n"), dev->part, dev->part_size);
@@ -284,14 +284,14 @@ bool dvd_write_part(DCR *dcr)
    unlink(archive_name.c_str());
    dev->set_part_spooled(false);
    Dmsg1(29, "========= unlink(%s)\n", archive_name.c_str());
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(400);
    
    /* growisofs umounted the device, so remount it (it will update the free space) */
    dev->clear_mounted();
    dev->mount(1);
    Jmsg(dcr->jcr, M_INFO, 0, _("Remaining free space %s on %s\n"), 
       edit_uint64_with_commas(dev->free_space, ed1), dev->print_name());
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(400);
    return true;
 }
 
index c2d925965ffd0e2c7bc80b8ffda214fd4cddb1ae..959994a9bd09c205613a5e4556c402a9242ab5d9 100644 (file)
@@ -163,7 +163,7 @@ bool run_cmd(JCR *jcr)
    struct timespec timeout;
    int errstat = 0;
 
-   Dsm_check(1);
+   Dsm_check(200);
    Dmsg1(200, "Run_cmd: %s\n", jcr->dir_bsock->msg);
 
    /* If we do not need the FD, we are doing a migrate, copy, or virtual
@@ -422,7 +422,7 @@ void stored_free_jcr(JCR *jcr)
       delete jcr->write_store;
       jcr->write_store = NULL;
    }
-   Dsm_check(1);
+   Dsm_check(200);
 
    if (jcr->JobId != 0)
       write_state_file(me->working_directory, "bacula-sd", get_first_port_host_order(me->sdaddrs));
index a0292d8072989e33f2ecd11802cad3f83f598775..514331c8651b5d71fe87b4dda1929f2a9b7e2d2d 100644 (file)
@@ -1,7 +1,7 @@
 /*
    Bacula® - The Network Backup Solution
 
-   Copyright (C) 2006-2007 Free Software Foundation Europe e.V.
+   Copyright (C) 2006-2011 Free Software Foundation Europe e.V.
 
    The main author of Bacula is Kern Sibbald, with contributions from
    many others, a complete list can be found in the file AUTHORS.
@@ -32,7 +32,6 @@
  *
  *    Kern Sibbald, MMVI
  *
- *   Version $Id$
  */
 
 #include "bacula.h"
@@ -137,7 +136,7 @@ get_out:
       dcr->VolCatInfo = dcrVolCatInfo;     /* structure assignment */
       VolCatInfo = devVolCatInfo;          /* structure assignment */
    }
-   sm_check(__FILE__, __LINE__, false);
+   Dsm_check(100);
    return found;
 }