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 C9026C4332F for ; Fri, 4 Nov 2022 03:37:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FA426B0071; Thu, 3 Nov 2022 23:37:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 482786B0073; Thu, 3 Nov 2022 23:37:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2FBDC6B0074; Thu, 3 Nov 2022 23:37:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 1E11F6B0071 for ; Thu, 3 Nov 2022 23:37:05 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id E694C1205DC for ; Fri, 4 Nov 2022 03:37:04 +0000 (UTC) X-FDA: 80094348768.05.53C2C21 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) by imf12.hostedemail.com (Postfix) with ESMTP id 7281C40002 for ; Fri, 4 Nov 2022 03:37:04 +0000 (UTC) Received: by mail-pg1-f180.google.com with SMTP id r18so3341107pgr.12 for ; Thu, 03 Nov 2022 20:37:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20210112.gappssmtp.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=kCztCif6DGnUVPea69d1j6HBte1tInJ//NGbT2adCtA=; b=uj2thbHtG/d+GBBCufhO7rN+QkuEm7zsR1utnZpf1jQ6jQI6apkQTpUS2wcEmA9aNC VnDMe2rmlwjjtPUJR6RVdf+UJIK/YCtwiDAFrNIV7Nt++fXhl9nREiFkHf0RyMEPfvfO onGWmNN1ovJwkvkYC6fzzHZz7zyvVev9H3OguSEusghpv0YPPtdfeKpV8TCgCnMYqtfc Ksic71C8032fBMagPD7RLDMZgSbzkcCWA6HBFsZEVIK8PskhHmcNukEVkFYsBkmvmeoC g/qCQdT1fcwEOyEG1ZYfH8GugnyK0CKLKk6hzKwIFkwwhNd+ojc6bS3gdGaV6YzySSoe prLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=kCztCif6DGnUVPea69d1j6HBte1tInJ//NGbT2adCtA=; b=QT4epJynJ73aUd7aadTfqm6nL0rn4q6mRYS3qMS+yaOQC7VLt+Vjt9M4PzyXqFbEjU aBo2fQOYnfR20ftSA4d/bOcnUvZZ3PApOeNqe++LOvgkkSE6f9GIPIzfWSHzoi6c4nKl BZ4fvKQC74nHxa7DQdudYedRjrbEUSInac3NE+ffOSgUsAZLPf+u04Gx+ARIKP9E+qL4 piAdedD1eMib3s0wnPTz0/0OiVrGPzqCkopoWQAF8LOaZZW2R06uor5Z44EivMCouE+D q1AP00EqRpRYSdNK2HAZqZiqhvAVz6xPrvD4bhfVZgzxFGwh3zxq0M63ZPbSDxOdqaOG z4sw== X-Gm-Message-State: ACrzQf0jvoZF4LcmsUYK2zH53m8nmY3mbAPyQZ1fOM9PjA+o9E0JUGlM 2Zbco1WMcrM3lP9ZUHQx0KjTMg== X-Google-Smtp-Source: AMsMyM7NwhgMGw/Ejg/10+QrYuOi1WfTIe60hww1ZNfzsfJwCZnIyT2jB8JwYZIzMahLdSnJ6wzgKQ== X-Received: by 2002:a05:6a00:2396:b0:56c:b770:eda6 with SMTP id f22-20020a056a00239600b0056cb770eda6mr33239633pfc.38.1667533023291; Thu, 03 Nov 2022 20:37:03 -0700 (PDT) Received: from dread.disaster.area (pa49-181-106-210.pa.nsw.optusnet.com.au. [49.181.106.210]) by smtp.gmail.com with ESMTPSA id x13-20020a170902a38d00b001830ed575c3sm1430190pla.117.2022.11.03.20.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Nov 2022 20:37:02 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.92.3) (envelope-from ) id 1oqnVr-00A1XB-Bm; Fri, 04 Nov 2022 14:36:59 +1100 Date: Fri, 4 Nov 2022 14:36:59 +1100 From: Dave Chinner To: "Darrick J. Wong" Cc: Vishal Moola , linux-fsdevel@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, cluster-devel@redhat.com, linux-nilfs@vger.kernel.org, linux-mm@kvack.org, Matthew Wilcox Subject: Re: [PATCH 04/23] page-writeback: Convert write_cache_pages() to use filemap_get_folios_tag() Message-ID: <20221104033659.GA2703033@dread.disaster.area> References: <20220901220138.182896-1-vishal.moola@gmail.com> <20220901220138.182896-5-vishal.moola@gmail.com> <20221018210152.GH2703033@dread.disaster.area> <20221104003235.GZ2703033@dread.disaster.area> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667533024; a=rsa-sha256; cv=none; b=gvmw6u6Z5whaDL4bhrU6Q9CqkyLZEhlwx0910tTG2OnADWbvQyMviU+MqzFVmAZayS5QFj HSWmYmHE0W7uvY77gMVqqDmgwbB+DdYkfBWw8mqfb+Xlgu9Km4NmybLYoWkxojEtz+PM5r vas2B4EbXVoD5lk8rmxgZrtDvXkh6uU= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=fromorbit-com.20210112.gappssmtp.com header.s=20210112 header.b=uj2thbHt; spf=none (imf12.hostedemail.com: domain of david@fromorbit.com has no SPF policy when checking 209.85.215.180) smtp.mailfrom=david@fromorbit.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667533024; 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=kCztCif6DGnUVPea69d1j6HBte1tInJ//NGbT2adCtA=; b=IqQ4GnQwk/iq1iShPhCkWaumRE59deFFqvGwh0EOQEtkAGtW3bodnyEsQrwA5wiKqxh2OE y6+pQkM5btjKl2R+vA08sLUaOyxcg6MBUr+/kJ6CCahEkwp/6YkKUabtWJbzrA5QYlV5Bd mszX6wXg38YdpYDoRBGAxzOmMRpWeT8= X-Stat-Signature: wtzuoxafqf8thtqgyhnem5n1f8uj98e7 X-Rspamd-Server: rspam09 X-Rspam-User: X-Rspamd-Queue-Id: 7281C40002 Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=fromorbit-com.20210112.gappssmtp.com header.s=20210112 header.b=uj2thbHt; spf=none (imf12.hostedemail.com: domain of david@fromorbit.com has no SPF policy when checking 209.85.215.180) smtp.mailfrom=david@fromorbit.com; dmarc=none X-HE-Tag: 1667533024-770938 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 Thu, Nov 03, 2022 at 07:45:01PM -0700, Darrick J. Wong wrote: > On Fri, Nov 04, 2022 at 11:32:35AM +1100, Dave Chinner wrote: > > On Thu, Nov 03, 2022 at 03:28:05PM -0700, Vishal Moola wrote: > > > On Wed, Oct 19, 2022 at 08:01:52AM +1100, Dave Chinner wrote: > > > > On Thu, Sep 01, 2022 at 03:01:19PM -0700, Vishal Moola (Oracle) wrote: > > > > > - BUG_ON(PageWriteback(page)); > > > > > - if (!clear_page_dirty_for_io(page)) > > > > > + BUG_ON(folio_test_writeback(folio)); > > > > > + if (!folio_clear_dirty_for_io(folio)) > > > > > goto continue_unlock; > > > > > > > > > > trace_wbc_writepage(wbc, inode_to_bdi(mapping->host)); > > > > > - error = (*writepage)(page, wbc, data); > > > > > + error = writepage(&folio->page, wbc, data); > > > > > > > > Yet, IIUC, this treats all folios as if they are single page folios. > > > > i.e. it passes the head page of a multi-page folio to a callback > > > > that will treat it as a single PAGE_SIZE page, because that's all > > > > the writepage callbacks are currently expected to be passed... > > > > > > > > So won't this break writeback of dirty multipage folios? > > > > > > Yes, it appears it would. But it wouldn't because its already 'broken'. > > > > It is? Then why isn't XFS broken on existing kernels? Oh, we don't > > know because it hasn't been tested? > > > > Seriously - if this really is broken, and this patchset further > > propagating the brokeness, then somebody needs to explain to me why > > this is not corrupting data in XFS. > > It looks like iomap_do_writepage finds the folio size correctly > > end_pos = folio_pos(folio) + folio_size(folio); > > and iomap_writpage_map will map out the correct number of blocks > > unsigned nblocks = i_blocks_per_folio(inode, folio); > > for (i = 0; i < nblocks && pos < end_pos; i++, pos += len) { > > right? Yup, that's how I read it, too. But my recent experience with folios involved being repeatedly burnt by edge case corruptions due to multipage folios showing up when and where I least expected them. Hence doing a 1:1 conversion of page based code to folio based code and just assuming large folios will work without any testing seems akin to playing russian roulette with loose cannons that have been doused with napalm and then set on fire by an air-dropped barrel bomb... Cheers, Dave. -- Dave Chinner david@fromorbit.com