diff options
author | pjd <pjd@FreeBSD.org> | 2011-03-06 23:09:33 +0000 |
---|---|---|
committer | pjd <pjd@FreeBSD.org> | 2011-03-06 23:09:33 +0000 |
commit | 337b50efa895f3694fae9eeac35a3abd16181e75 (patch) | |
tree | 89777d06274aeb1f7f06b2647305a98d160268c9 /sbin/hastd/primary.c | |
parent | 8697092f0ef00a8c8c15e4c26574e6fbfce848a2 (diff) | |
download | FreeBSD-src-337b50efa895f3694fae9eeac35a3abd16181e75.zip FreeBSD-src-337b50efa895f3694fae9eeac35a3abd16181e75.tar.gz |
Allow to compress on-the-wire data using two algorithms:
- HOLE - it simply turns all-zero blocks into few bytes header;
it is extremely fast, so it is turned on by default;
it is mostly intended to speed up initial synchronization
where we expect many zeros;
- LZF - very fast algorithm by Marc Alexander Lehmann, which shows
very decent compression ratio and has BSD license.
MFC after: 2 weeks
Diffstat (limited to 'sbin/hastd/primary.c')
-rw-r--r-- | sbin/hastd/primary.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c index aa4d103..5691c0d 100644 --- a/sbin/hastd/primary.c +++ b/sbin/hastd/primary.c @@ -1910,6 +1910,7 @@ primary_config_reload(struct hast_resource *res, struct nv *nv) nv_assert(nv, "remoteaddr"); nv_assert(nv, "replication"); nv_assert(nv, "checksum"); + nv_assert(nv, "compression"); nv_assert(nv, "timeout"); nv_assert(nv, "exec"); @@ -1918,6 +1919,7 @@ primary_config_reload(struct hast_resource *res, struct nv *nv) #define MODIFIED_REMOTEADDR 0x01 #define MODIFIED_REPLICATION 0x02 #define MODIFIED_CHECKSUM 0x04 +#define MODIFIED_COMPRESSION 0x08 #define MODIFIED_TIMEOUT 0x10 #define MODIFIED_EXEC 0x20 modified = 0; @@ -1941,6 +1943,11 @@ primary_config_reload(struct hast_resource *res, struct nv *nv) gres->hr_checksum = vint; modified |= MODIFIED_CHECKSUM; } + vint = nv_get_int32(nv, "compression"); + if (gres->hr_compression != vint) { + gres->hr_compression = vint; + modified |= MODIFIED_COMPRESSION; + } vint = nv_get_int32(nv, "timeout"); if (gres->hr_timeout != vint) { gres->hr_timeout = vint; @@ -1994,6 +2001,7 @@ primary_config_reload(struct hast_resource *res, struct nv *nv) #undef MODIFIED_REMOTEADDR #undef MODIFIED_REPLICATION #undef MODIFIED_CHECKSUM +#undef MODIFIED_COMPRESSION #undef MODIFIED_TIMEOUT #undef MODIFIED_EXEC |