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=ham 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 61AB4C5519F for ; Mon, 30 Nov 2020 07:36:24 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B3C1320643 for ; Mon, 30 Nov 2020 07:36:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B3C1320643 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2B15A6B0036; Mon, 30 Nov 2020 02:36:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 238B66B005D; Mon, 30 Nov 2020 02:36:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1019A6B0068; Mon, 30 Nov 2020 02:36:23 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0117.hostedemail.com [216.40.44.117]) by kanga.kvack.org (Postfix) with ESMTP id EB75E6B0036 for ; Mon, 30 Nov 2020 02:36:22 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id B9AD83636 for ; Mon, 30 Nov 2020 07:36:22 +0000 (UTC) X-FDA: 77540276604.30.front81_4c0ab45273a0 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 92016180B3AA7 for ; Mon, 30 Nov 2020 07:36:22 +0000 (UTC) X-HE-Tag: front81_4c0ab45273a0 X-Filterd-Recvd-Size: 3544 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Mon, 30 Nov 2020 07:36:22 +0000 (UTC) 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 09E40AC6A; Mon, 30 Nov 2020 07:36:21 +0000 (UTC) Subject: Re: [PATCH 25/45] block: simplify bdev/disk lookup in blkdev_get To: Christoph Hellwig , Jens Axboe Cc: Tejun Heo , Josef Bacik , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Jan Kara , Johannes Thumshirn , dm-devel@redhat.com, Jan Kara , linux-block@vger.kernel.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org References: <20201128161510.347752-1-hch@lst.de> <20201128161510.347752-26-hch@lst.de> From: Hannes Reinecke Message-ID: Date: Mon, 30 Nov 2020 08:36:19 +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: <20201128161510.347752-26-hch@lst.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 11/28/20 5:14 PM, Christoph Hellwig wrote: > To simplify block device lookup and a few other upcoming areas, make su= re > that we always have a struct block_device available for each disk and > each partition, and only find existing block devices in bdget. The onl= y > downside of this is that each device and partition uses a little more > memory. The upside will be that a lot of code can be simplified. >=20 > With that all we need to look up the block device is to lookup the inod= e > and do a few sanity checks on the gendisk, instead of the separate look= up > for the gendisk. For blk-cgroup which wants to access a gendisk withou= t > opening it, a new blkdev_{get,put}_no_open low-level interface is added > to replace the previous get_gendisk use. >=20 > Note that the change to look up block device directly instead of the tw= o > step lookup using struct gendisk causes a subtile change in behavior: > accessing a non-existing partition on an existing block device can now > cause a call to request_module. That call is harmless, and in practice > no recent system will access these nodes as they aren't created by udev > and static /dev/ setups are unusual. >=20 > Signed-off-by: Christoph Hellwig > --- > block/blk-cgroup.c | 42 ++++---- > block/blk-iocost.c | 36 +++---- > block/blk.h | 2 +- > block/genhd.c | 210 +++++-------------------------------= - > block/partitions/core.c | 29 ++--- > fs/block_dev.c | 177 +++++++++++++++++-------------- > include/linux/blk-cgroup.h | 4 +- > include/linux/blkdev.h | 6 ++ > include/linux/genhd.h | 7 +- > 9 files changed, 194 insertions(+), 319 deletions(-) >=20 Reviewed-by: Hannes Reinecke Cheers, Hannes --=20 Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg HRB 36809 (AG N=C3=BCrnberg), Gesch=C3=A4ftsf=C3=BChrer: Felix Imend=C3=B6= rffer