CA-141611: complete barrier when all pending requests complete

This patch adds the rest of the functionality required for write I/O
barriers. When a request completes, we check whether there is a pending
barrier request and if so we complete it and schedule the event that
checks the ring for requests.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-144705: use correct depth when destroying dead rings

Take care when completing a barrier request of dead ring because the
completion function is recursively called.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: advertise write I/O barriers in Xenbus

blkback advertises I/O write barriers for CD-ROM devices as well, and so
do we.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: command line option to enable/disable write I/O barrier support

This can be useful for globally disabling write I/O barriers for
whatever reason (e.g. debugging).

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
CA-141611: write I/O barriers might contain data

Write I/O barriers might contain data to be written, so they must be
treated as a special kind of write.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Signed-off-by: Felipe Franciosi <felipe.franciosi@citrix.com>