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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 75F5FC2D0E4 for ; Fri, 20 Nov 2020 20:05:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CA72C2240B for ; Fri, 20 Nov 2020 20:05:52 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CA72C2240B 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 043096B0036; Fri, 20 Nov 2020 15:05:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 019656B005C; Fri, 20 Nov 2020 15:05:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E71676B005D; Fri, 20 Nov 2020 15:05:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id BB9656B0036 for ; Fri, 20 Nov 2020 15:05:51 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 56C518249980 for ; Fri, 20 Nov 2020 20:05:51 +0000 (UTC) X-FDA: 77505877302.20.dress55_0e017582734e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin20.hostedemail.com (Postfix) with ESMTP id 306E3180C07A3 for ; Fri, 20 Nov 2020 20:05:51 +0000 (UTC) X-HE-Tag: dress55_0e017582734e X-Filterd-Recvd-Size: 3119 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf32.hostedemail.com (Postfix) with ESMTP for ; Fri, 20 Nov 2020 20:05:50 +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 2C646AE1F; Fri, 20 Nov 2020 20:05:49 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id C910C1E1319; Fri, 20 Nov 2020 21:05:48 +0100 (CET) Date: Fri, 20 Nov 2020 21:05:48 +0100 From: Jan Kara To: Matthew Wilcox Cc: Christoph Hellwig , Jan Kara , 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 14/20] block: remove the nr_sects field in struct hd_struct Message-ID: <20201120200548.GA27360@quack2.suse.cz> References: <20201118084800.2339180-1-hch@lst.de> <20201118084800.2339180-15-hch@lst.de> <20201119120525.GW1981@quack2.suse.cz> <20201120090820.GD21715@lst.de> <20201120112121.GB15537@quack2.suse.cz> <20201120153253.GA18990@lst.de> <20201120155956.GB4327@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201120155956.GB4327@casper.infradead.org> 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 Fri 20-11-20 15:59:56, Matthew Wilcox wrote: > On Fri, Nov 20, 2020 at 04:32:53PM +0100, Christoph Hellwig wrote: > > On Fri, Nov 20, 2020 at 12:21:21PM +0100, Jan Kara wrote: > > > > > AFAICT bd_size_lock is pointless after these changes so we can just remove > > > > > it? > > > > > > > > I don't think it is, as reuqiring bd_mutex for size updates leads to > > > > rather awkward lock ordering problems. > > > > > > OK, let me ask differently: What is bd_size_lock protecting now? Ah, I see, > > > on 32-bit it is needed to prevent torn writes to i_size, right? > > > > Exactly. In theory we could skip it for 64-bit, but as updating the > > size isn't a fast path, and struct block_device isn't super size critical > > I'd rather keep the same code for 32 vs 64-bit builds. > > Is it better to switch to i_size_write() / i_size_read()? The code is already switched to it AFAICT (the lock is really only used in the two places that write i_size). But the problem is that in theory two i_size_write() calls can race in a way that the resulting stored i_size is a mix of two stored sizes. Now I have hard time imagining how this could happen for a block device and if two reconfigurations of a block device could race like that we'd have a large problems anyway... Honza -- Jan Kara SUSE Labs, CR