synctask: support for (assymetric) counted barriers

This patch introduces a new set of primitives:

  - synctask_barrier_init (stub)
  - synctask_barrier_waitfor (stub, count)
  - synctask_barrier_wake (stub)

Unlike pthread_barrier_t, this barrier has an explicit notion of
"waiter" and "waker". The "waiter" waits for @count number of
"wakers" to call synctask_barrier_wake() before returning. The
wait performed by the waiter via synctask_barrier_waitfor() is
co-operative in nature and yields the thread for scheduling other
synctasks in the mean time.

Intended use case:

  Eliminate excessive serialization in glusterd and allow for
concurrent RPC transactions.

  Code which are currently in this format:

---old---

  list_for_each_entry (peerinfo, peers, op_peers_list) {
          ...
          GD_SYNCOP (peerinfo->rpc, stub, rpc_cbk, ...);
  }

  ...

  int rpc_cbk (rpc, stub, ...)
  {
          ...
          __wake (stub);
  }

---old---

  Can be restructred into the format:

---new---

  synctask_barrier_init (stub);
  {
          list_for_each_entry (peerinfo, peers, op_peers_list) {
                  ...
                  rpc_submit (peerinfo->rpc, stub, rpc_cbk, ...);
                  count++;
           }
   }
   synctask_barrier_wait (stub, count);

   ...

   int rpc_cbk (rpc, stub, ...)
   {
           ...
           synctask_barrier_wake (stub);
   }

---new---

  In the above structure, from the synctask's point of view, the region
between synctask_barrier_init() and synctask_barrier_wait() are spawning
off asynchronous "threads" (or RPC) and keep count of how many such
threads have been spawned. Each of those threads are expected to make
one call to synctask_barrier_wake(). The call to synctask_barrier_wait()
makes the synctask thread co-operatively wait/sleep till @count such threads
call their wake function.

  This way, the synctask thread retains the "synchronous" flow in the code,
yet at the same time allows for asynchronous "threads" to acheive parallelism
over RPC.

Change-Id: Ie037f99b2d306b71e63e3a56353daec06fb0bf41
BUG: 913662
Signed-off-by: Anand Avati <avati@redhat.com>
Reviewed-on: http://review.gluster.org/4558
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
features/compress: Compression/DeCompression translator

Made minor changes to apply Venky's cdc xlator patch
* Changed Makefile.am to reflect changes from commit 58e6296f
* Code to be merged into glusterd-volgen.c moved to glusterd-volume-set.c
  file which was introduced by commit 99fe09f4

The following work has been done by Venky Shankar.
Original-author : Venky Shankar <vshankar@redhat.com>

On the server this translator compresses (deflate) data before
it's pushed out to the network to the client. On the client
this compressed data is decompressed (inflate) to it's original
form. What is saved is the amount of data that is sent over
the wire.

(De)Compression is done using Zlib library (inflate/deflate
routines respectively). As of now, data is transferred in
gzip format (header + <compressed data> + trailer). The
header can be taken away to make data more lightweight.
Trailer is needed as it contains the CRC and length of the
original (uncompressed) data used for validating inflated
data.

HOW TO USE
----------
As of now, you'd need to edit the volfile to use this feature;
there is no way to do so from CLI. On the server, load it above
the server translator so that data is compressed just before it
is send out to the network. On the client, load it below the
client translator. But since there can be multiple instances of
the client translator (distribute, replicate etc..), you'd need
to have that many instances of this translator *pointing* to
it's respective client translator.

Change-Id: Ib7a66b6f1f70fe002b7c513588cdf75c69370805
Signed-off-by: Venky Shankar <vshankar@redhat.com>
Signed-off-by: Prashanth Pai <nullpai@gmail.com>
features/compress: Added writev

Writev compresses data on client and decompresses on server.
Similarly readv compresses data on server and decompresses on client.

The possible values for "mode" option of the cdc xlator were compress/decompress earlier.
This has been changed after adding writev. Currently the mode option can be client/server.

Other minor changes :
* Check for min file size and buffer size while loading xlator
* Change OS type in gzip header from invalid(254) to UNIX(3)

Change-Id: If4eb4f8af2d63b4bc059e9daaecfda9e1ad8ea56
Signed-off-by: Prashanth Pai <nullpai@gmail.com>
features/compress: Set compression xlator options from CLI

Ex : gluster volume set <vol_name> compress on
     gluster volume set <vol_name> compress.buffer-size 32768

Change-Id: Id30459fd76f7b5155d7b063c36e9caeee4923339
Signed-off-by: Prashanth Pai <nullpai@gmail.com>