From patchwork Fri Apr 26 12:06:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 2493241 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 336A13FDC4 for ; Fri, 26 Apr 2013 12:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754726Ab3DZMGk (ORCPT ); Fri, 26 Apr 2013 08:06:40 -0400 Received: from mail-ia0-f180.google.com ([209.85.210.180]:63464 "EHLO mail-ia0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754134Ab3DZMG0 (ORCPT ); Fri, 26 Apr 2013 08:06:26 -0400 Received: by mail-ia0-f180.google.com with SMTP id t4so2580241iag.25 for ; Fri, 26 Apr 2013 05:06:25 -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=C8EMnSCkb+vIkuPPQM17hZQANidDKsEgoE3iC9wdZEQ=; b=R4/UdULB4DDg0JxMaTi9mp1z6PuYzC4YqJ1dQt9X0oJdLcBTaNpvq9kv6eO5l5EnXV gy6bFImPRcZZ5cWw5GT1RLljWQ3Sy3r735sITVy+HB8p/rphx5mI1IY2jHsxllOKrl6N scWkbCKk/2XMynAyjTgc6yYFuvGkNeJwyRnV71HqM9ka8V3D3FHrxLsBiPG0wwg3W16K V2w+yQrg9GRSXo6W5YS7cFrLu0EnNb0KlxOn34s3IoKLU9yPkj1HbfSoLzTDumH/jU+7 O6G4kx7Q38DgtjG7kQeoEMWBRFDW0wwx68RR5FXVpFqwHc3NwRR/cm+Bsq08rrQuEel4 a36g== X-Received: by 10.50.180.197 with SMTP id dq5mr1636328igc.22.1366977985568; Fri, 26 Apr 2013 05:06:25 -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 wn10sm2601376igb.2.2013.04.26.05.06.24 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Apr 2013 05:06:24 -0700 (PDT) Message-ID: <517A6DC0.7080005@inktank.com> Date: Fri, 26 Apr 2013 07:06:24 -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 4/6] rbd: rename __rbd_add_snap_dev() References: <517A6D39.80000@inktank.com> In-Reply-To: <517A6D39.80000@inktank.com> X-Gm-Message-State: ALoCoQmn4GWW7q7YY3tXQVuj0sfbUzLrnBWESxEwulnmb9YUyZ+FBsyKNxZpHq0yX7KGcO8mniQA Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Rename __rbd_add_snap_dev() to be rbd_snap_create(). We no longer have devices for non-mapped snapshots, and we're not actually "adding" it to the list in this function, just creating it. Rename rbd_remove_snap_dev() to be rbd_snap_destroy() for reasons similar to the above. Stop having this function delete the snapshot from its list (to be symmetrical with its create counterpart) and do that in the caller instead. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) size_t count); @@ -3010,8 +3010,10 @@ static void rbd_remove_all_snaps(struct rbd_device *rbd_dev) struct rbd_snap *snap; struct rbd_snap *next; - list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node) - rbd_remove_snap_dev(snap); + list_for_each_entry_safe(snap, next, &rbd_dev->snaps, node) { + list_del(&snap->node); + rbd_snap_destroy(snap); + } } static void rbd_update_mapping_size(struct rbd_device *rbd_dev) @@ -3413,14 +3415,13 @@ static void rbd_dev_destroy(struct rbd_device *rbd_dev) kfree(rbd_dev); } -static void rbd_remove_snap_dev(struct rbd_snap *snap) +static void rbd_snap_destroy(struct rbd_snap *snap) { - list_del(&snap->node); kfree(snap->name); kfree(snap); } -static struct rbd_snap *__rbd_add_snap_dev(struct rbd_device *rbd_dev, +static struct rbd_snap *rbd_snap_create(struct rbd_device *rbd_dev, const char *snap_name, u64 snap_id, u64 snap_size, u64 snap_features) @@ -4070,7 +4071,9 @@ static int rbd_dev_snaps_update(struct rbd_device *rbd_dev) rbd_dev->spec->snap_id == snap->id ? "mapped " : "", (unsigned long long)snap->id); - rbd_remove_snap_dev(snap); + + list_del(&snap->node); + rbd_snap_destroy(snap); /* Done with this list entry; advance */ @@ -4093,7 +4096,7 @@ static int rbd_dev_snaps_update(struct rbd_device *rbd_dev) /* We haven't seen this snapshot before */ - new_snap = __rbd_add_snap_dev(rbd_dev, snap_name, + new_snap = rbd_snap_create(rbd_dev, snap_name, snap_id, snap_size, snap_features); if (IS_ERR(new_snap)) { ret = PTR_ERR(new_snap); diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index e7d10d3..916741b 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -359,7 +359,7 @@ static int rbd_img_request_submit(struct rbd_img_request *img_request); static int rbd_dev_snaps_update(struct rbd_device *rbd_dev); static void rbd_dev_release(struct device *dev); -static void rbd_remove_snap_dev(struct rbd_snap *snap); +static void rbd_snap_destroy(struct rbd_snap *snap); static ssize_t rbd_add(struct bus_type *bus, const char *buf,