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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,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 517DDC4338F for ; Mon, 9 Aug 2021 14:51:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2BB0561019 for ; Mon, 9 Aug 2021 14:51:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231127AbhHIOv1 (ORCPT ); Mon, 9 Aug 2021 10:51:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229474AbhHIOv1 (ORCPT ); Mon, 9 Aug 2021 10:51:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBD96C0613D3; Mon, 9 Aug 2021 07:51:06 -0700 (PDT) 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=A5CJ5s/wZg25gVdQUYibxv9WUlHpW5z6QpBFDTGosjo=; b=NY/GCnmesmBhmwq7mNNxRMY7YO m6tGGitjoDJoZ8PlCMdSNDnE6MQKH2Pa80y0gmyV0YZNgc6re0kypx8tx+pgkNc94OU2jB2LYb1Uv Ttb5mNFnwA4LbLkCPH/zuDD8iKUwEVlm7zFXQxrrJGqxiN4VmrXUkMswbSdURfLptQ3XqVnh6ClDI sGt4GkuJeGXhDR761nQxQsZ8R4Zjv11X5dNq0sz0XqIjVzyrZPZvzRGP4NRGiNBVPixepaaxv7iz1 cCIhKnG+X9TqoiyMT2sc/C1Drdqh9tbSzJhkxs0YsPGrUaj63jO2PDFn7v9HC3mCRUIf7dhGpvjvu 8T7UhDFw==; Received: from hch by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mD6aG-00B5e5-9L; Mon, 09 Aug 2021 14:49:32 +0000 Date: Mon, 9 Aug 2021 15:48:56 +0100 From: Christoph Hellwig To: Matthew Wilcox Cc: linux-fsdevel@vger.kernel.org, Zhengyuan Liu , yukuai3@huawei.com, Christoph Hellwig , Dave Chinner , David Howells , linux-xfs@vger.kernel.org Subject: Re: Dirty bits and sync writes Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue, Aug 03, 2021 at 04:28:14PM +0100, Matthew Wilcox wrote: > Solution 1: Add an array of dirty bits to the iomap_page > data structure. This patch already exists; would need > to be adjusted slightly to apply to the current tree. > https://lore.kernel.org/linux-xfs/7fb4bb5a-adc7-5914-3aae-179dd8f3adb1@huawei.com/ > Solution 2a: Replace the array of uptodate bits with an array of > dirty bits. It is not often useful to know which parts of the page are > uptodate; usually the entire page is uptodate. We can actually use the > dirty bits for the same purpose as uptodate bits; if a block is dirty, it > is definitely uptodate. If a block is !dirty, and the page is !uptodate, > the block may or may not be uptodate, but it can be safely re-read from > storage without losing any data. 1 or 2a seems like something we should do once we have lage folio support. > Solution 2b: Lose the concept of partially uptodate pages. If we're > going to write to a partial page, just bring the entire page uptodate > first, then write to it. It's not clear to me that partially-uptodate > pages are really useful. I don't know of any network filesystems that > support partially-uptodate pages, for example. It seems to have been > something we did for buffer_head based filesystems "because we could" > rather than finding a workload that actually cares. The uptodate bit is important for the use case of a smaller than page size buffered write into a page that hasn't been read in already, which is fairly common for things like log writes. So I'd hate to lose this optimization. > (it occurs to me that solution 3 actually allows us to do IOs at storage > block size instead of filesystem block size, potentially reducing write > amplification even more, although we will need to be a bit careful if > we're doing a CoW.) number 3 might be nice optimization. The even better version would be a disk format change to just log those updates in the log and otherwise use the normal dirty mechanism. I once had a crude prototype for that.