From patchwork Wed Oct 31 01:49:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1675331 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 3403F3FD8C for ; Wed, 31 Oct 2012 01:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756396Ab2JaBtK (ORCPT ); Tue, 30 Oct 2012 21:49:10 -0400 Received: from mail-ia0-f174.google.com ([209.85.210.174]:50952 "EHLO mail-ia0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753809Ab2JaBtK (ORCPT ); Tue, 30 Oct 2012 21:49:10 -0400 Received: by mail-ia0-f174.google.com with SMTP id y32so677182iag.19 for ; Tue, 30 Oct 2012 18:49:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=E/sgGxqU8VXC7q5K9EjLN4wD3QS0vlVsOkWvg30PEsE=; b=fiIM2c8JbwjElSJeycUYJs9Ap44zLrbKmyDwn7tBwI+CTiN6B5hEcJ479uEzOX4zwa E/p1QQoi0lSuwfpNMrng7ne3nZ0hVroTPvrsB1F04abzlzAzWb9lXxl0gmXeLhcbYWkx Y3sHf136JW/speRGs0avtnRmGzNUefezXrbkIE/tmBcmhh806JYdogV9mfbh7PuqKo9A a5VfuZSbtlBt/b+kK87dTuBKeV65i9UAJngkx/pW5Btg3ROhMLZ8MoDLRCodSE91ScVG 5vI+2oFW4SRJoOVHWrommYEeZU5dmAFu0G4wLg9Ics16DpYlQ6bLcGEWP8XjEnjdK/I5 gx8Q== Received: by 10.50.95.161 with SMTP id dl1mr245951igb.0.1351648149321; Tue, 30 Oct 2012 18:49:09 -0700 (PDT) Received: from [172.22.22.4] (c-24-118-242-216.hsd1.mn.comcast.net. [24.118.242.216]) by mx.google.com with ESMTPS id bg10sm9462549igc.6.2012.10.30.18.49.05 (version=SSLv3 cipher=OTHER); Tue, 30 Oct 2012 18:49:06 -0700 (PDT) Message-ID: <50908390.5020607@inktank.com> Date: Tue, 30 Oct 2012 20:49:04 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121028 Thunderbird/16.0.2 MIME-Version: 1.0 To: ceph-devel Subject: [PATCH 1/6] rbd: skip getting image id if known References: <509081C4.3050402@inktank.com> In-Reply-To: <509081C4.3050402@inktank.com> X-Gm-Message-State: ALoCoQn5//dus0/ea8wmLLyhqXY6wxIxoXV0E3yyb3cx95taCC7H+xoa6sZeSEbiIaPMmQ3GQINA Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org 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 Reviewed-by: Josh Durgin --- 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.