]> git.apps.os.sepia.ceph.com Git - ceph-client.git/commit
rbd: only get snap context for write requests
authorAlex Elder <elder@inktank.com>
Fri, 9 Nov 2012 14:43:15 +0000 (08:43 -0600)
committerAlex Elder <elder@inktank.com>
Mon, 19 Nov 2012 23:37:49 +0000 (17:37 -0600)
commit7bdad946cf4d05331295b4d2fcdaa3e3eea7f506
tree01caa8e36245cafb4058e8b74dc7c30aebb83776
parentf5ef3c030493a231b5829b03847f0b997cb3e9d2
rbd: only get snap context for write requests

Right now we get and release the header semaphore every time we
process a request for an rbd image.  We do this because for write
requests we need to supply the snapshot context, and we can't
safely get a reference to it without holding that semaphore.

There's no need to get the snap context if we're doing a read,
so avoid doing so in that case.

The rbd_device->exists field can be updated asynchronously, changing
from set to clear if a mapped snapshot disappears from the base
image's snapshot context.  Although I don't think synchronizing
access to this carefully is that critical, it is converted here to
be an atomic variable so a request is aware the flag is clear as
soon as that is known.

Signed-off-by: Alex Elder <elder@inktank.com>
drivers/block/rbd.c