From patchwork Thu Mar 5 11:55:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boaz Harrosh X-Patchwork-Id: 5945051 Return-Path: X-Original-To: patchwork-linux-nvdimm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9B7339F318 for ; Thu, 5 Mar 2015 11:56:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BB4CB20386 for ; Thu, 5 Mar 2015 11:55:56 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E347320383 for ; Thu, 5 Mar 2015 11:55:55 +0000 (UTC) Received: from ml01.vlan14.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D97C48118D; Thu, 5 Mar 2015 03:55:55 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 719578118D for ; Thu, 5 Mar 2015 03:55:54 -0800 (PST) Received: by wiwl15 with SMTP id l15so2426095wiw.4 for ; Thu, 05 Mar 2015 03:55:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=wYUWLeSRNeocJpVsndzfLPC0FGDddEZqRyjW3ksWXnc=; b=Rh/WphSJRrUY0Ei913uc8KRO/D2KsIRdscdX7wdCIWCf+e0CivyagC0l5LNNbp04JL BzIHUJK60tv5/fFP6b39D9hqdaes8bA52+fzsqu1YfT31ZqQagN/1cRVzP3ykosHCtwt ZLWfmyFaZIXr8tH8ZmEcqzAlhEU5RKkiw7rnjB16ifEvn6WODoSc5djyvHj0HVI19WLv CPx54G5eTOzH69ok9mSjgsMpquwhW7I5UXLpnN9di9g9qeJLoCVPzqgAs2JnCZoATRsp iz6lDBzOI4ngAYFEh+yiOAXlmDHowFmJpmJdv2N4poKlGt28P52UhepZ2u6BjbR48cgf taVg== X-Gm-Message-State: ALoCoQlWT3/cUvZreGtyr0X2s550gXaJZcmTJVbvb64M0owFUCLGB8MXlYHJ17cKov0c0Ykensrj X-Received: by 10.180.77.19 with SMTP id o19mr1098392wiw.90.1425556552399; Thu, 05 Mar 2015 03:55:52 -0800 (PST) Received: from [10.0.0.5] ([207.232.55.62]) by mx.google.com with ESMTPSA id n3sm10178972wja.36.2015.03.05.03.55.50 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Mar 2015 03:55:51 -0800 (PST) Message-ID: <54F84445.9050208@plexistor.com> Date: Thu, 05 Mar 2015 13:55:49 +0200 From: Boaz Harrosh User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Ingo Molnar , x86@kernel.org, linux-kernel , "Roger C. Pao" , Dan Williams , Thomas Gleixner , linux-nvdimm , "H. Peter Anvin" , Matthew Wilcox , Andy Lutomirski , Christoph Hellwig References: <54F82CE0.4040502@plexistor.com> <54F830D4.7030205@plexistor.com> In-Reply-To: <54F830D4.7030205@plexistor.com> Subject: [Linux-nvdimm] [PATCH 2/8] pmem: KISS, remove register_blkdev X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Though this looks revolutionary, it actually does nothing but removes dead code. Since the move of pmem to the dynamic BLOCK_EXT_MAJOR range, by Ross, pmem_major returned from register_blkdev is not used. If inspecting the code at add_disk() we can see that whatever number we will put at disk->major = ... disk->first_minor = ... will be immediately overwritten with the BLOCK_EXT_MAJOR and a dynamically allocated minor. Regardless of the registration and/or what ever we put at disk->major. I have tested all the tests that I know how to perform on the devices, fdisk, partitions, multiple pmemX devices, mknode, lsblk, blkid, and it all behaves exactly as before this patch. I have also done: find /sys/ -name "*pmem*" find /proc/ -name "*pmem*" find /dev/ -name "*pmem*" And get the same output as before this patch. The only thing missing is an entry in /proc/devices of the form: "250 pmem" (250 or what ever is free at the moment) But this is good because if one tries to look for 250 devices after loading pmem he will fail because pmem is always registered as 259 (blkext) now. If anyone knows of what would work differently after this patch please do tell. But it looks like the calls to register_blkdev is just dead code for us right now Thanks Signed-off-by: Boaz Harrosh --- drivers/block/pmem.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/block/pmem.c b/drivers/block/pmem.c index 02cd118..bba53af 100644 --- a/drivers/block/pmem.c +++ b/drivers/block/pmem.c @@ -113,7 +113,6 @@ MODULE_PARM_DESC(map, "mapS=nn[KMG]$ss[KMG] or mapS=nn[KMG]@ss[KMG], nn=size, ss=offset."); static LIST_HEAD(pmem_devices); -static int pmem_major; /* pmem->phys_addr and pmem->size need to be set. * Will then set virt_addr if successful. @@ -204,8 +203,6 @@ static struct pmem_device *pmem_alloc(phys_addr_t phys_addr, size_t disk_size, goto out_free_queue; } - disk->major = pmem_major; - disk->first_minor = 0; disk->fops = &pmem_fops; disk->private_data = pmem; disk->queue = pmem->pmem_queue; @@ -268,12 +265,6 @@ static int __init pmem_init(void) return -EINVAL; } - result = register_blkdev(0, "pmem"); - if (unlikely(result < 0)) - return -EIO; - - pmem_major = result; - map_dup = pmem_map = kstrdup(map, GFP_KERNEL); if (unlikely(!pmem_map)) { pr_debug("pmem_init strdup(%s) failed\n", map); @@ -312,7 +303,6 @@ out_free: pmem_free(pmem); } kfree(map_dup); - unregister_blkdev(pmem_major, "pmem"); return result; } @@ -324,7 +314,6 @@ static void __exit pmem_exit(void) list_for_each_entry_safe(pmem, next, &pmem_devices, pmem_list) pmem_del_one(pmem); - unregister_blkdev(pmem_major, "pmem"); pr_info("pmem: module unloaded\n"); }