Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3093714pxb; Mon, 18 Oct 2021 08:07:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyFT+izTH6zrD/xERWPWhe6bW2eLqstIPji/8qMr4icwwn415KDqGt5gtNz52piw0QnKsc X-Received: by 2002:a17:90b:4d0b:: with SMTP id mw11mr34366159pjb.228.1634569637010; Mon, 18 Oct 2021 08:07:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634569637; cv=none; d=google.com; s=arc-20160816; b=QkWll/QCEoEdpq6UvODe6kJrS10lEs2wjSUX2ehcCL+qV0dBi+nDHItRw4/NyLVM5F oVPqvVIuQa5bNTOx3bldZc7Ynq4H4guAATI7OTTN+t7jJez1hGjWefLz3dnLWKr8otgd GgGXl/S4SaHwfSYQQgbNrkEntAnZH4VWI6lxdikO4346a47DPihgAiqxi3MsppQ4YMAs ZFWKwDm+1RqB2/Fx2JQYQC9SVFE1thAb7GrSSDeylAn+HnIKQmKZ6IZKtCknQLF9ujZA eWhdE5bnKEW3xWb2Vcq1dgUhpBUZNqKecVD8E+GIpFp3T6qXpJ0AGaQVHIbyNHSdkWvk o5Cw== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:organization:dkim-signature; bh=XmPiML3uG821PVI2wOxhR6XbrMl1/IZxCyEQC1pxf2Y=; b=BilL1WzTLUQRofksrxRnFD/zLp8X7oWkOVKGzqrH0dCHYxuGo9fyWqTjpfPVrK7+Uu xdX0U5fSSbfXbHUTaF2ctfdoM9Db6WHov76b74IzWk3m9GFMWCQ3C/oQAuvrC0aaPeOo KkAyw+1lCnw7HUNfH7ymQyU0bArFF5Wseu+KALBdGtHRN9TD6YMtv03Tx/40g1tI9KAm gOmQeN//Nu77Vtxi0DeuiBFwzYei/nsTDa9XXOLVyTtfy1GWrSzdDCBY/LMyxBqS+RBd 3aeBW9aGUVtTtQ4+tvQOrgSz3OdSZ+Lo8SyIp1GkwrY7w/Ew8q1uP8Wjm18p6gos+gBI PBDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dcAmlY2F; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id fz4si27914516pjb.144.2021.10.18.08.07.01; Mon, 18 Oct 2021 08:07:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@redhat.com header.s=mimecast20190719 header.b=dcAmlY2F; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231966AbhJRPIh (ORCPT + 99 others); Mon, 18 Oct 2021 11:08:37 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:43748 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232260AbhJRPIC (ORCPT ); Mon, 18 Oct 2021 11:08:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634569550; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XmPiML3uG821PVI2wOxhR6XbrMl1/IZxCyEQC1pxf2Y=; b=dcAmlY2Fi/DAinePpn7MOgEe2wakQPAxIrD6S+vZalyUUIejUzRZODvqrSERXFutnrUq5p n5K4NG/qbKsMguB7EPIp1m36reiyqZ0rNnK66owYKHVgHUF5ojPb2SPUY+jIKRzR/M9dyL fXDyUurFKJKz3DOb9B5t1p6Vp2moJoQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-221-gvU46tYSPJWxM_EDE4T5Qw-1; Mon, 18 Oct 2021 11:05:49 -0400 X-MC-Unique: gvU46tYSPJWxM_EDE4T5Qw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 14C6480DDE4; Mon, 18 Oct 2021 15:05:47 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 97529100E809; Mon, 18 Oct 2021 15:05:33 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 56/67] afs: Make afs_write_begin() return the THP subpage From: David Howells To: linux-cachefs@redhat.com Cc: dhowells@redhat.com, Trond Myklebust , Anna Schumaker , Steve French , Dominique Martinet , Jeff Layton , Matthew Wilcox , Alexander Viro , Omar Sandoval , Linus Torvalds , linux-afs@lists.infradead.org, linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Date: Mon, 18 Oct 2021 16:05:32 +0100 Message-ID: <163456953268.2614702.4818196302635334339.stgit@warthog.procyon.org.uk> In-Reply-To: <163456861570.2614702.14754548462706508617.stgit@warthog.procyon.org.uk> References: <163456861570.2614702.14754548462706508617.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org generic_perform_write() can't handle a THP, so we have to return the subpage of that THP from afs_write_begin() and then convert it back into the head on entry to afs_write_end(). Signed-off-by: David Howells --- fs/afs/write.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/fs/afs/write.c b/fs/afs/write.c index 281f0e93e2c6..5cd417e95029 100644 --- a/fs/afs/write.c +++ b/fs/afs/write.c @@ -90,7 +90,7 @@ int afs_write_begin(struct file *file, struct address_space *mapping, goto flush_conflicting_write; } - *_page = page; + *_page = find_subpage(page, pos / PAGE_SIZE); _leave(" = 0"); return 0; @@ -120,9 +120,10 @@ int afs_write_begin(struct file *file, struct address_space *mapping, */ int afs_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, - struct page *page, void *fsdata) + struct page *subpage, void *fsdata) { struct afs_vnode *vnode = AFS_FS_I(file_inode(file)); + struct page *page = thp_head(subpage); unsigned long priv; unsigned int f, from = offset_in_thp(page, pos); unsigned int t, to = from + copied;