librados: unconditonally associate IoCtxImpl with AioCompletionImpl

We were only setting the pointer if we were on the aio_write_list.  Set
this pointer for any aio.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
librados: do aio callbacks in async thread

Call user completions in an async thread.  This allows callers to call back
into librados from the callback, and allows them to take locks in their
callbacks that they hold when queuing requests (making their life much
easier).

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
ObjectCacher: check for read/write errors

The objecter doesn't fix every error for us.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Filer: make file_to_extents static

Now the ObjectCacher has no need for a Filer instance (not that
it had a good reason for one before).

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: remove dependency on Objecter

Abstract out how writeback is done with a WritebackHandler object.
For RBD caching, this will be done by librados, but the Client uses
the Objecter directly.

This also requires different locks, since librbd does not have access
to the lock the underlying Objecter uses. Thus, both lock and the
writeback handler are parameters of the ObjectCacher constructor.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
librbd: remove writeback window

This is superseded by a full-fledged writeback cache.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
librbd: allow writeback caching

This uses the existing infrastructure of ObjectCacher for
buffer management and expiry.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
librbd: check for writes to snapshots

librados does this for us normally, but caching does not check for this.
We might as well check early to avoid scheduling a bunch of aios anyway.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
librbd: fix bytes read accounting in read_iterate

ObjectCacher will never do short reads, and always returns 0.
librados may do short reads at the end of an object.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
librbd: flush cache before creating a snapshot

This is a temporary workaround until the ObjectCacher
is smarter about snapshots.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: add some asserts about when the lock is held

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Remove unused Completion.h header

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: remove redundant 'public:'

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: remove unused/unimplemented methods

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
librados: debug logging for aio writes

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: always delete callback in commit_set

The GatherBuilder used later always deletes it. To make
the interface sane, delete it in every return path.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: remove useless conditional

We assert this condition at the beginning of the function.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
test_librbd: flush before opening another handle to the image

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
finisher: add indent settings header

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
ObjectCacher: include object when outputting a BufferHead

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>