diff mbox

[1/6] rbd: skip getting image id if known

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

Commit Message

Alex Elder Oct. 31, 2012, 1:49 a.m. UTC
We will know the image id for format 2 parent images, but won't
initially know its image name.  Avoid making the query for an image
id in rbd_dev_image_id() if it's already known.

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

 	 */

Comments

Josh Durgin Oct. 31, 2012, 9:05 p.m. UTC | #1
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>

On 10/30/2012 06:49 PM, Alex Elder wrote:
> We will know the image id for format 2 parent images, but won't
> initially know its image name.  Avoid making the query for an image
> id in rbd_dev_image_id() if it's already known.
>
> Signed-off-by: Alex Elder <elder@inktank.com>
> ---
>   drivers/block/rbd.c |    8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 8d26c0f..a852133 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -3068,6 +3068,14 @@ static int rbd_dev_image_id(struct rbd_device
> *rbd_dev)
>   	void *p;
>
>   	/*
> +	 * When probing a parent image, the image id is already
> +	 * known (and the image name likely is not).  There's no
> +	 * need to fetch the image id again in this case.
> +	 */
> +	if (rbd_dev->spec->image_id)
> +		return 0;
> +
> +	/*
>   	 * First, see if the format 2 image id file exists, and if
>   	 * so, get the image's persistent id from it.
>   	 */
>

--
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 8d26c0f..a852133 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3068,6 +3068,14 @@  static int rbd_dev_image_id(struct rbd_device
*rbd_dev)
 	void *p;

 	/*
+	 * When probing a parent image, the image id is already
+	 * known (and the image name likely is not).  There's no
+	 * need to fetch the image id again in this case.
+	 */
+	if (rbd_dev->spec->image_id)
+		return 0;
+
+	/*
 	 * First, see if the format 2 image id file exists, and if
 	 * so, get the image's persistent id from it.