Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1206473pxb; Wed, 3 Nov 2021 20:46:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8OzoMCx3fDgGZL9A9wFcrz2H0cPDIplI8onAzoi+zHFWou3VT0jYD28LHFqliVs4eatxV X-Received: by 2002:a05:6e02:b42:: with SMTP id f2mr15319121ilu.93.1635997583533; Wed, 03 Nov 2021 20:46:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635997583; cv=none; d=google.com; s=arc-20160816; b=mNu6Tuf1JVkF46Ux25efGkgVeeYTXgFoVAv4Uaft79jkk+6+3infqsjBlUE2tJwrR2 mpEghTDT3Gmbx8cl1SrxaRs0yRWp/hoSu9qO+CMbMLZ4Edsu2RllnL5zpWxDz9Zl3vxD mdRLgqHHvaLs6eniZ3aCWsb43sZaCfaXvAwVrwuc09imaU77zXaALSmhjy87fuQjGn+R FKW96r4fwJ9MlwF+Pjr8L8Xwpug1ZzGyp8Oy8MfrUfN9C8GF0bFmQCR4aOy/s57wh/LF m0zVRG33j4OqqnLnNoCGhIrJ1197/zuKJ7JW6423i+ffY/2dWjqnZIpo4sz19fVGBrFr cdDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cnhGo81+/Ft3W318LxOJ86hyjf+30Zc+kGoqFQuytcs=; b=naNhNPu4d2DDX9f/3f0bYZvK/rw+XkjGl+EWi8K/OYGf74SHl9/qdqy19BN5yv15MZ Kd3e1GdMOxUTzqUxwz6Rz+mRybYTcua/TRciJLjzVv4bcQPIn1s0ExC95idv0q79f4lY mVvbe4Z6P+l9xvBM8y4lIjMh3NbFo+2+FPmZ7LTpT9OrtDM2rVuNa4+AOmsUW4Qt6nn2 g6AdSg356Xh7SeEzCSjOZTSywj42BpYoGBTpSwm5iwWbWeagZ9WAqHoyc37Y1uCLXM/G 2tQlk8P2BZhg1nkZdhfqsxpeRR8aYaNQJOopMXovVedLgc6r3K3p6PrmBJgbQG7OBCtk zbjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Vx/zAxB+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si5556758ioi.4.2021.11.03.20.45.49; Wed, 03 Nov 2021 20:46:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="Vx/zAxB+"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230108AbhKDDrE (ORCPT + 99 others); Wed, 3 Nov 2021 23:47:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229913AbhKDDrE (ORCPT ); Wed, 3 Nov 2021 23:47:04 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 879ABC061714; Wed, 3 Nov 2021 20:44:26 -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=cnhGo81+/Ft3W318LxOJ86hyjf+30Zc+kGoqFQuytcs=; b=Vx/zAxB+JeDPoimpTG7jtXsasE HC05BdpaUL3S+bzRlf9/foDJ4xpkfkF8aaN1uji8zCwY5rr2l6KnuawISqxz6I1X8bwq1KtN3QbN8 tM7v3iSm0+qzSpMkm8A3/S83siOGhCJbLTdWniVREHn2Fk0FBzntbqyY8zeEN2Ew/+24WDKK5DuCh OSmXYGrJ40Wwbdb5kOq/qIgHR0UE9UOtFzFZPbfd4Le0RGGmtyXzr12DPyitNWZRBo9e/TTcSGX+y TiCNsbmqZwvXWdnjVE9iAt1WdHebh7wXT72p986IUJgTwUw1GPemdGfBpLILYcYFEvd4G5WTudUBG SCgfrLjQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1miTeA-005duZ-0r; Thu, 04 Nov 2021 03:43:05 +0000 Date: Thu, 4 Nov 2021 03:42:37 +0000 From: Matthew Wilcox To: "Darrick J. Wong" Cc: Christoph Hellwig , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe Subject: Re: [PATCH 18/21] iomap: Convert iomap_add_to_ioend to take a folio Message-ID: References: <20211101203929.954622-1-willy@infradead.org> <20211101203929.954622-19-willy@infradead.org> <20211103160057.GH24333@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211103160057.GH24333@magnolia> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 03, 2021 at 09:00:57AM -0700, Darrick J. Wong wrote: > > - wpc->ops->discard_folio(page_folio(page), file_offset); > > + wpc->ops->discard_folio(folio, pos); > > /me wonders why this wouldn't have been done in whichever patch added > folio as a local variable, but fmeh, the end result is the same: Found it and fixed it. > > @@ -1474,17 +1474,15 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data) > > * memory is zeroed when mapped, and writes to that region are > > * not written out to the file." > > */ > > - zero_user_segment(page, poff, PAGE_SIZE); > > - > > - /* Adjust the end_offset to the end of file */ > > + zero_user_segment(&folio->page, poff, folio_size(folio)); > > Question: is &folio->page != page here? I guess the idea is that we > have a (potentially multi-page) folio straddling i_size, and we need to > zero everything in the whole folio after i_size. But then why not pass > the whole folio? Ugh, thanks. You made me realise that zero_user_segments() is still conditional on CONFIG_TRANSPARENT_HUGEPAGE. It's a relic of when I was going to do all of this with THP; before I switched to the folio mental model. So now we're going to get folio_zero_segments(), folio_zero_segment() and folio_zero_range().