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.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,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 92218C2D0E4 for ; Thu, 19 Nov 2020 10:32:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E6134246F2 for ; Thu, 19 Nov 2020 10:32:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E6134246F2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9020C6B005C; Thu, 19 Nov 2020 05:32:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B28C6B005D; Thu, 19 Nov 2020 05:32:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7A1046B0068; Thu, 19 Nov 2020 05:32:56 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0216.hostedemail.com [216.40.44.216]) by kanga.kvack.org (Postfix) with ESMTP id 4DD936B005C for ; Thu, 19 Nov 2020 05:32:56 -0500 (EST) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id EA3D13644 for ; Thu, 19 Nov 2020 10:32:55 +0000 (UTC) X-FDA: 77500804710.07.cakes00_4a0e23427342 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id D0EDD1803F9C6 for ; Thu, 19 Nov 2020 10:32:55 +0000 (UTC) X-HE-Tag: cakes00_4a0e23427342 X-Filterd-Recvd-Size: 3421 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Nov 2020 10:32:55 +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 3937FACBA; Thu, 19 Nov 2020 10:32:54 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id D5CBE1E130B; Thu, 19 Nov 2020 11:32:53 +0100 (CET) Date: Thu, 19 Nov 2020 11:32:53 +0100 From: Jan Kara To: Christoph Hellwig Cc: Jens Axboe , Tejun Heo , Josef Bacik , Konrad Rzeszutek Wilk , Coly Li , Mike Snitzer , dm-devel@redhat.com, Richard Weinberger , Jan Kara , linux-block@vger.kernel.org, xen-devel@lists.xenproject.org, linux-bcache@vger.kernel.org, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 13/20] block: remove ->bd_contains Message-ID: <20201119103253.GV1981@quack2.suse.cz> References: <20201118084800.2339180-1-hch@lst.de> <20201118084800.2339180-14-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201118084800.2339180-14-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Wed 18-11-20 09:47:53, Christoph Hellwig wrote: > Now that each hd_struct has a reference to the corresponding > block_device, there is no need for the bd_contains pointer. Add > a bdev_whole() helper to look up the whole device block_device > struture instead. > > Signed-off-by: Christoph Hellwig Just two nits below. Otherwise feel free to add: Reviewed-by: Jan Kara > @@ -1521,7 +1510,7 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, void *holder, > if (bdev->bd_bdi == &noop_backing_dev_info) > bdev->bd_bdi = bdi_get(disk->queue->backing_dev_info); > } else { > - if (bdev->bd_contains == bdev) { > + if (!bdev->bd_partno) { This should be !bdev_is_partition(bdev) for consistency, right? > ret = 0; > if (bdev->bd_disk->fops->open) > ret = bdev->bd_disk->fops->open(bdev, mode); ... > diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h > index 0069bee992063e..453b940b87d8e9 100644 > --- a/include/linux/blk_types.h > +++ b/include/linux/blk_types.h > @@ -32,7 +32,6 @@ struct block_device { > #ifdef CONFIG_SYSFS > struct list_head bd_holder_disks; > #endif > - struct block_device * bd_contains; > u8 bd_partno; > struct hd_struct * bd_part; > /* number of times partitions within this device have been opened. */ > @@ -48,6 +47,9 @@ struct block_device { > struct mutex bd_fsfreeze_mutex; > } __randomize_layout; > > +#define bdev_whole(_bdev) \ > + ((_bdev)->bd_disk->part0.bdev) > + > #define bdev_kobj(_bdev) \ > (&part_to_dev((_bdev)->bd_part)->kobj) I'd somewhat prefer if these helpers could actually be inline functions and not macros. I guess they are macros because hd_struct isn't in blk_types.h. But if we moved helpers to blkdev.h, we'd have all definitions we need... Is that a problem for some users? Honza -- Jan Kara SUSE Labs, CR