CA-137830: enable memory caching for the VHD cache in IntelliCache

This patch enables memory caching for the VHD file acting as the cache
in IntelliCache, despite the fact that it is opened in R/W mode. Without
this, read caching interacts badly with IntelliCahce. This is safe to do
so as the cache file is always thrown away.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
CA-137830: change behaviour of vhd_cache_enabled

vhd_cache_enabled must return true not only if the VHD_CACHED_ENABLED
bit is set, but also if the VHD file in opened in read only mode
(VHD_OPEN_RDWR is not set). This ensures that if the leaf is opened R/W
and for buffered I/O (which is the case for IntelliCache), the parent
chain is is not considered 'cached'.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
CA-137830: don't pass TD_OPEN_NO_O_DIRECT to parent in IntelliCache

If IntelliCache is used, TD_OPEN_NO_O_DIRECT must not be passed to the
parent otherwise tapdisk will perform buffered I/O to the parent, and
this is meaningless as each block read from the parent is only read
once.

Signed-off-by: Thanos Makatos <thanos.makatos@citrix.com>
Reviewed-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Merge branch 'CA-137830' into xs64bit

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

GitHub: closes #94 on xapi-project/blktap