diff mbox

[10/12,v2] rbd: send notify ack asynchronously

Message ID 510162E0.1040403@inktank.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Elder Jan. 24, 2013, 4:35 p.m. UTC
When we receive notification of a change to an rbd image's header
object we need to refresh our information about the image (its
size and snapshot context).  Once we have refreshed our rbd image
we need to acknowledge the notification.

This acknowledgement was previously done synchronously, but there's
really no need to wait for it to complete.

Change it so the caller doesn't wait for the notify acknowledgement
request to complete.  And change the name to reflect it's no longer
synchronous.

This resolves:
    http://tracker.newdream.net/issues/3877

Signed-off-by: Alex Elder <elder@inktank.com>
---
 drivers/block/rbd.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

 	struct rbd_obj_request *obj_request;
@@ -1808,11 +1808,11 @@ static int rbd_obj_notify_ack_sync(struct
rbd_device *rbd_dev,
 		goto out;

 	osdc = &rbd_dev->rbd_client->client->osdc;
+	obj_request->callback = rbd_obj_request_put;
 	ret = rbd_obj_request_submit(osdc, obj_request);
-	if (!ret)
-		ret = rbd_obj_request_wait(obj_request);
 out:
-	rbd_obj_request_put(obj_request);
+	if (ret)
+		rbd_obj_request_put(obj_request);

 	return ret;
 }
@@ -1834,7 +1834,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id,
u8 opcode, void *data)
 		rbd_warn(rbd_dev, "got notification but failed to "
 			   " update snaps: %d\n", rc);

-	rbd_obj_notify_ack_sync(rbd_dev, hver, notify_id);
+	rbd_obj_notify_ack(rbd_dev, hver, notify_id);
 }

 /*

Comments

Josh Durgin Jan. 29, 2013, 11:01 a.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 01/24/2013 08:35 AM, Alex Elder wrote:
> When we receive notification of a change to an rbd image's header
> object we need to refresh our information about the image (its
> size and snapshot context).  Once we have refreshed our rbd image
> we need to acknowledge the notification.
>
> This acknowledgement was previously done synchronously, but there's
> really no need to wait for it to complete.
>
> Change it so the caller doesn't wait for the notify acknowledgement
> request to complete.  And change the name to reflect it's no longer
> synchronous.
>
> This resolves:
>      http://tracker.newdream.net/issues/3877
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |   10 +++++-----
>   1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index b952b2f..48650d1 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -1784,7 +1784,7 @@ static int rbd_img_request_submit(struct
> rbd_img_request *img_request)
>   	return 0;
>   }
>
> -static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev,
> +static int rbd_obj_notify_ack(struct rbd_device *rbd_dev,
>   				   u64 ver, u64 notify_id)
>   {
>   	struct rbd_obj_request *obj_request;
> @@ -1808,11 +1808,11 @@ static int rbd_obj_notify_ack_sync(struct
> rbd_device *rbd_dev,
>   		goto out;
>
>   	osdc = &rbd_dev->rbd_client->client->osdc;
> +	obj_request->callback = rbd_obj_request_put;
>   	ret = rbd_obj_request_submit(osdc, obj_request);
> -	if (!ret)
> -		ret = rbd_obj_request_wait(obj_request);
>   out:
> -	rbd_obj_request_put(obj_request);
> +	if (ret)
> +		rbd_obj_request_put(obj_request);
>
>   	return ret;
>   }
> @@ -1834,7 +1834,7 @@ static void rbd_watch_cb(u64 ver, u64 notify_id,
> u8 opcode, void *data)
>   		rbd_warn(rbd_dev, "got notification but failed to "
>   			   " update snaps: %d\n", rc);
>
> -	rbd_obj_notify_ack_sync(rbd_dev, hver, notify_id);
> +	rbd_obj_notify_ack(rbd_dev, hver, notify_id);
>   }
>
>   /*
>

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index b952b2f..48650d1 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -1784,7 +1784,7 @@  static int rbd_img_request_submit(struct
rbd_img_request *img_request)
 	return 0;
 }

-static int rbd_obj_notify_ack_sync(struct rbd_device *rbd_dev,
+static int rbd_obj_notify_ack(struct rbd_device *rbd_dev,
 				   u64 ver, u64 notify_id)
 {