Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3452241pxb; Mon, 1 Nov 2021 14:07:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxql5I497dbYZwNhDuC3q1Ryx4MXzkciXvgkbg49oopjLTF4jgyv9jnQIAVwRLvz5/faC9X X-Received: by 2002:a05:6e02:178d:: with SMTP id y13mr21871787ilu.0.1635800854197; Mon, 01 Nov 2021 14:07:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635800854; cv=none; d=google.com; s=arc-20160816; b=GLSHSvZ9Nl2tRsROj4wZMvJ/8ua1WGd3q6PTijarSEk1XBs/qSM+W6Q8PL7VUOphwx xqO4YUHE5YOKlOCney46llUVJWZYxQpBOGCfa0fe8zKfCypvazJYbDfDyQj9EU+6KUpD /DTjWGM6Xv9CfSkXHoPu0lSnDoHizvPPCL/4TTDlXxqP8pnw6qWyK/MmakKK2AjDgjYo t/5WT29xM8FnFo4TSo1YKquKZ74A9r54iY3KdUIjZK0rSCjS8PuV24ngywJwmBPfIpcp 7pqupuXl2d5/LU1Owe9TpjYUBB4h7fvX+566mWgQBqcKikV1TnP095KTVqswExSyGj/l r5zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=GjVs3sP8YcLBM022Z/iDJU4ANcoNi+QMtRdM+DVSOYw=; b=bkROh8zDRmAwYrggTBkfADIew7f0/wrjRrO4/AKd4xcgV3BZttffnp1FCvVsWFLo9p TVgZ7y5pftl1t5KQpbhbJyjzga9EKSy7gzohQNLb5o7kw806GayB1eFbXuXtFrexqREN LQjdYEEMd/eWdBeWZwsr9z6ApSU2ow0m3AndrH7mnTg3sWPtN4Ce7wKSfomsxyPXBnuf SZpdreKR6PZxJkMeydOH6WEV67Yrz0g0v8xcGF5HysKm/DelJ710MT+hb4LMRb4e4DJ3 X5cGHXNLCT3CuoOrEMV68/3CjpezXHXapLjOa57ilHnqYbwoRG5jnHMZq5XRU5sVSPdJ tJkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=C3ta9+Ug; 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 r3si20706624ilb.129.2021.11.01.14.07.22; Mon, 01 Nov 2021 14:07:34 -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=C3ta9+Ug; 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 S231407AbhKAVIk (ORCPT + 99 others); Mon, 1 Nov 2021 17:08:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231234AbhKAVIi (ORCPT ); Mon, 1 Nov 2021 17:08:38 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4384EC061714; Mon, 1 Nov 2021 14:06:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=GjVs3sP8YcLBM022Z/iDJU4ANcoNi+QMtRdM+DVSOYw=; b=C3ta9+Ug/JLSGKlke6O2qyFLRl m5NsOw9arejM5j198F8fOa9eZhxbnzqPoVirZlxmXCG7kjeZa1g+KVmoqOlbzh3H0SsGYM+txKoVg loG5VRB/ZYp1c3vqTZ3U+9syrcUFe9nT85r/UwD+sNZIubhKP24ie6anb2387y2Gl7oOH7VuxZexy DIuhcotbDNtJ2s+t8hIf1Oytv4C9lwvclekpP1fYZbuIWLWwVAjXLwH+qFD2XP5Jt58wg9YGQPEBt ZCYEX/DghJl7cJYLPp17OUZcEKKpCpVTZhzeeIPfcp8r4p34sY6mybYc0UjBZTynApVy1pLsuHgC8 JHzmzWtQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mheSJ-00419M-7V; Mon, 01 Nov 2021 21:03:19 +0000 From: "Matthew Wilcox (Oracle)" To: "Darrick J. Wong" Cc: "Matthew Wilcox (Oracle)" , linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Jens Axboe , Christoph Hellwig Subject: [PATCH 14/21] iomap: Convert iomap_page_mkwrite to use a folio Date: Mon, 1 Nov 2021 20:39:22 +0000 Message-Id: <20211101203929.954622-15-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211101203929.954622-1-willy@infradead.org> References: <20211101203929.954622-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we write to any page in a folio, we have to mark the entire folio as dirty, and potentially COW the entire folio, because it'll all get written back as one unit. Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Darrick J. Wong --- fs/iomap/buffered-io.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 3c68ff26cd16..b55d947867b1 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -959,21 +959,21 @@ iomap_truncate_page(struct inode *inode, loff_t pos, bool *did_zero, } EXPORT_SYMBOL_GPL(iomap_truncate_page); -static loff_t iomap_page_mkwrite_iter(struct iomap_iter *iter, - struct page *page) +static loff_t iomap_folio_mkwrite_iter(struct iomap_iter *iter, + struct folio *folio) { loff_t length = iomap_length(iter); int ret; if (iter->iomap.flags & IOMAP_F_BUFFER_HEAD) { - ret = __block_write_begin_int(page, iter->pos, length, NULL, - &iter->iomap); + ret = __block_write_begin_int(&folio->page, iter->pos, length, + NULL, &iter->iomap); if (ret) return ret; - block_commit_write(page, 0, length); + block_commit_write(&folio->page, 0, length); } else { - WARN_ON_ONCE(!PageUptodate(page)); - set_page_dirty(page); + WARN_ON_ONCE(!folio_test_uptodate(folio)); + folio_mark_dirty(folio); } return length; @@ -985,24 +985,24 @@ vm_fault_t iomap_page_mkwrite(struct vm_fault *vmf, const struct iomap_ops *ops) .inode = file_inode(vmf->vma->vm_file), .flags = IOMAP_WRITE | IOMAP_FAULT, }; - struct page *page = vmf->page; + struct folio *folio = page_folio(vmf->page); ssize_t ret; - lock_page(page); - ret = page_mkwrite_check_truncate(page, iter.inode); + folio_lock(folio); + ret = folio_mkwrite_check_truncate(folio, iter.inode); if (ret < 0) goto out_unlock; - iter.pos = page_offset(page); + iter.pos = folio_pos(folio); iter.len = ret; while ((ret = iomap_iter(&iter, ops)) > 0) - iter.processed = iomap_page_mkwrite_iter(&iter, page); + iter.processed = iomap_folio_mkwrite_iter(&iter, folio); if (ret < 0) goto out_unlock; - wait_for_stable_page(page); + folio_wait_stable(folio); return VM_FAULT_LOCKED; out_unlock: - unlock_page(page); + folio_unlock(folio); return block_page_mkwrite_return(ret); } EXPORT_SYMBOL_GPL(iomap_page_mkwrite); -- 2.33.0