From patchwork Thu Jul 26 18:45:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1244111 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 7EAEE3FC5A for ; Thu, 26 Jul 2012 18:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752422Ab2GZSpW (ORCPT ); Thu, 26 Jul 2012 14:45:22 -0400 Received: from mail-gg0-f174.google.com ([209.85.161.174]:59777 "EHLO mail-gg0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752416Ab2GZSpV (ORCPT ); Thu, 26 Jul 2012 14:45:21 -0400 Received: by mail-gg0-f174.google.com with SMTP id u4so2311502ggl.19 for ; Thu, 26 Jul 2012 11:45:20 -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=ow648j78jDSU/buH4QGO62l7V3NHn7BzyRTTJMCOaDc=; b=YdjW4AQyQRv8SVtGkFHwyu81DP3t3EFhkQ3/CgIj1xEqgguxKc+TQnRInq7tqhQe5b hbqmAbLXAQPrSkmwwVlZLJ1ZAJE+ixgDlu+GS7XNvCK9shO7q5ObesbRXA6hyEyr4WTt lsmsF1I0A22Q3G4OVraaaHGnHNIQ39xTHugX1qG7RDm0MQ5CLv+TO3PYgGpqbgODOxUn Wj/pEe+c9TEHNbS6V1MeIULeZAHm898GxJExRTw8xhnJJDRTCPqCS4CcZESdOvHp/i4Y vBqudC/DsV3jgZt1J/KJcmvvL19Wk587RzgFZjE1RZEfVgBgKaHmYjRqNembXPwrHXTZ lv9w== Received: by 10.236.191.42 with SMTP id f30mr28318427yhn.123.1343328320717; Thu, 26 Jul 2012 11:45: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 ESMTPS id j17sm22271012anl.5.2012.07.26.11.45.19 (version=SSLv3 cipher=OTHER); Thu, 26 Jul 2012 11:45:20 -0700 (PDT) Message-ID: <5011903E.6030504@inktank.com> Date: Thu, 26 Jul 2012 13:45:18 -0500 From: Alex Elder User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: ceph-devel@vger.kernel.org Subject: [PATCH 6/6] rbd: rename rbd_device->id References: <50118F33.7080502@inktank.com> In-Reply-To: <50118F33.7080502@inktank.com> X-Gm-Message-State: ALoCoQmn7uzGb7cgmWKOzh4OkTVk7El0TMtFBCtk9zG6u1v/gkbFfBvjX3TOQ6V1ewa5Ir3cAZeu Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org The "id" field of an rbd device structure represents the unique client-local device id mapped to the underlying rbd image. Each rbd image will have another id--the image id--and each snapshot has its own id as well. The simple name "id" no longer conveys the information one might like to have. Rename the device "id" field in struct rbd_dev to be "dev_id" to make it a little more obvious what we're dealing with without having to think more about context. Signed-off-by: Alex Elder --- drivers/block/rbd.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) } diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index d95d563..0fda2ed 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -147,7 +147,7 @@ struct rbd_snap { * a single device */ struct rbd_device { - int id; /* blkdev unique id */ + int dev_id; /* blkdev unique id */ int major; /* blkdev assigned major */ struct gendisk *disk; /* blkdev's gendisk and rq */ @@ -1778,7 +1778,7 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) goto out; snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d", - rbd_dev->id); + rbd_dev->dev_id); disk->major = rbd_dev->major; disk->first_minor = 0; disk->fops = &rbd_bd_ops; @@ -2167,7 +2167,7 @@ static int rbd_bus_add_dev(struct rbd_device *rbd_dev) dev->type = &rbd_device_type; dev->parent = &rbd_root_dev; dev->release = rbd_dev_release; - dev_set_name(dev, "%d", rbd_dev->id); + dev_set_name(dev, "%d", rbd_dev->dev_id); ret = device_register(dev); if (ret < 0) goto out; @@ -2215,7 +2215,7 @@ static atomic64_t rbd_id_max = ATOMIC64_INIT(0); */ static void rbd_id_get(struct rbd_device *rbd_dev) { - rbd_dev->id = atomic64_inc_return(&rbd_id_max); + rbd_dev->dev_id = atomic64_inc_return(&rbd_id_max); spin_lock(&rbd_dev_list_lock); list_add_tail(&rbd_dev->node, &rbd_dev_list); @@ -2229,7 +2229,7 @@ static void rbd_id_get(struct rbd_device *rbd_dev) static void rbd_id_put(struct rbd_device *rbd_dev) { struct list_head *tmp; - int rbd_id = rbd_dev->id; + int rbd_id = rbd_dev->dev_id; int max_id; BUG_ON(rbd_id < 1); @@ -2468,7 +2468,7 @@ static ssize_t rbd_add(struct bus_type *bus, /* Fill in the device name, now that we have its id. */ BUILD_BUG_ON(DEV_NAME_LEN < sizeof (RBD_DRV_NAME) + MAX_INT_FORMAT_WIDTH); - sprintf(rbd_dev->name, "%s%d", RBD_DRV_NAME, rbd_dev->id); + sprintf(rbd_dev->name, "%s%d", RBD_DRV_NAME, rbd_dev->dev_id); /* parse add command */ rc = rbd_add_parse_args(rbd_dev, buf, &mon_addrs, &mon_addrs_size, @@ -2545,7 +2545,7 @@ err_nomem: return (ssize_t) rc; } -static struct rbd_device *__rbd_get_dev(unsigned long id) +static struct rbd_device *__rbd_get_dev(unsigned long dev_id) { struct list_head *tmp; struct rbd_device *rbd_dev; @@ -2553,7 +2553,7 @@ static struct rbd_device *__rbd_get_dev(unsigned long id) spin_lock(&rbd_dev_list_lock); list_for_each(tmp, &rbd_dev_list) { rbd_dev = list_entry(tmp, struct rbd_device, node); - if (rbd_dev->id == id) { + if (rbd_dev->dev_id == dev_id) { spin_unlock(&rbd_dev_list_lock); return rbd_dev;