From patchwork Tue May 23 15:49:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9742983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6328F60380 for ; Tue, 23 May 2017 15:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5405F2853B for ; Tue, 23 May 2017 15:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4902C2881E; Tue, 23 May 2017 15:50:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E234E2881C for ; Tue, 23 May 2017 15:50:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761795AbdEWPuG (ORCPT ); Tue, 23 May 2017 11:50:06 -0400 Received: from mail-qt0-f193.google.com ([209.85.216.193]:35244 "EHLO mail-qt0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759683AbdEWPuF (ORCPT ); Tue, 23 May 2017 11:50:05 -0400 Received: by mail-qt0-f193.google.com with SMTP id r58so22730644qtb.2 for ; Tue, 23 May 2017 08:50:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BntXR5f4AN6WKUU/08mZhnSWQzu4FBS+BCbIrMwoW3c=; b=JR5JbLz0IzUwlvmtHOWBVmGCzmP3YG0uKkZekmAV8nEvWGZSTz6LRBgzW3iPriflCO vcj8OP5YOHkjL4nyZkYYinkz6asXC/zGGe2zka3QE/xQAEO/cBPV/zN+zYy7XyiV2k9H oIZtKOWRlr0xKX1aBKZNBHpvqsSZGtGqPFTbIkqEiIByh8GCGmJDLElig75xRfu2jEhn m8FUTMt13dFEOWLN1Ye9mM5aZEqhK4dcX/O4yLkPVEMdTFsz1QoS32WWB+vedPA1ictW WwlM1GbBKJxbHyhu+8x5bCUraeyUw5DQb+B9sAyWEbQuKgOAc27MVz8Hy0emGWc1jg0d SOhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BntXR5f4AN6WKUU/08mZhnSWQzu4FBS+BCbIrMwoW3c=; b=nMdfUJ4yj0i0Gyg6FV5WLpvM8+ybj5ZPYgb1Z4Ren3YOZ8ETBIk1MosdDwxbSZtnwY PQLIry6ZEybDsk2Y+j8fbW752tqukDykmEDYFzbtpJvvVmHM713CxTI5ZVkaA4TPoClu ZXD5RenGYZhNrG/gYHPd5MUDRuE0Gn3qBAJQPgJopZp+V9yPQP97zHHcpy820qvfMhh/ A1aa7/iInutRDx3Kyefh8689a+RdIM3fckh2wLj4u4A+7gwLO0l6xzWi3HSAS5Ad1Sgn eRgraqpqtPuuW6uPDWBgm92JRJf+mTntoOwwrQeFsbR3YFAo7M7moWgRfCp7zy/4Xrwg HhUg== X-Gm-Message-State: AODbwcCKSUpVlzdeJdfQ7/W/iuaUTgBR/G3c0gzbMqvGAhXpWVtJ/xEz DFlUlkjfsfa9Uw== X-Received: by 10.200.35.110 with SMTP id b43mr28321119qtb.24.1495554604703; Tue, 23 May 2017 08:50:04 -0700 (PDT) Received: from orange.brq.redhat.com. (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id t35sm680302qta.62.2017.05.23.08.50.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 May 2017 08:50:04 -0700 (PDT) From: Ilya Dryomov To: Josef Bacik Cc: nbd-general@lists.sourceforge.net, linux-block@vger.kernel.org, Jens Axboe Subject: [PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant Date: Tue, 23 May 2017 17:49:54 +0200 Message-Id: <1495554595-30945-1-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP There is nothing to clear -- nbd_device has just been allocated. Fold nbd_reset() into its other caller, nbd_config_put(). Signed-off-by: Ilya Dryomov Reviewed-by: Josef Bacik --- drivers/block/nbd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 9a7bb2c29447..e725d8d5ab0b 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -937,14 +937,6 @@ static int nbd_reconnect_socket(struct nbd_device *nbd, unsigned long arg) return -ENOSPC; } -/* Reset all properties of an NBD device */ -static void nbd_reset(struct nbd_device *nbd) -{ - nbd->config = NULL; - nbd->tag_set.timeout = 0; - queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue); -} - static void nbd_bdev_reset(struct block_device *bdev) { if (bdev->bd_openers > 1) @@ -1029,7 +1021,10 @@ static void nbd_config_put(struct nbd_device *nbd) } kfree(config->socks); } - nbd_reset(nbd); + nbd->config = NULL; + + nbd->tag_set.timeout = 0; + queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, nbd->disk->queue); mutex_unlock(&nbd->config_lock); nbd_put(nbd); @@ -1483,7 +1478,6 @@ static int nbd_dev_add(int index) disk->fops = &nbd_fops; disk->private_data = nbd; sprintf(disk->disk_name, "nbd%d", index); - nbd_reset(nbd); add_disk(disk); nbd_total_devices++; return index;