Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp968634rdb; Fri, 9 Feb 2024 06:41:16 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWkx1uQvf2XDdboPMvtgiS//J0xOKb8ZX8KtravvluOis35s2YA2Qh7s8pEIU1J6zw67Oaw0bzv1+lBPa5nP+6UxwbXY9yiPwW1x40dbA== X-Google-Smtp-Source: AGHT+IEVs9CDgeF+fctqpPLJ54QVpu4JW3OvzWI/g/wEznsT/RCpi3SqHB/GOJqpCatz5MOIdtfa X-Received: by 2002:a92:c5ac:0:b0:363:812d:d6a3 with SMTP id r12-20020a92c5ac000000b00363812dd6a3mr1790300ilt.20.1707489675841; Fri, 09 Feb 2024 06:41:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489675; cv=pass; d=google.com; s=arc-20160816; b=F07lP8+37QdWcfOgBinc0W/uTA4WGwjPOog1x3ow8CsE2bp9QJGjK1ix5m3KgPhWNy ZQtf6uSExz5hJzUY0W71uu7B5AfwC+lnVsrtZp5F0nz0EoFdFqDM24DdIkai1jutUUAE JjcRDESzu1x1Q5fpRi5tWMiM5hLQK77zyTn86wox9TDbvmNS0WTGnu7BdMh9GZJcOZrQ dB2uiRrrRZYSDOb9cegK9llujmXr6kVgMnLK+CXRZMgEi5x8GJOL4B+OnpRnFmbXwUe+ l2COzBgLEvu6f2yl5TV3vI3TXk1XVVr7cSQOE07qgbo8T4xGmK6CprTgb9uMWMguoZpF L67w== 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=Xp/CDCIv8x19lL1UbiGyRLdd/wr0PppohAnD3gAfH/c=; fh=TNmO0ECMnjJH1YKZLmozQ23Sl8kDhACQU2M2tgbOKQ4=; b=TNTj8xXD0ZRXwIXzsC3ubzNHWCqnmYRByKKIcZHi1Mfo5syhJl/GGAYX6AfxIzvdUu 81UeesCImkyhDaga9Wla4L+Dd4G5KWJTep875b7DtjLEKrSwRgrcuKKS/aLaobizA8gj yFZijN+OXvL8LdNj2XBpzOCJMU2R2tYucVAuzN8VvAMhQ1xKiqKZKqJztq7dkDE4TT2V kTZM0eO9DIo/hp7eLlFU96Gl47twMM7gpZ/F5THZTKJXOg9rYNO04422vAgAOzgMa/JE 8padgIqVI8HbHQ3pDDVORDF6GW1kBEUAsllotQl29X+LXyVFcPh8JVokI+vWNUX1iMaH 7mZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LzdQ56ug; 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-59450-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59450-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com X-Forwarded-Encrypted: i=2; AJvYcCVOvyoroNHw4abCQbrIz2vZckljXl04Nsm/PuVdkJAkq+0Iu2i4O4t5ghgUMrYM4trWqAADFnNGCVWGoEEvMBWsrdgRoGYl2aApJMmXQQ== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 73-20020a63004c000000b005dc529d8827si1470556pga.803.2024.02.09.06.41.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:41:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59450-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=LzdQ56ug; 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-59450-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59450-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 2CE36B21068 for ; Fri, 9 Feb 2024 14:29:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F81469D08; Fri, 9 Feb 2024 14:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="LzdQ56ug" Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) (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 56B1D69950 for ; Fri, 9 Feb 2024 14:29:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707488948; cv=none; b=uVcuGSXxG9fTA1w6xyA2FCX++WSCd5I4MrF31XfoQZq7vjXy1m8IC1KvVGo7PKrj6c+gPIvOO+oGt3Doaupb9Pv7/N/tEPhqLFc1PS4Kia4UmL6HiIuG17diHxi+HiEEzi9w8jKouoTv6R/71SMF5hKsnVZNpvlFIUQ5y9YmJc0= 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.11 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 eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20240209142904euoutp01044a07252a61cc6762edc66c3a0ab774~yOCX9DFcV2752227522euoutp01h for ; Fri, 9 Feb 2024 14:29:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20240209142904euoutp01044a07252a61cc6762edc66c3a0ab774~yOCX9DFcV2752227522euoutp01h 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 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: H4sIAAAAAAAAA02SaUwTURSFfTPT6VBtGAqRJ66AK9IKwehEjZGocRKMQYMmGBeqjHVpETpU kERFAVEkFQluhUBVEFAitioqm9pioRbDDyOCUZZaRFFBioBaBWkHE/59991z7zk3eQQqauT5 EAdi4hlljFTuhwuwCtOvJvHdZSYmSK0RUHnlZTj1xWgH1Eu1A6csWdcRqsuuxqjcyykIVV1j xqhXlXk41VY2yqNasroA1fS3nkc5fubha6bQjzXv+bRWr6LvlQTQ+ltncVpvz+bTDVccGN2o rePTA/pZtN72DQl32y5YFc3IDxxhlEtWRwn2tw7U8mMz3RNPvhjGksH3yRnAjYDkUlh6LxnJ A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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=3Dalways is set in tmpfs, it will zero out the whole page ev= en 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_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