From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6880EC5519F for ; Fri, 20 Nov 2020 07:51:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0DF9F2236F for ; Fri, 20 Nov 2020 07:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726739AbgKTHud (ORCPT ); Fri, 20 Nov 2020 02:50:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:40876 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726618AbgKTHud (ORCPT ); Fri, 20 Nov 2020 02:50:33 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 55C9CAC23; Fri, 20 Nov 2020 07:50:31 +0000 (UTC) Subject: Re: [PATCH 66/78] block: keep a block_device reference for each hd_struct To: Christoph Hellwig , Jens Axboe Cc: Justin Sanders , Josef Bacik , Ilya Dryomov , Jack Wang , "Michael S. Tsirkin" , Jason Wang , Paolo Bonzini , Stefan Hajnoczi , Konrad Rzeszutek Wilk , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Minchan Kim , Mike Snitzer , Song Liu , "Martin K. Petersen" , dm-devel@redhat.com, linux-block@vger.kernel.org, drbd-dev@lists.linbit.com, nbd@other.debian.org, ceph-devel@vger.kernel.org, xen-devel@lists.xenproject.org, linux-raid@vger.kernel.org, linux-nvme@lists.infradead.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org References: <20201116145809.410558-1-hch@lst.de> <20201116145809.410558-67-hch@lst.de> From: Hannes Reinecke Message-ID: <23914ef5-5245-b468-4168-bc1584e979d2@suse.de> Date: Fri, 20 Nov 2020 08:50:28 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <20201116145809.410558-67-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org On 11/16/20 3:57 PM, Christoph Hellwig wrote: > To simplify block device lookup and a few other upcomdin areas, make sure > that we always have a struct block_device available for each disk and > each partition. The only downside of this is that each device and > partition uses a little more memories. The upside will be that a lot of > code can be simplified. > > With that all we need to look up the block device is to lookup the inode > and do a few sanity checks on the gendisk, instead of the separate lookup > for the gendisk. > > As part of the change switch bdget() to only find existing block devices, > given that we know that the block_device structure must be allocated at > probe / partition scan time. > > blk-cgroup needed a bit of a special treatment as the only place that > wanted to lookup a gendisk outside of the normal blkdev_get path. It is > switched to lookup using the block device hash now that this is the > primary lookup path. > > Signed-off-by: Christoph Hellwig > --- > block/blk-cgroup.c | 42 ++++----- > block/blk-iocost.c | 36 +++---- > block/blk.h | 1 - > block/genhd.c | 188 +++---------------------------------- > block/partitions/core.c | 28 +++--- > fs/block_dev.c | 133 +++++++++++++++----------- > include/linux/blk-cgroup.h | 4 +- > include/linux/blkdev.h | 3 + > include/linux/genhd.h | 4 +- > 9 files changed, 153 insertions(+), 286 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Felix Imendörffer