From aebaa5c0c2df5036a24bf71815699c82ce2b8f12 Mon Sep 17 00:00:00 2001 From: Kern Sibbald Date: Fri, 14 Sep 2012 22:49:13 +0200 Subject: [PATCH] Add MaximumConcurrentReadJobs directive to Storage resource --- bacula/src/dird/dird_conf.c | 1 + bacula/src/dird/dird_conf.h | 1 + bacula/src/dird/jobq.c | 5 ++++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bacula/src/dird/dird_conf.c b/bacula/src/dird/dird_conf.c index 2f2eb000d2..4e6d690577 100644 --- a/bacula/src/dird/dird_conf.c +++ b/bacula/src/dird/dird_conf.c @@ -224,6 +224,7 @@ static RES_ITEM store_items[] = { {"allowcompression", store_bool, ITEM(res_store.AllowCompress), 0, ITEM_DEFAULT, true}, {"heartbeatinterval", store_time, ITEM(res_store.heartbeat_interval), 0, ITEM_DEFAULT, 0}, {"maximumconcurrentjobs", store_pint32, ITEM(res_store.MaxConcurrentJobs), 0, ITEM_DEFAULT, 1}, + {"maximumconcurrentreadjobs", store_pint32, ITEM(res_store.MaxConcurrentReadJobs), 0, ITEM_DEFAULT, 0}, {"sddport", store_pint32, ITEM(res_store.SDDport), 0, 0, 0}, /* deprecated */ {"tlsauthenticate", store_bool, ITEM(res_store.tls_authenticate), 0, 0, 0}, {"tlsenable", store_bool, ITEM(res_store.tls_enable), 0, 0, 0}, diff --git a/bacula/src/dird/dird_conf.h b/bacula/src/dird/dird_conf.h index 0a9d26cafb..952578127f 100644 --- a/bacula/src/dird/dird_conf.h +++ b/bacula/src/dird/dird_conf.h @@ -294,6 +294,7 @@ public: char *media_type; alist *device; /* Alternate devices for this Storage */ int32_t MaxConcurrentJobs; /* Maximum concurrent jobs */ + int32_t MaxConcurrentReadJobs; /* Maximum concurrent jobs reading */ int32_t NumConcurrentJobs; /* number of concurrent jobs running */ int32_t NumConcurrentReadJobs; /* number of jobs reading */ char *tls_ca_certfile; /* TLS CA Certificate File */ diff --git a/bacula/src/dird/jobq.c b/bacula/src/dird/jobq.c index 10a4ccdc9c..5c79d78e45 100644 --- a/bacula/src/dird/jobq.c +++ b/bacula/src/dird/jobq.c @@ -809,7 +809,10 @@ static pthread_mutex_t rstore_mutex = PTHREAD_MUTEX_INITIALIZER; bool inc_read_store(JCR *jcr) { P(rstore_mutex); - if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs) { + if (jcr->rstore->NumConcurrentJobs < jcr->rstore->MaxConcurrentJobs && + (jcr->getJobType() == JT_RESTORE || + jcr->rstore->MaxConcurrentReadJobs == 0 || + jcr->rstore->NumConcurrentReadJobs < jcr->rstore->MaxConcurrentReadJobs)) { jcr->rstore->NumConcurrentReadJobs++; jcr->rstore->NumConcurrentJobs++; Dmsg1(200, "Inc rncj=%d\n", jcr->rstore->NumConcurrentJobs); -- 2.39.5