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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32E6AC25B48 for ; Tue, 24 Oct 2023 11:43:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B80246B0246; Tue, 24 Oct 2023 07:43:11 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B30246B0248; Tue, 24 Oct 2023 07:43:11 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1FA86B0249; Tue, 24 Oct 2023 07:43:11 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 923B66B0246 for ; Tue, 24 Oct 2023 07:43:11 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 68C8A1CBBC4 for ; Tue, 24 Oct 2023 11:43:11 +0000 (UTC) X-FDA: 81380168982.28.7261589 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf17.hostedemail.com (Postfix) with ESMTP id D494540008 for ; Tue, 24 Oct 2023 11:43:08 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=UgQerN9X; dmarc=none; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1698147789; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=z5InAU3dhYmLQJgjZgQwPjcxPbv7IHwMP+7wG4gigZ0=; b=Yjnje0SwLAXLMLy1aNgIbqo74bJ7tejhbhM3G5PSYT/IAgBlcqFUmjYSF07YmkbWX9bKv7 U7ZMwDSy6rmgCScHVLDV+bFVzUzpDdnyQ2G7Ka0jJ93Z9I9CKGhDSOzy4xInertaSZ8IEb U1ezpuHwOWnyd+LLCLoUiG85HY1FtJA= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=UgQerN9X; dmarc=none; spf=none (imf17.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1698147789; a=rsa-sha256; cv=none; b=eZ38AbuJQaMhF/WrKrbWP6AYTG30Cn5PY7nvBwD9CVI2mmDBeD7kaMmvcXRlTW4W8ceqyj N9hxKCAFctyTsa6oHZA7G5aSK0Ng9u2W8Wh0FTxJ5kaMxbZWF9z4or/1J7p03kc/GYbfGt twCL4H2Tvj50Y7mPOIRnXOiIVAJypX8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=z5InAU3dhYmLQJgjZgQwPjcxPbv7IHwMP+7wG4gigZ0=; b=UgQerN9XarNuuQe0jfv3B7kfni wI9Sgck27dnIA2Rg6K3xZYaN+65+8jLyJHMgBLDO6MVVDg7G+RlyMBfa3qMpJ3qsG3M55636UjZEV SRIPjMAoDFqnUMP67j/Se4Y2bg/jneFgeLDLUH6LtfYPfpqVRQJxys0ME8tQKT57mmicl3ZTxdVZP nT5VUk0w+lAO4wQptKQ+l1WMx19DFYdVOT5Rtp/mFME0eq4C3/0jOpYjBh36bLV/idaREcAslZGGH WrHR98V8UbzCcvRYUK6/ywpAqrklMz0TUTnGSX2whIMdCRgBN8KXm+6KWFTUqK0tHi45D+k7qbpF5 jE8u81Bg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qvFoN-002Ga9-W3; Tue, 24 Oct 2023 11:43:04 +0000 Date: Tue, 24 Oct 2023 12:43:03 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: Jens Axboe , Ilya Dryomov , Andrew Morton , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/3] filemap: add a per-mapping stable writes flag Message-ID: References: <20231024064416.897956-1-hch@lst.de> <20231024064416.897956-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024064416.897956-2-hch@lst.de> X-Rspamd-Queue-Id: D494540008 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ap17ao7uct91n5mtemefqbse8z7ryurf X-HE-Tag: 1698147788-625905 X-HE-Meta: U2FsdGVkX18/6UiODDMSOk9RQ88iIE1xcnrX4N8HC9Qcg6FbKrHTKvErTuQz1pXwkuOK9VU0MVF30ZsEJux2vPo6X2S0BqUlyhotHIaFouZ62OLivF1PDgZbqQM/AskbjbkToKsKW9OlZO7ZuOwlkIFZsKVByq+oJjGKElcKcPYySEto47OBJDdE3TQ9Xp+OJ5bNk2J5kNUBF2L0mcPloWgHjEQjdLxJNDJg0MrHZ9CrZRLUzFHSG3N7UtiJYvsZLjn6ZC8eDqL3x/xJV6qUVBVsfWxZMRqhbzHlY9AU3tu47oCKy88s8yuWc5wFbRU6oJUREdn4iFjhuJI0ygqmtm9SEaP400VKqC+9MEXuhhmLXbYCfiQM6Re1MpFPrh4b4a98k5OrOm9nrUlhgj1fr69/vlnF9P+v2VaRqOOu4IxlBQ0IdP/GKb+Y3ylWxSkhGPbu1dHmlS/K+ycajnFaQy4J7ISXOpiP7XmofuEnmtHv5hLZAI4l71YQn1FJ89y63xg3u0A9n4EWW/ZurC7U7LXaWZYw8ook9lxBcAKV9+A7igK8rOrSp1DWAhE+GWGoMBkXMbVYZkkig62zBWkTi83tKt4pTz3D/r7PQv2JfLE1BsJ3LL/TU7r2IlXVrZqMV4HFtbETpwMEes0+SGiFKMnq2raqJlCP/hV1QnyZ5o8+CyPnl3iSy1ErptfnC9yKwAJyo4PsOd9ZebjOWPekPVZzbYvjL+8tNDG2fCMN1eTPvquF5OmDk+sQdEKGSnTYo6ISqgT0wLOu/zVroZVHn4spCB4VCJFrpkeMwxySHDmCFeVTOp0e95JuqUhcz4YP5FfyGlga1bX6V/OFyz9D6u8CfDqmfZh360XFMTlCmB41W7x9Uus+N6VNSGfvihUN/Nv0ao29ln+sd3Ujf/2hYUKzfNYzqPPj9ly0BQYLNZySTT/6AFPEOm9RK4I5rjK+JkbxYmFjz69GSUOXJpV VlPp6WKg 1l3QmLHHCYY0EmhiCsKc9+yhO0HmIwAIAg7nAZuZzgrh7fhDW9C8MU1ttuHw9sKR39/Ly0mbsFbNrRjF3MRxDsgrAnCt39B1IqSJ7x4gfrozDrlyL8iIdafJYOnR+Eo9EcocfHPNBAt08fZqE0chBmJL7PsCoYchR79dUotsSZYF+GH21E5jc78vfHYXgUS2Oqp9n 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: List-Subscribe: List-Unsubscribe: On Tue, Oct 24, 2023 at 08:44:14AM +0200, Christoph Hellwig wrote: > folio_wait_stable waits for writeback to finish before modifying the > contents of a folio again, e.g. to support check summing of the data > in the block integrity code. > > Currently this behavior is controlled by the SB_I_STABLE_WRITES flag > on the super_block, which means it is uniform for the entire file system. > This is wrong for the block device pseudofs which is shared by all > block devices, or file systems that can use multiple devices like XFS > witht the RT subvolume or btrfs (although btrfs currently reimplements > folio_wait_stable anyway). > > Add a per-address_space AS_STABLE_WRITES flag to control the behavior > in a more fine grained way. The existing SB_I_STABLE_WRITES is kept > to initialize AS_STABLE_WRITES to the existing default which covers > most cases. > > Signed-off-by: Christoph Hellwig Reviewed-by: Matthew Wilcox (Oracle) > +++ b/mm/page-writeback.c > @@ -3110,7 +3110,7 @@ EXPORT_SYMBOL_GPL(folio_wait_writeback_killable); > */ > void folio_wait_stable(struct folio *folio) > { > - if (folio_inode(folio)->i_sb->s_iflags & SB_I_STABLE_WRITES) > + if (mapping_stable_writes(folio_mapping(folio))) > folio_wait_writeback(folio); What I really like about this is that we've gone from folio->mapping->host->i_sb->s_iflags to folio->mapping->flags which saves us two pointer dereferences. Sure, probably cached, but maybe not, and cache misses are expensive.