CA-142603: don't delete old tapdisk logs

Don't delete old tapdisk logs as this is already done by
/opt/xensource/bin/delete_old_logs_by_space.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
CA-142603: use correct tapdisk log rotation rules

Rotation of logs is performed by /opt/xensource/bin/rotate_logs_by_size
(and not by logrotate itself) and the rules for that are specified in
/etc/logrotate-xenserver.conf. That configuration files contains
contains the wrong rule for blktap (it doesn't send the HUP signal).
Also, we already specify a logrotate configuration file in
/etc/logrotate.d/blktap which was never used.

This patch includes it in /etc/logrotate-xenserver.conf. Also, log
size, log age, and other options must come from
/etc/logrotate-xenserver.conf itself so they are removed from
/etc/logrotate.d/blktap.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Mate Lakat <mate.lakat@citrix.com>
Merge branch 'CA-142603' into xs64bit

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #120 on xapi-project/blktap
CA-138629: install bugtool rules for tapdisk

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>

GitHub: closes #119 on xapi-project/blktap
CA-140343: Fix error sign

Incorrect error sign shows "Unknown error 18446744073709551614"
Fixed error sign to get more meaningful error string.

Signed-off-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
Reviewed-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>

GitHub: closes #117 on xapi-project/blktap
CP-9457: write tapdisk PID in kthread-pid

This imitates blkback, allowing other components to use the process ID
of the application responsible for the data path as they please, e.g.
the toolstack using ionice(1) for QoS.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>

GitHub: closes #121 on xapi-project/blktap
CA-144882: don't complain about ENOENT when cleaning up the stats file

And ignore, but do log, errors when cleaning up the stats file.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Germano Percossi <germano.percossi@citrix.com>

GitHub: closes #123 on xapi-project/blktap
CA-136792: produce raw blkback-style stats

Produce I/O statistics in /dev/shm/vbd3-domid-devid. We use one file for
all seven counters as otherwise we're wasting too much memory. Unlike
blkback, the metric are in raw binary format, as this is the most
efficient way for producing them. The format of the statistics is
defined in /usr/include/blktap/blktap3.h.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>

GitHub: closes #97 on xapi-project/blktap
CA-145596: variable 'vreq' set but not used

vreq is not used at all, so removing it.

Signed-off-by: Mate Lakat <mate.lakat@citrix.com>
Reviewed-by: Thanos Makatos <thanos.makatos@citrix.com>

GitHub: closes #129 on xapi-project/blktap
CA-139733: Stop vhd false alarm

Stop complaining the primary footer is invalid during storage motion
since the backup one will be read. Warning messages when reading backup
one is kept.

Signed-off-by: Kaifeng Zhu <kaifeng.zhu@citrix.com>
Reviewed-by: Siddharth Vinothkumar <siddharth.vinothkumar@citrix.com>

GitHub: closes #118 on xapi-project/blktap
CA-142264: use errno as the error for the grant-copy ioctl

And improve error reporting.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CP-9459: don't retry request on EFAULT

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-142434: don't double free request buffer

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: documentation and debug

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: simplify ring suspend/resume interface

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: use accessor for determining whether there are pending requests

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: allow negative time outs to indicate infinity

Allow negative time outs in order to set an event's deadline to infinity.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: check ring unmap return value

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Chandrika Srinivasan <chandrika.srinivasan@citrix.com>
CA-141611: introduce check ring event

This patch introduces the check ring event. This allows scheduling an
event for checking the ring for new requests independent of event
channel notifications.

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-141611: break on barrier request

This patch introduces part of write I/O barrier functionality. When we
check the ring for requests, if we encounter a barrier request we
immediately stop extracting requests from the ring and mask the event
associated with checking the ring in order to avoid submitting new I/O
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>