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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 DCB5CC2D0E4 for ; Tue, 24 Nov 2020 21:19:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2E7D1206E0 for ; Tue, 24 Nov 2020 21:19:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="OzhyL5qO" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2E7D1206E0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8608D6B006E; Tue, 24 Nov 2020 16:19:15 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E9686B0070; Tue, 24 Nov 2020 16:19:15 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D9A76B0071; Tue, 24 Nov 2020 16:19:15 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id 553036B006E for ; Tue, 24 Nov 2020 16:19:15 -0500 (EST) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 177AD8249980 for ; Tue, 24 Nov 2020 21:19:15 +0000 (UTC) X-FDA: 77520577470.26.women27_5908d7a27371 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin26.hostedemail.com (Postfix) with ESMTP id E3B501804A300 for ; Tue, 24 Nov 2020 21:19:14 +0000 (UTC) X-HE-Tag: women27_5908d7a27371 X-Filterd-Recvd-Size: 5130 Received: from mail-qv1-f66.google.com (mail-qv1-f66.google.com [209.85.219.66]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Tue, 24 Nov 2020 21:19:14 +0000 (UTC) Received: by mail-qv1-f66.google.com with SMTP id ec16so11399708qvb.0 for ; Tue, 24 Nov 2020 13:19:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=sg9SO3UStMfqHkCvNI1YBGGkjTmKJ7UaheqYby9uxnM=; b=OzhyL5qOUmNMCmaqmA0AJ7YTZnOa5s8lOvdGSd5gsRFwIjVjcK9RMkEdmOZVvPKHkC HEfwzTPFGhRpcwv4Zdi1eKZAQCSJDqL9242nm6t+004qxnjr2Wo1RG+dvaQzjYpDTlFJ y4MEeMckfEdVhdL9TeWxoL3uJseLhfNpPNLJKI+4lWddjQrQSYtmPS6DbLtZKSCyuI0M VPOnBALIPZDz9HaljCXz/QtzQMoFkORQ/oSOcQG0yJ5cuTGS83XWqbo7FaIck74bBkz3 zSrrMusanZp5T2dH6BfcuYD799YU+BVDp+VbnKu/pAzjL4fvbG44Apq0OxYfntbUtAy3 IgsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=sg9SO3UStMfqHkCvNI1YBGGkjTmKJ7UaheqYby9uxnM=; b=Z2N13HHMKZfZlwKchnTNJI3sRxpqRksRvwWcsZUBdmBV3EjYBF8ObfLwFyP75j2P+t khnTKh9Dg/WyB4d+zWixmvtV5tbG/a6G7gzmerYvGQXtyr3/4TRlcUbIk5f8b5V4ZJw5 F/G8ndLpRaNol/Ncjgd2eVQX6K2Q6y+YC2HNq7DK5+WHmaGYSSdQ85Wb2rbWHn2VXIsw D3Z3U/x5W/CGze6kOSpMeIwaq4alif+bXgawG7+4C8J4SHDrxIoWxXPRjNbKNrzdYkOo eNwFpzbb8tR08tKZrC5mjVAMEBLGR8MDASn+Ol8kkRa0adX/xqMpitBotPXmRV9ETGlu I1ow== X-Gm-Message-State: AOAM5309giiWtRzzNcbDFt1EQapBussiL995SehXra1ZEZjc7azJsiP6 pJ6J+qMFMcFGqH+O+h+v1tY= X-Google-Smtp-Source: ABdhPJymsM7t3QC8HGlAx0p+5Wt4X/uLuUZsX3zmVjKyK1/8swtwKOE7/+uzSFJWv6qwdRjGjoCR5w== X-Received: by 2002:a0c:fa08:: with SMTP id q8mr548456qvn.25.1606252753574; Tue, 24 Nov 2020 13:19:13 -0800 (PST) Received: from localhost (dhcp-6c-ae-f6-dc-d8-61.cpe.echoes.net. [72.28.8.195]) by smtp.gmail.com with ESMTPSA id c27sm387614qkk.57.2020.11.24.13.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Nov 2020 13:19:12 -0800 (PST) Date: Tue, 24 Nov 2020 16:18:49 -0500 From: Tejun Heo To: Christoph Hellwig Cc: Jens Axboe , Josef Bacik , Konrad Rzeszutek Wilk , Coly Li , Mike Snitzer , Greg Kroah-Hartman , Jan Kara , Johannes Thumshirn , 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 25/45] block: reference struct block_device from struct hd_struct Message-ID: References: <20201124132751.3747337-1-hch@lst.de> <20201124132751.3747337-26-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201124132751.3747337-26-hch@lst.de> 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: Hello, Please see lkml.kernel.org/r/X708BTJ5njtbC2z1@mtj.duckdns.org for a few nits on the previous version. On Tue, Nov 24, 2020 at 02:27:31PM +0100, Christoph Hellwig wrote: > To simplify block device lookup and a few other upcoming 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 memory. 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. These checks are in a new RCU critical section and > the disk is now freed using kfree_rcu(). I might be confused but am wondering whether RCU is needed. It's currently used to ensure that gendisk is accessible in the blkdev_get path but wouldn't it be possible to simply pin gendisk from block_devices? The gendisk and hd_structs hold the base refs of the block_devices and in turn the block_devices pin the gendisk. When the gendisk gets deleted, it puts the base refs of the block devices but stays around while the block devices are being accessed. Also, would it make sense to separate out lookup_sem removal? I *think* it's there to ensure that the same bdev doesn't get associated with old and new gendisks at the same time but can't wrap my head around how it works exactly. I can see that this may not be needed once the lifetimes of gendisk and block_devices are tied together but that may warrant a bit more explanation. Thanks. -- tejun