From patchwork Fri Sep 7 13:46:33 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 1422581 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 C426E3FC85 for ; Fri, 7 Sep 2012 13:46:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759003Ab2IGNqf (ORCPT ); Fri, 7 Sep 2012 09:46:35 -0400 Received: from mail-ie0-f174.google.com ([209.85.223.174]:39928 "EHLO mail-ie0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752249Ab2IGNqf (ORCPT ); Fri, 7 Sep 2012 09:46:35 -0400 Received: by mail-ie0-f174.google.com with SMTP id e11so5016008iej.19 for ; Fri, 07 Sep 2012 06:46:34 -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=+ij0mBozSloaQhf7zSfHR1KZdufdvds7APcaJNt/KKM=; b=c7X8laFmth1YomE5/ZZ07EWkRnmugnnfAUMmDYLKXaLcTcHSnfg/Pv+6mFWP6MlTyA Zn9hjXg9BA6HqVrs/BHSM6gHlFOxW38n+JNtBUHGEuVdafZNKveMeMDgP+Yh4OZjEyo3 v4c46KdXdVe+7M4n8XtSB3vCLdzuy+0TBKT1BZY9naPHhIDOgYQt5vapdN86Fh4m7d6o oe01qyd3YKvTOxx17vdAGht1Bekjy0zmVl2KcrGiuowY9LjwTvjAFD5sJNl/b6uKAHIv 9FzmqUFRccpWNaNQBtnGJkVddtbNYrfRERY9tLwc2uKkP0zwM6vaVFC5FPSMYD/J000c wJbA== Received: by 10.42.170.73 with SMTP id e9mr7092036icz.11.1347025594752; Fri, 07 Sep 2012 06:46:34 -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 bp8sm12961621igb.12.2012.09.07.06.46.33 (version=SSLv3 cipher=OTHER); Fri, 07 Sep 2012 06:46:33 -0700 (PDT) Message-ID: <5049FAB9.30607@inktank.com> Date: Fri, 07 Sep 2012 08:46:33 -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 7/7] rbd: simplify rbd_init_disk() a bit References: <5049F951.2030706@inktank.com> In-Reply-To: <5049F951.2030706@inktank.com> X-Gm-Message-State: ALoCoQnyu4/clqhdi5VvJ9icj53dZ8C+J9Fi+fY6h+5zfRfas+dRnFYXNWKaPfxKPw3OwysIkWkk Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org This just simplifies a few things in rbd_init_disk(), now that the previous patch has moved a bunch of initialization code out if it. Done separately to facilitate review. Signed-off-by: Alex Elder Reviewed-by: Josh Durgin --- drivers/block/rbd.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 6e735a7..634a16c 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c @@ -1870,14 +1870,12 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) { struct gendisk *disk; struct request_queue *q; - int rc; u64 segment_size; /* create gendisk info */ - rc = -ENOMEM; disk = alloc_disk(RBD_MINORS_PER_MAJOR); if (!disk) - goto out; + return -ENOMEM; snprintf(disk->disk_name, sizeof(disk->disk_name), RBD_DRV_NAME "%d", rbd_dev->dev_id); @@ -1887,7 +1885,6 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) disk->private_data = rbd_dev; /* init rq */ - rc = -ENOMEM; q = blk_init_queue(rbd_rq_fn, &rbd_dev->lock); if (!q) goto out_disk; @@ -1910,11 +1907,10 @@ static int rbd_init_disk(struct rbd_device *rbd_dev) rbd_dev->disk = disk; return 0; - out_disk: put_disk(disk); -out: - return rc; + + return -ENOMEM; } /*