From patchwork Fri Sep 7 15:44:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1423561 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 B9DF03FC85 for ; Fri, 7 Sep 2012 15:44:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751945Ab2IGPoo (ORCPT ); Fri, 7 Sep 2012 11:44:44 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:63393 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750854Ab2IGPoo (ORCPT ); Fri, 7 Sep 2012 11:44:44 -0400 Received: by mail-ie0-f174.google.com with SMTP id e11so5261193iej.19 for ; Fri, 07 Sep 2012 08:44:44 -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=6l26uEdBGwMZkzRpr1atnuzPR2mkMugUGXC1kR/HhJw=; b=hr3b61Qhus+wmbK225rNZmVRNb2dskBrpZE5uZTxQvBbXcCjZUm455stEvlRf5QEJB ZIIOVVNVAHoJgbX3YUPg06BywsV32XZKGqe4kYfMMLktSpVZZ06JImi/uOW7j8Uy1Avy DrsLu6W98uoJHwGXNIKFD4rghESrXV2UEG/JyXwpiObfR8nnpjDwcBJQ/8uFec5YgZ8R 9BYWsb4pjzD+qkLaQwxTokLF2znIRw1Z3AlRutSfo4l6GxvsnIyR+nPpO4jPYV+V9TJV 5izdUZNyjjFrAIkXm1pBh1eQQVqA0sCQiI4BFXRM+KXdxklJSlw30P8s7yzP4Op5s8jA Hjkw== Received: by 10.50.158.226 with SMTP id wx2mr9594694igb.18.1347032683701; Fri, 07 Sep 2012 08:44:43 -0700 (PDT) Received: from [172.22.22.4] (c-71-195-31-37.hsd1.mn.comcast.net. [71.195.31.37]) by mx.google.com with ESMTPS id bp8sm13581843igb.12.2012.09.07.08.44.42 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 08:44:42 -0700 (PDT) Message-ID: <504A1669.7030300@inktank.com> Date: Fri, 07 Sep 2012 10:44:41 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120827 Thunderbird/15.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 3/9] rbd: call set_snap() before snap_devs_update() References: <504A152E.4000905@inktank.com> In-Reply-To: <504A152E.4000905@inktank.com> X-Gm-Message-State: ALoCoQmbeYkCOCdwtRkflBe+Zjn0sZl6fvOJ/Rb76dBHSTWyfWq+b629bKsBY4rwjZPtLZ+PcFAH Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org rbd_header_set_snap() is a simple initialization routine for an rbd device's mapping. It has to be called after the snapshot context for the rbd_dev has been updated, but can be done before snapshot devices have been registered. Change the name to rbd_dev_set_mapping() to better reflect its purpose, and call it a little sooner, before registering snapshot devices. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) @@ -2621,11 +2621,12 @@ static ssize_t rbd_add(struct bus_type *bus, rc = rbd_dev_snaps_update(rbd_dev); if (rc) goto err_out_unlock; - rc = rbd_dev_snaps_register(rbd_dev); + + rc = rbd_dev_set_mapping(rbd_dev, snap_name); if (rc) goto err_out_unlock; - rc = rbd_header_set_snap(rbd_dev, snap_name); + rc = rbd_dev_snaps_register(rbd_dev); if (rc) goto err_out_unlock; diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d03fb0f..d60db25 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -640,7 +640,7 @@ static int snap_by_name(struct rbd_device *rbd_dev, const char *snap_name) return -ENOENT; } -static int rbd_header_set_snap(struct rbd_device *rbd_dev, char *snap_name) +static int rbd_dev_set_mapping(struct rbd_device *rbd_dev, char *snap_name) { int ret;