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: 198926 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp898699dyd; Fri, 9 Feb 2024 06:42:13 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCURd+j8kDPkCgwsgs9T5sA/fpGed7/KkzWww008KJ/Op7BgPxtgt2vLTTD2J+/KQumGAM3AhRQa3jjtE/H9/3jtlujzaw== X-Google-Smtp-Source: AGHT+IEL+rKPgpwvcQ0yQIbHtGJsid5NaptbARXUTWMKs5p/qG0LfnRTTMW35miJqBtSOCS7maGB X-Received: by 2002:a05:6a20:9e48:b0:19e:9a7b:211f with SMTP id mt8-20020a056a209e4800b0019e9a7b211fmr2212353pzb.8.1707489733090; Fri, 09 Feb 2024 06:42:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707489733; cv=pass; d=google.com; s=arc-20160816; b=bo9X5uDfh7bA2LpCm+7Fo8vDFFJF54caeMbFes6DSBy4yfvzq9rcl0LdU5UDBRejt3 t55MC7DYqFcimyGfS3AYxmMZra0zaTnCr0OZ61EzuhRU1gEuIWXvTE7Yst7kS/2Ozx4/ zg7QAGrks2Z90KoYBxgucnCn+l5UvPUWHwrgHJ4CkaXE/Uto4C/oGQ2T9ogkF5FFoVj4 7QNabmnzwDxwrU+yUNgmt0gYxBfQmhykBkHRLGgyMoq2iPn9oh5BjIpQwZ0D7SloSjIg iR/k5mxIlauQKqPuY0yhvAvAlgdLlN56Bozyn5+vyYr9d5O02ghLgBmkv0ajIfDDssVC VINw== 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=YRDp2Rua4z6t/nCvUIytrMVJmj35LXE4IKnlPtrs9yM=; b=Ds39Fge62IWjw1wAO+qtRoM2eU4wJqisJV1U0PZH/e7R96vS040TT2pUJMAP30ClKL CfUIa3dLkQDoq/BvJ0ZTNF/+jBefOkFAxJ5k1VVsc791VQwm32zmi7QgOs9UklUBFXZT VWPKd4eEeZku3vmPXuKuduGR87BWGTnAzD3PiL3bGs7ZsCzd3WtsUlLML72H4z0zefW9 aF9Mm55eP5YnoJRZTXVM5myn8ZYaKofxZOe6QtmiGQ9WWigeC6RHuDLhzMLaj9iz/3JJ 9/i+USKmlTLNRUARfeOX2BsNjwOVmi3TJvVXxIb510LWp0+jqx8BJTPiP5rP6oBChJmL 5h1w==; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59450-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com X-Forwarded-Encrypted: i=2; AJvYcCWpv62uCa17wvKRNT54/3wGXczdkc4XEPpTl8Mhx4DXBKtMk/7FW4jyjchlY86DnZ3WiJgkYrYo4JkuzxD1TEivBYg1iw== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s123-20020a637781000000b005cf268638edsi1910609pgc.177.2024.02.09.06.42.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 06:42:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-59450-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-59450-ouuuleilei=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 68FB2B23107 for ; Fri, 9 Feb 2024 14:30:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C19C56A017; Fri, 9 Feb 2024 14:29:12 +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 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+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aq/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> X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790432754274179037 X-GMAIL-MSGID: 1790432754274179037 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 */