From patchwork Sat Apr 27 12:37:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2497121 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 5CC3BDF23A for ; Sat, 27 Apr 2013 12:37:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755342Ab3D0MhV (ORCPT ); Sat, 27 Apr 2013 08:37:21 -0400 Received: from mail-ie0-f175.google.com ([209.85.223.175]:43040 "EHLO mail-ie0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752440Ab3D0MhV (ORCPT ); Sat, 27 Apr 2013 08:37:21 -0400 Received: by mail-ie0-f175.google.com with SMTP id a11so5918741iee.34 for ; Sat, 27 Apr 2013 05:37:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=DCrRVPpjcka41gbqGsa930oKMqfNJHsw399RQeMK7d4=; b=aAvUjJ/DcXI4a6RhGCrQBiqP11MjXBUMd9F2SCYgMHdo5tMWaB6uehTeMYlqU5q7Qr BGC4BnWxCFUD3b+Fr1op3P+Y6Y2gnPzmZOLgfjbMh8UeTwewbQG1h9DsttMs+bTtlt+d altEyq6bvziR8Q94jMIwEBwQcufi83DlzPsWmQU0rdAhlwbrpdP1+4zecatZtpOjZZ8b 0/o2UZByMEepxI09toyJY19eGtup0c4OSsxsh7KETCFqUK+s9xXkUBm1ieuXgmHqHaee 9IoZgDKre5MDjKsRYfbbYBaU39ASm5XzH6GLEBMMrEQJ4+7CKQKMpnkMez8QHFZCIo3d nhuQ== X-Received: by 10.50.18.74 with SMTP id u10mr4143361igd.42.1367066240823; Sat, 27 Apr 2013 05:37:20 -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 ESMTPSA id qn10sm7717798igc.6.2013.04.27.05.37.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 27 Apr 2013 05:37:20 -0700 (PDT) Message-ID: <517BC67F.5060806@inktank.com> Date: Sat, 27 Apr 2013 07:37:19 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 3/6] rbd: kill __rbd_remove() References: <517BC608.5030008@inktank.com> In-Reply-To: <517BC608.5030008@inktank.com> X-Gm-Message-State: ALoCoQm2dOWkWBmIuT39RvSWN7sj5v45YadHeQhpbOMJotKBhLK5I5twe8kEn8ZwFbrv80l6AnOt Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The function __rbd_remove() is used in two spots, and it's fairly simple. It combines cleanup of part of the ceph-side state as well as cleaning up the Linux-side state. Just open code it in the two callers and eliminate the function. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) first->parent_overlap = 0; @@ -5049,8 +5044,8 @@ static ssize_t rbd_remove(struct bus_type *bus, if (rbd_dev->parent) rbd_dev_remove_parent(rbd_dev); - __rbd_remove(rbd_dev); - + rbd_remove_all_snaps(rbd_dev); + rbd_bus_del_dev(rbd_dev); done: mutex_unlock(&ctl_mutex); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index fa703db..9936067 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -4982,12 +4982,6 @@ static void rbd_dev_release(struct device *dev) module_put(THIS_MODULE); } -static void __rbd_remove(struct rbd_device *rbd_dev) -{ - rbd_remove_all_snaps(rbd_dev); - rbd_bus_del_dev(rbd_dev); -} - static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) { while (rbd_dev->parent_spec) { @@ -5003,7 +4997,8 @@ static void rbd_dev_remove_parent(struct rbd_device *rbd_dev) first = second; second = third; } - __rbd_remove(second); + rbd_remove_all_snaps(second); + rbd_bus_del_dev(second); rbd_spec_put(first->parent_spec); first->parent_spec = NULL;