Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp3112604lqo; Tue, 14 May 2024 23:03:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVru9kKEYwjGNmmEeY74/cV0XcEQKDbpD/m2c2x8h6k/fP1tjULJbtVVj2Te9FJwXJ6c9D1XKRj5LFMbPKxOt444exlSgs2Qb/YC9vfqg== X-Google-Smtp-Source: AGHT+IGWiT4OWaJhdWvzKt2immxBiDG47c+v/AAyDnsILipPaAbsHpbRm3fHFL9q+sSFGuvsD4zW X-Received: by 2002:a17:902:e5cb:b0:1eb:63d9:8d85 with SMTP id d9443c01a7336-1ef43d2e27bmr192910365ad.14.1715752986662; Tue, 14 May 2024 23:03:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715752986; cv=pass; d=google.com; s=arc-20160816; b=W8U9IYE/ifFZzRYh9pFwVvuRaqeTn5Obh6RqkxBGCivZOf9gl/OZKRW7qXNdrQ3OwA eXk3pPG9vl5PE8rCpsiQVKDme6qJ+N4PaCcKoC1duBawVwC4kzKWjEaQNArqmLHQUzCo CelUEMcLi0PqVHQsVNIZiVoa9I5OqBV6iJlQTOoT/plBEfFYPXpmlAgLCNDp+Vb9cWgd 6XXQahNs0uu2mwvoTewEOAQSzzmJFPeImeksWT4RQa+wdv62IEddreLi3hfGMJRXE9rr NlSVd8H9JiHjKySxy2ViMQ2PLpV+Afyb5zzN5dl74aER3FIhur9iZb6U3NUjfoMUrVrY pLyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:cms-type:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:content-transfer-encoding:content-language :accept-language:in-reply-to:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature:dkim-filter; bh=dTnZOoNYjEenQBIjBgvJcx5/I/6R08XCA2XZxGoD7mw=; fh=boE2T1tfXWhPiAXKUEd+pJodvJpwHMz3xvNd2cVdM48=; b=B5WpTJxoBU/Y4MZgip5ar0ApsfCJDq+5+bYE5nbQn2Wcpfke8TiKNsveFyZ3Y7F6qD pUgIMIwc8EIuuQoq/kGx4KopYPYkWpnAgvm6exNwvz9etY9kJLCPVtelikv7Ihswlm66 vt3oAIJLGPW+CPa4Ne3xoRVH4YX3cQiXMwBv6arVme865jBBow96V2Fj5wzHT7qy3/Gd nuRk/9lo3n11z1UKA6JOM5XvC5N9rHckTKtjq7Z8WTQsdJdx9m1GAwx3T9tP+NuQ/bZS EzX/+6YQNrbZfA7Le8hCWKPsY0AMVdF7M4OdXuRB/m8rfZPRhz8eA0pVGNGl1Q+BbUSp kbhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ngyRgTVK; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-179485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179485-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c153579si133952855ad.520.2024.05.14.23.03.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 23:03:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=ngyRgTVK; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-179485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179485-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BF9A7B2247F for ; Wed, 15 May 2024 05:58:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D22613BB22; Wed, 15 May 2024 05:57:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ngyRgTVK" Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 418E73A1B6 for ; Wed, 15 May 2024 05:57:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715752650; cv=none; b=dQ5FkigzD+P35rYUQCAELKUEsyaS67/3Jak+gL+xStx9+oUH9DiCv8B4cO4E2wuQDu2b+1chw2hOf0grjKWxNTsU7unVRWydL6Sh/KgG9J0pGODFPhQvwNd8UVhg/Di+BN4G2+2AnxKt1N+ux+LEGLBgp8ij+tX71FF96AE70jI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715752650; c=relaxed/simple; bh=RH5M2Ft1yieIKx+BOHBf4ZaFqhptJPv2A+bAcQFaiHQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:Content-Type: MIME-Version:References; b=RXPSOhJDw+9UyhhTYoZjCWn4jn7eFb5gffYW2/zn7mH7uqp3kzPkHCXw1KJBDpCsGdKtOwV8l3q0e7Y6zAF8B4cz6JxZP6J4OWCrVcgpicZePgivC8V7lKHd1Qd4HTV1ahNzQNziyx2bP7r8V5s+6kRnv2KPgrpJPaF+A7gRgpo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=ngyRgTVK; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20240515055726euoutp023f4fd3a44769719c23492482ee0ea4a7~Pk-ERmamg2018420184euoutp02B for ; Wed, 15 May 2024 05:57:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20240515055726euoutp023f4fd3a44769719c23492482ee0ea4a7~Pk-ERmamg2018420184euoutp02B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1715752646; bh=dTnZOoNYjEenQBIjBgvJcx5/I/6R08XCA2XZxGoD7mw=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=ngyRgTVKgIg06q8/vI0Fid46l37RPLZvHru4oqaGh/1vminFbwPmV86npg8rgwWAv RriHtUBW0RpYX6BP2vGsF19pKZsDEiYTWJ8lgrtshZXCeTRBWlb/vdteRyeGKLRgvs m5ZiVX3BQToI7JU8pA0udsY+xeX3WVGdCT7J97kk= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20240515055724eucas1p14abe531cee8b71732d5f48dbf9cc26e6~Pk-CeXLbu2872228722eucas1p1Y; Wed, 15 May 2024 05:57:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 75.BC.09624.4CE44466; Wed, 15 May 2024 06:57:24 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240515055724eucas1p1c502dbded4dc6ff929c7aff570de80c2~Pk-B985K61859218592eucas1p1C; Wed, 15 May 2024 05:57:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240515055724eusmtrp1eef596575f6b6795be5c3de034b524d3~Pk-B9Q91t0390703907eusmtrp1o; Wed, 15 May 2024 05:57:24 +0000 (GMT) X-AuditID: cbfec7f2-bfbff70000002598-44-66444ec46294 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id E9.16.08810.4CE44466; Wed, 15 May 2024 06:57:24 +0100 (BST) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240515055723eusmtip1edc9607f2a5ec529c7552cf4a0766878~Pk-Bw0UHM0235902359eusmtip1Q; Wed, 15 May 2024 05:57:23 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 15 May 2024 06:57:23 +0100 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Wed, 15 May 2024 06:57:23 +0100 From: Daniel Gomez To: "hughd@google.com" , "akpm@linux-foundation.org" , "willy@infradead.org" , "jack@suse.cz" , "mcgrof@kernel.org" CC: "linux-mm@kvack.org" , "linux-xfs@vger.kernel.org" , "djwong@kernel.org" , "Pankaj Raghav" , "dagmcr@gmail.com" , "yosryahmed@google.com" , "baolin.wang@linux.alibaba.com" , "ritesh.list@gmail.com" , "lsf-pc@lists.linux-foundation.org" , "david@redhat.com" , "chandan.babu@oracle.com" , "linux-kernel@vger.kernel.org" , "brauner@kernel.org" , Daniel Gomez Subject: [PATCH 01/12] splice: don't check for uptodate if partially uptodate is impl Thread-Topic: [PATCH 01/12] splice: don't check for uptodate if partially uptodate is impl Thread-Index: AQHapozBbWbHWLdhTE2QsNHTwXO1jw== Date: Wed, 15 May 2024 05:57:23 +0000 Message-ID: <20240515055719.32577-2-da.gomez@samsung.com> In-Reply-To: <20240515055719.32577-1-da.gomez@samsung.com> Accept-Language: en-US, en-GB Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-messagesentrepresentingtype: 1 x-ms-exchange-transport-fromentityheader: Hosted Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUxTZxTGfe+9vfdS1nmp3XgDQ0wNfwha1JntRYm6TJObaSYmJsavaCMX JAOUWytM50JkIasiY3VDbZkFKxQKhtiCQIUqDEE+NESmI4AkLO0yymJLEfzoFWZ7ceG/35Pz nPOckxwal7+QRNEZ2Sc5PludqSSlxO2u14/WdH69LW3t8MuVqKy+jkTzbV0ATf7uB+jx/eXo YXGARDP1b3A06PoQuf3FBDJeLsDQoKOMRGN18xLkEJop5Jxsw9FQiRug9t4fKRR49a7a5Ni3 NYJtMTyj2HKblrVXx7M2q45kbX49xT64EiDYlvEk9tKQBbBT7mGC9TqfkGx/eSfFTtuWp3yw X5qcymVmnOL4xM1HpMf6TBXYiaeyvEaDlcgHI9LzIIyGzAZonJigzgMpLWeqAbzYdYUUxQsA C2vnMVFMA3jj70r8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 20240515055724eucas1p1c502dbded4dc6ff929c7aff570de80c2 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240515055724eucas1p1c502dbded4dc6ff929c7aff570de80c2 References: <20240515055719.32577-1-da.gomez@samsung.com> From: Pankaj Raghav When a large folio is alloced, splice will zero out the whole folio even if only a small part of it is written, and it updates the uptodate flag of the folio. Once the per-block uptodate tracking is implemented for tmpfs, pipe_buf_confirm() only needs to check the range it needs to splice to be uptodate and not the whole folio as we don't set uptodate flag for partial writes. Signed-off-by: Pankaj Raghav Signed-off-by: Daniel Gomez --- fs/splice.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/fs/splice.c b/fs/splice.c index 218e24b1ac40..e6ac57795590 100644 --- a/fs/splice.c +++ b/fs/splice.c @@ -120,7 +120,9 @@ static int page_cache_pipe_buf_confirm(struct pipe_inod= e_info *pipe, struct pipe_buffer *buf) { struct folio *folio =3D page_folio(buf->page); + const struct address_space_operations *ops; int err; + off_t off =3D folio_page_idx(folio, buf->page) * PAGE_SIZE + buf->offset; =20 if (!folio_test_uptodate(folio)) { folio_lock(folio); @@ -134,12 +136,21 @@ static int page_cache_pipe_buf_confirm(struct pipe_in= ode_info *pipe, goto error; } =20 + ops =3D folio->mapping->a_ops; /* * Uh oh, read-error from disk. */ - if (!folio_test_uptodate(folio)) { - err =3D -EIO; - goto error; + if (!ops->is_partially_uptodate) { + if (!folio_test_uptodate(folio)) { + err =3D -EIO; + goto error; + } + } else { + if (!ops->is_partially_uptodate(folio, off, + buf->len)) { + err =3D -EIO; + goto error; + } } =20 /* Folio is ok after all, we are done */ --=20 2.43.0