From patchwork Fri Feb 9 14:29:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Gomez X-Patchwork-Id: 13551388 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 7579369957 for ; Fri, 9 Feb 2024 14:29:06 +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=1707488948; cv=none; b=LxiI0iZZTTxR62nMIhbG9OsrED0CAnJ86o98XWxrly/2FxPAnEQHEvmitKQoqrhrzxk8M/5MyNROow0Z2MzKnU46AVNASqfpgwOXySZB/UoKo1MXNqW/4bXD/g7rHN73r39+g3l0vlUN3Rf1WibMaYrtwZ7JMoiyPp0/49zBvfk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488948; c=relaxed/simple; bh=jJSsCzIPLDt1dUl38isaDgdPo1XoyXbEHM2UbvgYw/M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:Content-Type: MIME-Version:References; b=K1rOhA6jo/oa/itVC/8gzYEPRPim5QyqjFCup54LKw+m2dQtNR+6k7UNMzvn2HgJ3dGTa8lQ7W40BOBWmGrNJRiBOvYy79E/uJS/XX5nMJEDLkYF/n2l+aW+GweqceGAhplMybsnir/ILViuLS0LIvWGSA05zwfQKs2U3Z2THFc= 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=LzdQ56ug; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="LzdQ56ug" Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20240209142904euoutp02bb864e26136758fff5bafb9a7cc82c21~yOCX9CqxB2144921449euoutp02N for ; Fri, 9 Feb 2024 14:29:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20240209142904euoutp02bb864e26136758fff5bafb9a7cc82c21~yOCX9CqxB2144921449euoutp02N DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1707488944; bh=Xp/CDCIv8x19lL1UbiGyRLdd/wr0PppohAnD3gAfH/c=; h=From:To:CC:Subject:Date:In-Reply-To:References:From; b=LzdQ56uglyxjaJchOqqToC0c03bgWaOs+RPDfGhHNU9nsIH+BF6X887k+qb9pBDBM MQgLLEY70ciK0e/b+vB/b4SQGZiKoMEKA77+j6Pyunniki1dNFeugxTTAy4Eml3nR+ bF64C58U7sasaiGtG9I6zpBtSo2oSuhVUIoRNCMk= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20240209142904eucas1p21b3aca7b96105d3b5578a9ff3ae31d1f~yOCXp-XiZ0208902089eucas1p2U; Fri, 9 Feb 2024 14:29:04 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id E8.2E.09552.0B636C56; Fri, 9 Feb 2024 14:29:04 +0000 (GMT) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240209142903eucas1p17f73779c6b38276cd7cefbe0a40f355e~yOCXQxwuN0937209372eucas1p1W; Fri, 9 Feb 2024 14:29:03 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20240209142903eusmtrp2f9b51616ff70cd7034716594c79ec1a4~yOCXQJcRl2110121101eusmtrp2Y; Fri, 9 Feb 2024 14:29:03 +0000 (GMT) X-AuditID: cbfec7f5-83dff70000002550-89-65c636b0a566 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 06.6F.09146.FA636C56; Fri, 9 Feb 2024 14:29:03 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20240209142903eusmtip1cba34f5186d87344c625af1f3f3dac53~yOCXDXR-x2720027200eusmtip1v; Fri, 9 Feb 2024 14:29:03 +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; Fri, 9 Feb 2024 14:29:03 +0000 Received: from CAMSVWEXC02.scsc.local ([::1]) by CAMSVWEXC02.scsc.local ([fe80::3c08:6c51:fa0a:6384%13]) with mapi id 15.00.1497.012; Fri, 9 Feb 2024 14:29:03 +0000 From: Daniel Gomez To: "viro@zeniv.linux.org.uk" , "brauner@kernel.org" , "jack@suse.cz" , "hughd@google.com" , "akpm@linux-foundation.org" CC: "dagmcr@gmail.com" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "willy@infradead.org" , "hch@infradead.org" , "mcgrof@kernel.org" , Pankaj Raghav , "gost.dev@samsung.com" , Daniel Gomez Subject: [RFC PATCH 1/9] splice: don't check for uptodate if partially uptodate is impl Thread-Topic: [RFC PATCH 1/9] splice: don't check for uptodate if partially uptodate is impl Thread-Index: AQHaW2RTk/uEtIw1W0yBH2EezPFdkg== Date: Fri, 9 Feb 2024 14:29:02 +0000 Message-ID: <20240209142901.126894-2-da.gomez@samsung.com> In-Reply-To: <20240209142901.126894-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 Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA02SaUwTURSFfTPT6VBtGAqRJ66AK9IKwehEjZGocRKMQYMmGBeqjHVpETpU kERFAVEkFQluhUBVEFAitioqm9pioRbDDyOCUZZaRFFBioBaBWkHE/59991z7zk3eQQqauT5 EAdi4hlljFTuhwuwCtOvJvHdZSYmSK0RUHnlZTj1xWgH1Eu1A6csWdcRqsuuxqjcyykIVV1j xqhXlXk41VY2yqNasroA1fS3nkc5fubha6bQjzXv+bRWr6LvlQTQ+ltncVpvz+bTDVccGN2o rePTA/pZtN72DQl32y5YFc3IDxxhlEtWRwn2tw7U8mMz3RNPvhjGksH3yRnAjYDkUlh6LxnJ AAJCRJYAWP68DOeKHwBaU/swp0pEDgDY/3TH/4mK7AKUey8GsP3dNG5gTDNythTjCguAP9su 8jjV2F7DOy8n4+QiWGvW850iL7IbwLSqfleBkq0obH7dNGZOEJ5kJLydss054EXugrcr0hCO JfD+07euSBg5F2qL2l0xhOQKWKbrd2ncyJUw31qOOxmQM6G19DffySjpDd/aChDuBA94Pbca 5XgqHKnsxDkOhC/f2ADHQfBBUS3GsS88Y2rFuT0S2HIxZ5wXw5vXvoxn8IDmqzbX9ZDMEEDj k6Fxs3XQ+Kdl3MAT9tTf53M8A44+LkCywGLNhHyaCR6aCR6aCR5agN0C3oyKVcgYNiSGSZCw UgWripFJ9h5W6MHYh7OM1A8+AiU9/RIDQAhgAJBA/byEEYV1jEgYLT2axCgP71aq5AxrANMJ zM9bOC96NiMiZdJ45hDDxDLK/12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tzk3PLTbUK07MLS7NS9dLzs/dxAhMU9uO/dy8g3Heq496hxiZOBgPMUpw MCuJ8IYsOZIqxJuSWFmVWpQfX1Sak1p8iNEUGEYTmaVEk/OBiTKvJN7QzMDU0MTM0sDU0sxY SZzXs6AjUUggPbEkNTs1tSC1CKaPiYNTqoFJ4kvLg00v1ULcvLft8L5jveKF97XaNV/uLPh0 dt3KuJr6asOH8S+v3F4d6Hjq5Ytjq55c7X8nnyasYP/pwIpjtZOyPJPXnSpN3i+hMf/474/H mv48Tp2daSt08d7+N36bYx/WMD3s3bGvPccl/TP/t5bsmJ8H+t4YX3SdX2C6oOHJ7h23nI5H HT3HkPpq+sr596enssyZZsx5ZP7jtLVrXkZNTlT/+uLL7bM/jj5w/ZFjWx6RZV6bvmaZVwxD 3/NG8ZU8a37r/HUuuckkwdX07oF28sMs7c9v/GdMskmqFpjEcqEpft3GXVxmV5eIt7Xzx1eb lR/8/jPYv1heifkQ+5zVaq/fR/4p8BYrtGqRPa7EUpyRaKjFXFScCAAnnUg83AMAAA== X-CMS-MailID: 20240209142903eucas1p17f73779c6b38276cd7cefbe0a40f355e X-Msg-Generator: CA X-RootMTR: 20240209142903eucas1p17f73779c6b38276cd7cefbe0a40f355e X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240209142903eucas1p17f73779c6b38276cd7cefbe0a40f355e References: <20240209142901.126894-1-da.gomez@samsung.com> From: Pankaj Raghav When huge_page=always is set in tmpfs, it will zero out the whole page even if only a small part of it is written, and it updates the uptodate flag of the whole huge page. Once the per-block uptodate tracking is implemented for tmpfs hugepages, 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 --- Other option here is to have a separate implementation of page_cache_pipe_buf_ops for tmpfs instead of changing the page_cache_pipe_buf_confirm. 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_inode_info *pipe, struct pipe_buffer *buf) { struct folio *folio = page_folio(buf->page); + const struct address_space_operations *ops; int err; + off_t off = folio_page_idx(folio, buf->page) * PAGE_SIZE + buf->offset; if (!folio_test_uptodate(folio)) { folio_lock(folio); @@ -134,12 +136,21 @@ static int page_cache_pipe_buf_confirm(struct pipe_inode_info *pipe, goto error; } + ops = folio->mapping->a_ops; /* * Uh oh, read-error from disk. */ - if (!folio_test_uptodate(folio)) { - err = -EIO; - goto error; + if (!ops->is_partially_uptodate) { + if (!folio_test_uptodate(folio)) { + err = -EIO; + goto error; + } + } else { + if (!ops->is_partially_uptodate(folio, off, + buf->len)) { + err = -EIO; + goto error; + } } /* Folio is ok after all, we are done */