Attached is a patch against Bacula-3.0.3 to implement the feature
request listed above. I'd been looking for a way to disable FD
compression when FDs are writing to my LTO3 drive, which has hardware
compression because it really does make a large difference in backup
speed, even vs. GZIP1 (especially when combined with FD encryption).
I've simply added another configuration option for any Storage {}
resource in the Director's config. An admin may set AllowCompression=No
for a particular storage resource, causing the director to prevent any
GZIP compression options from being sent to the FD when a job is run
against that particular storage resource. The default for the directive
is Yes/true so that behavior is unchanged for anyone who does not choose
to set it. There may be a better way to strip the compression flags
from the fo->opts[] going out to the FD, but this works great and
appears readable to me.
Any feedback or suggestions would be appreciated. I'd like to see the
code added to a later version of Bacula.
Thanks,
Steve Polyack
--- bacula-3.0.3/src/dird/dird_conf.c 2009-10-18 05:10:16.000000000 -0400
+++ bacula-3.0.3-patched/src/dird/dird_conf.c 2009-11-18 15:58:36.000000000
-0500
@@ -221,6 +221,7 @@
{"mediatype", store_strname, ITEM(res_store.media_type), 0,
ITEM_REQUIRED, 0},
{"autochanger", store_bool, ITEM(res_store.autochanger), 0,
ITEM_DEFAULT, 0},
{"enabled", store_bool, ITEM(res_store.enabled), 0,
ITEM_DEFAULT, true},
+ {"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},
{"sddport", store_pint32, ITEM(res_store.SDDport), 0, 0, 0}, /* deprecated
*/
diff -ur
/usr/obj/usr/ports/sysutils/bacula-server/work/bacula-3.0.3/src/dird/dird_conf.h
dird/dird_conf.h
---
/usr/obj/usr/ports/sysutils/bacula-server/work/bacula-3.0.3/src/dird/dird_conf.h
2009-10-18 05:10:16.000000000 -0400
+++ bacula-3.0.3-patched/src/dird/dird_conf.h 2009-11-18 15:58:05.000000000
-0500
@@ -306,6 +306,7 @@
bool tls_require; /* Require TLS */
bool enabled; /* Set if device is enabled */
bool autochanger; /* set if autochanger */
+ bool allowcompress; /* set if this Storage should allow jobs
to enable compression */
int64_t StorageId; /* Set from Storage DB record */
utime_t heartbeat_interval; /* Interval to send heartbeats */
uint32_t drives; /* number of drives in autochanger */
diff -ur
/usr/obj/usr/ports/sysutils/bacula-server/work/bacula-3.0.3/src/dird/fd_cmds.c
dird/fd_cmds.c
---
/usr/obj/usr/ports/sysutils/bacula-server/work/bacula-3.0.3/src/dird/fd_cmds.c
2009-10-18 05:10:16.000000000 -0400
+++ bacula-3.0.3-patched/src/dird/fd_cmds.c 2009-11-18 15:59:41.000000000
-0500
@@ -333,6 +333,7 @@
{
FILESET *fileset = jcr->fileset;
BSOCK *fd = jcr->file_bsock;
+ STORE *store = jcr->wstore;
int num;
bool include = true;
@@ -359,7 +360,22 @@
}
for (j=0; j<ie->num_opts; j++) {
FOPTS *fo = ie->opts_list[j];
- fd->fsend("O %s\n", fo->opts);
+
+ if (!store->allowcompress) {
+ char newopts[MAX_FOPTS];
+ int j = 0;
+ for (k=0; fo->opts[k]!='\0'; k++) {
+ if (fo->opts[k]=='Z') { // Z compress option is always
followed by the single-digit compress level
+ k++; // this will skip over it
+ } else {
+ newopts[j] = fo->opts[k];
+ j++;
+ }
+ }
+ newopts[j] = '\0';
+ // Copy the new options without compression to be sent
+ bstrncpy(fo->opts, newopts, MAX_FOPTS);
+ }
bool enhanced_wild = false;
for (k=0; fo->opts[k]!='\0'; k++) {
@@ -369,6 +385,8 @@
}
}
+ fd->fsend("O %s\n", fo->opts);
+
for (k=0; k<fo->regex.size(); k++) {
fd->fsend("R %s\n", fo->regex.get(k));
}
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________
Bacula-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bacula-devel