summaryrefslogtreecommitdiffstats
path: root/drivers/block/rbd.c
diff options
context:
space:
mode:
authorAlex Elder2013-01-24 23:13:36 +0100
committerSage Weil2013-05-02 06:18:42 +0200
commitd0b2e944555d1f06cf6df8a37b76367d10b05b01 (patch)
treeb5a16102318c48f9403ad5af78193f00722754e9 /drivers/block/rbd.c
parentrbd: define image request originator flag (diff)
downloadkernel-qcow2-linux-d0b2e944555d1f06cf6df8a37b76367d10b05b01.tar.gz
kernel-qcow2-linux-d0b2e944555d1f06cf6df8a37b76367d10b05b01.tar.xz
kernel-qcow2-linux-d0b2e944555d1f06cf6df8a37b76367d10b05b01.zip
rbd: define image request layered flag
Define a flag indicating whether an image request is for a layered image (one with a parent image to which requests will be redirected if the target object of a request does not exist). The code that checks this flag will be added shortly. Signed-off-by: Alex Elder <elder@inktank.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
Diffstat (limited to 'drivers/block/rbd.c')
-rw-r--r--drivers/block/rbd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 7ecd9099ea89..a77157d87915 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -205,6 +205,7 @@ struct rbd_obj_request {
enum img_req_flags {
IMG_REQ_WRITE, /* I/O direction: read = 0, write = 1 */
IMG_REQ_CHILD, /* initiator: block = 0, child image = 1 */
+ IMG_REQ_LAYERED, /* ENOENT handling: normal = 0, layered = 1 */
};
struct rbd_img_request {
@@ -1247,6 +1248,18 @@ static bool img_request_child_test(struct rbd_img_request *img_request)
return test_bit(IMG_REQ_CHILD, &img_request->flags) != 0;
}
+static void img_request_layered_set(struct rbd_img_request *img_request)
+{
+ set_bit(IMG_REQ_LAYERED, &img_request->flags);
+ smp_mb();
+}
+
+static bool img_request_layered_test(struct rbd_img_request *img_request)
+{
+ smp_mb();
+ return test_bit(IMG_REQ_LAYERED, &img_request->flags) != 0;
+}
+
static void
rbd_img_obj_request_read_callback(struct rbd_obj_request *obj_request)
{
@@ -1549,6 +1562,8 @@ static struct rbd_img_request *rbd_img_request_create(
}
if (child_request)
img_request_child_set(img_request);
+ if (rbd_dev->parent_spec)
+ img_request_layered_set(img_request);
spin_lock_init(&img_request->completion_lock);
img_request->next_completion = 0;
img_request->callback = NULL;
@@ -1557,6 +1572,7 @@ static struct rbd_img_request *rbd_img_request_create(
INIT_LIST_HEAD(&img_request->obj_requests);
kref_init(&img_request->kref);
+ (void) img_request_layered_test(img_request); /* Avoid a warning */
rbd_img_request_get(img_request); /* Avoid a warning */
rbd_img_request_put(img_request); /* TEMPORARY */