From patchwork Tue Apr 11 12:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13207506 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6AD64C76196 for ; Tue, 11 Apr 2023 12:29:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA7E16B0074; Tue, 11 Apr 2023 08:29:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C32A66B0075; Tue, 11 Apr 2023 08:29:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AD420900002; Tue, 11 Apr 2023 08:29:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 9C1406B0075 for ; Tue, 11 Apr 2023 08:29:30 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 760168058D for ; Tue, 11 Apr 2023 12:29:30 +0000 (UTC) X-FDA: 80669040900.13.7361535 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf28.hostedemail.com (Postfix) with ESMTP id 739D1C0017 for ; Tue, 11 Apr 2023 12:29:27 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=s+NcSqyq; spf=pass (imf28.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681216168; h=from:from:sender: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:dkim-signature; bh=PIVtaWRdXFvvGvca/utIz/lLXjHseGY076GdVp9CofQ=; b=srw+J9MGf36Jm8Rqqr5zxDLWwRP8pW/PcULw4qenRRJRLurf0UBjcoo9l6Vio5rcvx1L1f mrXX5xoynWIsMimq/4qOOUh8zzqOAoG5tF+8Cikh8zub3Odh0BWqOro1BD9CcwJrlH36os KRJfpQbOhtUFZNNU8+VXkC7bSTKoWbA= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=s+NcSqyq; spf=pass (imf28.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com; dmarc=pass (policy=none) header.from=samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681216168; a=rsa-sha256; cv=none; b=6vUh3MYrCOs7xR4vGxpqpRLCizKCurD40fGR1DtM0I2hJVjrCtJNXyVK+ujcQtN6FkpbJG s/MWSk8QTpOhlTgW37vyCLLcveHUS4f8X4UoyPcaL5sZ95BAbO0vf7pM8vFnso9Hqz26vC 0QuYEICAyclJ21FpdMNdj2sVTcTRDhk= Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122925euoutp013e5587edc05515fb7d4271bae15a6eb8~U4THt4QPx0605006050euoutp018 for ; Tue, 11 Apr 2023 12:29:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230411122925euoutp013e5587edc05515fb7d4271bae15a6eb8~U4THt4QPx0605006050euoutp018 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681216165; bh=PIVtaWRdXFvvGvca/utIz/lLXjHseGY076GdVp9CofQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s+NcSqyqbq11RtsrC+miaqtF9/zatU92pOylTRwd7fqlJapAX0PouHP1PgEAx/uXx DyeEETwwsyKbo+sFwMBF1sju9QKbpPx1/GJyuzdssfrueHqz7EcEhAZP0KLactXS2B wP3ZGLEpiAXdItnsQ4DEPTcKYoI50y18gs5kxSuc= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230411122923eucas1p2f756a287f9f45b8c76bdbd7f81d949db~U4TF8Df2y3228532285eucas1p2t; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id B8.9A.10014.3A255346; Tue, 11 Apr 2023 13:29:23 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b~U4TFlFxcc3003730037eucas1p27; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230411122923eusmtrp1f4a4812316778b3dcb34ac05a45a01dd~U4TFkUivq0646206462eusmtrp1S; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) X-AuditID: cbfec7f5-b8bff7000000271e-03-643552a3acbc Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B7.FB.34412.2A255346; Tue, 11 Apr 2023 13:29:23 +0100 (BST) Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230411122922eusmtip22c05afaf469dd0ad10bc0ac238306b53~U4TFSq8M32761927619eusmtip2k; Tue, 11 Apr 2023 12:29:22 +0000 (GMT) From: Pankaj Raghav To: hubcap@omnibond.com, brauner@kernel.org, martin@omnibond.com, willy@infradead.org, hch@lst.de, minchan@kernel.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, akpm@linux-foundation.org, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, mcgrof@kernel.org, Pankaj Raghav Subject: [PATCH v3 1/3] orangefs: use folios in orangefs_readahead Date: Tue, 11 Apr 2023 14:29:18 +0200 Message-Id: <20230411122920.30134-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411122920.30134-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7djP87qLg0xTDJqvyVnMWb+GzWL13X42 i9eHPzFa7N88hcni5oGdTBYrVx9lsmi/28dksfeWtsWevSdZLC7vmsNmcW/Nf1aLk+v/M1vc mPCU0WLZ1/fsFp+XtrBb7N64iM3i/N/jrBa/f8xhcxDymN1wkcVj8wotj8tnSz02repk89j0 aRK7x4kZv1k8GqbeYvPYfbOBzePX7TusHn1bVjF6fN4k57HpyVumAJ4oLpuU1JzMstQifbsE roxzS26zFjRwV9x9e5+pgbGZs4uRg0NCwERic593FyMXh5DACkaJnS93sEA4Xxglbm+7ygTh fGaUeHFlKWMXIydYx97Pe9lBbCGB5YwS7Yf8IYpeMkpM2rCLCWQsm4CWRGMnO0hcROAWo8SC z1cYQRxmgfuMEg9vnQLrFhZwkliyeQYriM0ioCrxbv1fZpBmXgFLifbFTBDL5CX2HzzLDGJz ClhJrF71AewIXgFBiZMzn7CA2MxANc1bZzODzJcQ2M0p0X15KRtEs4vE5glHWCFsYYlXx7ew Q9gyEqcn97BA2NUST2/8hmpuYZTo37meDRIw1hJ9Z3JATGYBTYn1u/Qhyh0l9n7bxwhRwSdx 460gxAl8EpO2TWeGCPNKdLQ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ksWTzDLA4i4CqxLv1f5lBenkFLCXa FzNBjJeX2H/wLDOIzSlgJbF61QdGiFWWEhfa54G18goISpyc+YQFYry8RPPW2cwTGAVmIUnN QpJawMi0ilEktbQ4Nz232EivODG3uDQvXS85P3cTIzB+tx37uWUH48pXH/UOMTJxMB5ilOBg VhLh/eFimiLEm5JYWZValB9fVJqTWnyI0RTo7InMUqLJ+cAEklcSb2hmYGpoYmZpYGppZqwk zutZ0JEoJJCeWJKanZpakFoE08fEwSnVwLQ93KVDxE3m+9vDar+Mz0p8/1bln2KS8P2w0b97 3lMzqht59tmv+yM8sbzajeF+3MY9BwWrzrM8z8wt3XzhRsdn4+o4l7e6cufMz0W+512x//iT I2dm7cqqZbuo4FT3uoZl8ZkGkX3+nA+Xne74dXSPaV3jWcFdpS8KPx+b++CB992C3Us/Zs91 /RFmfCb/ucYU9i/8obeMYo/6zThy03ZXQLj86b663BOLyn6V+K1j33Fv95t/ndcSv9nruDOo 3rnC929L3s7/Fuxpnkn8TKJFD2oyXnkFbD8h2CWzUX+6mOq1Vfe+Bl0o9evQuBo62aXz56Wy pD2TXpp0qV9fffT1PlZHs9opi+X0GpnYZq9UYinOSDTUYi4qTgQAQYdjlmgDAAA= X-CMS-MailID: 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b X-Msg-Generator: CA X-RootMTR: 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122923eucas1p27e097fa66db8e166d14658bc7c6f180b References: <20230411122920.30134-1-p.raghav@samsung.com> X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 739D1C0017 X-Stat-Signature: 9o5ggoc6yr55s874mg989fr4u5ph1ebs X-HE-Tag: 1681216167-688008 X-HE-Meta: U2FsdGVkX19M6C/TifkO5xxMMyqhMDN2F07S5dTlRvx4OVzCKQ0bXXutkSEL12np0kBuUe2xKDay5qh4YXKxsfBIEvKv+ea3HJ6JsAb6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=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Convert orangefs_readahead() from using struct page to struct folio. This conversion removes the call to page_endio() which is soon to be removed, and simplifies the final page handling. The page error flags is not required to be set in the error case as orangefs doesn't depend on them. Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig Tested-by: Mike Marshall Signed-off-by: Pankaj Raghav --- fs/orangefs/inode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/orangefs/inode.c b/fs/orangefs/inode.c index aefdf1d3be7c..9014bbcc8031 100644 --- a/fs/orangefs/inode.c +++ b/fs/orangefs/inode.c @@ -244,7 +244,7 @@ static void orangefs_readahead(struct readahead_control *rac) struct iov_iter iter; struct inode *inode = rac->mapping->host; struct xarray *i_pages; - struct page *page; + struct folio *folio; loff_t new_start = readahead_pos(rac); int ret; size_t new_len = 0; @@ -275,9 +275,10 @@ static void orangefs_readahead(struct readahead_control *rac) ret = 0; /* clean up. */ - while ((page = readahead_page(rac))) { - page_endio(page, false, ret); - put_page(page); + while ((folio = readahead_folio(rac))) { + if (!ret) + folio_mark_uptodate(folio); + folio_unlock(folio); } } From patchwork Tue Apr 11 12:29:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13207507 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3E7AC77B75 for ; Tue, 11 Apr 2023 12:29:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2E6826B0078; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2BC576B007B; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 10FFC6B007E; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id F3CF56B0078 for ; Tue, 11 Apr 2023 08:29:30 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9A42EA0B3B for ; Tue, 11 Apr 2023 12:29:30 +0000 (UTC) X-FDA: 80669040900.14.09666FD Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by imf14.hostedemail.com (Postfix) with ESMTP id 1758910000A for ; Tue, 11 Apr 2023 12:29:27 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=BeGheTcd; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf14.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=p.raghav@samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681216168; h=from:from:sender: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:dkim-signature; bh=l7peqDnGhiOjw0ljVfPNDYGwu5jQ8i9/ouCQ6iiHQ5Y=; b=WatTTyDUmZUksiK4CzEbwca80+06E6E/SoZkZwTGdVAERDTiuMakbxQimvK9r7ZE3CNp9N BTNjvpqtIklSxTcAiL/QJdvgL0tTY2Psxy9pQchFRDDGjYlKdWrKVEDvF9Cazr5191gyLr vdsOj3eZStqpnXCNE/B8eQLxO/ESop8= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=BeGheTcd; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf14.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.12 as permitted sender) smtp.mailfrom=p.raghav@samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681216168; a=rsa-sha256; cv=none; b=raFdPt7EFg8k/OJCBkETuQzPjtA/X0bLCaNAPJfFn19w6e9EEygg3H/l0UkyCTSP95ZPM7 pm8H3a4knAYHnGqiU9R2yWWCFTGDVKJA7usDaUm2DxGoc+6KYjqV38/8anJh7zXq951LZm ozLl4QBKEUkUVACr/wif8E89ZQKTsqI= Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122925euoutp024b9b1525ea8ba5e21357517429be38b6~U4TIB-uSc0298102981euoutp029 for ; Tue, 11 Apr 2023 12:29:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230411122925euoutp024b9b1525ea8ba5e21357517429be38b6~U4TIB-uSc0298102981euoutp029 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681216165; bh=l7peqDnGhiOjw0ljVfPNDYGwu5jQ8i9/ouCQ6iiHQ5Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BeGheTcdFlFG0Wy/rnM5V3J1/7UuTP2b7hrT0YCLH3mEZsS66F/accCZV0rybI1ZW T6lLMoTjtYTrD8djfrYre+eYhpCFlyPe1R5X7SI9wc4DU7C8vyn7cN8trYygUKURw8 Wu/0T/zi8O9pfVHfeeQV7kiZfKILmuM+4jXtTnts= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230411122924eucas1p23bed121ab289f68a56408d8d79c0df63~U4TGdJ_6P3227632276eucas1p2o; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 5A.9A.10014.3A255346; Tue, 11 Apr 2023 13:29:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f~U4TGDwBJQ1913619136eucas1p1q; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230411122923eusmtrp21cfb01c80494ecf51988510dd7078da0~U4TGCeyKw0100601006eusmtrp2n; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) X-AuditID: cbfec7f5-b8bff7000000271e-07-643552a3af96 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 7B.58.22108.3A255346; Tue, 11 Apr 2023 13:29:23 +0100 (BST) Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230411122923eusmtip2e2017259e26006e17d70d3dee3efbbc0~U4TF2Bbap1393113931eusmtip22; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) From: Pankaj Raghav To: hubcap@omnibond.com, brauner@kernel.org, martin@omnibond.com, willy@infradead.org, hch@lst.de, minchan@kernel.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, akpm@linux-foundation.org, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, mcgrof@kernel.org, Pankaj Raghav Subject: [PATCH v3 2/3] mpage: split submit_bio and bio end_io handler for reads and writes Date: Tue, 11 Apr 2023 14:29:19 +0200 Message-Id: <20230411122920.30134-3-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411122920.30134-1-p.raghav@samsung.com> MIME-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11ytqsh5dy552rFpL/2O9 aaM7r8fxF9aiCUuSdysXKi8r0qprUXZ8W790L7/Zk4tp4hyntFIXqpx9uHPe9V9/X1XyVK1Z WGEUaj2rZLXYjkPH7vO8DWhYmTO1xTn1hNPfHfLXL78L2pG4dKH1kh83L4Z0fg7Nrrit2ua6 5UXzI1aDvxfYs8MtLYMV3ly/dFj+6VR/V8ZEvlt/WTqqFPh/dal6R7jXrd+WX5Aes/OhXeyH v5tWz3lpY5B0U+Dr4snzM/pqzh2Z2hI5s1aJpTgj0VCLuag4EQBqd7ZaagMAAA== X-CMS-MailID: 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f X-Msg-Generator: CA X-RootMTR: 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122923eucas1p1dfc182a2c785eeb362b9d670dfe3ba2f References: <20230411122920.30134-1-p.raghav@samsung.com> X-Rspamd-Queue-Id: 1758910000A X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: qsgjk7rzhgce4fpxuoazoiqkt9get5ig X-HE-Tag: 1681216167-866891 X-HE-Meta: U2FsdGVkX19g1Tpfkyc36ouNbymHBApCKpDXnDtza3xMSEtCi3DhU0/eNDrlUrD7XDsaHJ5a+q/T38dFHZ1c5tPMnQrfh/rphZHPv2H/29bL7BAbbPjTi7EKC4hxN7ubsRE8VG4zp8ZvDSAD92ihjpD26XXbTTc207uBqyGOv9V+hBNg4KXJddK6gWYZiHpAcU1GhCIOk8R1PMGJpbu7Ybvm/xO2r+ylKTTGLPCVmDIvRTYzN+OLxTzfMHL6dEYqmFneaYPRDqQz/AOrg46XiJyAfec7OWGTpZtI414mmaiIvM6SHJF1dlubKolWSscK3AsTRA+U5uno2lcEOyP9auYhc48p/f4ivzw5zn9aGOQzg1EIc9BFk/XvEvYQXL7DfIT64ayhNZ0Ts2up6vLbqcnH3qCreDXciT1pVAAMgxlohLeu9P7mz9as1PQnUTJESG3S1TA9OrhwQLAjTmz2zkLi+m5toTTSMrDKAZqOkQnjsKdvoqM3VPLvcafwmGFtlKqsPv7r1gD4OHz5EmFQYGrMSMJfe13uYFR1gVBhdoMatG6weDtcfZJrPGt44Mbbhbi2V+8CqplsXxiHewIWEManTE+Or4GFioLkifY2PagfEBVX1v1vuam/pBkQbLD32D6g26fOwETpvGXeNbMT6L+RU61OQFabuV+iD90eMO4GHMGPigAptf+EVK4QHzkH+sqlW5MLbfdAL+wmpxHxPZoBiweDERfyRvbg0npIasCFy3MKA9LEb39QstF2hx3eLY4bkjS7wzGbx5LBd7vNT3aIJYcC988jvEyqCFNcB9ki+oLLadFYuvnF/ZXX+Aqbf5gFkRWtP7EokVeiZbv2dQf+3wyJYN8eiP8tzk6/UAwdoUn2nZXuqxpDmIML3h6Wk3DfuFwpSMYSshT47cx7zjsueez2G4qFw8ao9nP6Nyo2u0wUj9G8413FEv3aR05FXzALCvIw4u8gXIvUNgX QNnXq56T pK2V96tnb8nwUuIjXaXWIzcVqFxgUfc90RpRTGAw6cXQWq1bLYA7b7dwYbN51wVtxI7ycFE76TIonfsLcQYKkcpiBovl/g8r3hpnNI1NwCcVSurjO7rSj8oS8DId9GF8Kr5lREMAhv+0cRd9YiKoCTlYXsQiHMfE96qyT X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Split the submit_bio() and bio end_io handler for reads and writes similar to other aops. This is a prep patch before we convert end_io handlers to use folios. Suggested-by: Christoph Hellwig Signed-off-by: Pankaj Raghav Reviewed-by: Christoph Hellwig --- fs/mpage.c | 54 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index 22b9de5ddd68..d9540c1b7427 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -43,23 +43,41 @@ * status of that page is hard. See end_buffer_async_read() for the details. * There is no point in duplicating all that complexity. */ -static void mpage_end_io(struct bio *bio) +static void mpage_read_end_io(struct bio *bio) { struct bio_vec *bv; struct bvec_iter_all iter_all; - bio_for_each_segment_all(bv, bio, iter_all) { - struct page *page = bv->bv_page; - page_endio(page, bio_op(bio), + bio_for_each_segment_all(bv, bio, iter_all) + page_endio(bv->bv_page, REQ_OP_READ, blk_status_to_errno(bio->bi_status)); - } bio_put(bio); } -static struct bio *mpage_bio_submit(struct bio *bio) +static void mpage_write_end_io(struct bio *bio) { - bio->bi_end_io = mpage_end_io; + struct bio_vec *bv; + struct bvec_iter_all iter_all; + + bio_for_each_segment_all(bv, bio, iter_all) + page_endio(bv->bv_page, REQ_OP_WRITE, + blk_status_to_errno(bio->bi_status)); + + bio_put(bio); +} + +static struct bio *mpage_bio_submit_read(struct bio *bio) +{ + bio->bi_end_io = mpage_read_end_io; + guard_bio_eod(bio); + submit_bio(bio); + return NULL; +} + +static struct bio *mpage_bio_submit_write(struct bio *bio) +{ + bio->bi_end_io = mpage_write_end_io; guard_bio_eod(bio); submit_bio(bio); return NULL; @@ -265,7 +283,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) * This folio will go to BIO. Do we need to send this BIO off first? */ if (args->bio && (args->last_block_in_bio != blocks[0] - 1)) - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); alloc_new: if (args->bio == NULL) { @@ -278,7 +296,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) length = first_hole << blkbits; if (!bio_add_folio(args->bio, folio, length, 0)) { - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); goto alloc_new; } @@ -286,7 +304,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) nblocks = map_bh->b_size >> blkbits; if ((buffer_boundary(map_bh) && relative_block == nblocks) || (first_hole != blocks_per_page)) - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); else args->last_block_in_bio = blocks[blocks_per_page - 1]; out: @@ -294,7 +312,7 @@ static struct bio *do_mpage_readpage(struct mpage_readpage_args *args) confused: if (args->bio) - args->bio = mpage_bio_submit(args->bio); + args->bio = mpage_bio_submit_read(args->bio); if (!folio_test_uptodate(folio)) block_read_full_folio(folio, args->get_block); else @@ -356,7 +374,7 @@ void mpage_readahead(struct readahead_control *rac, get_block_t get_block) args.bio = do_mpage_readpage(&args); } if (args.bio) - mpage_bio_submit(args.bio); + mpage_bio_submit_read(args.bio); } EXPORT_SYMBOL(mpage_readahead); @@ -373,7 +391,7 @@ int mpage_read_folio(struct folio *folio, get_block_t get_block) args.bio = do_mpage_readpage(&args); if (args.bio) - mpage_bio_submit(args.bio); + mpage_bio_submit_read(args.bio); return 0; } EXPORT_SYMBOL(mpage_read_folio); @@ -577,7 +595,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, * This page will go to BIO. Do we need to send this BIO off first? */ if (bio && mpd->last_block_in_bio != blocks[0] - 1) - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); alloc_new: if (bio == NULL) { @@ -596,7 +614,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, wbc_account_cgroup_owner(wbc, &folio->page, folio_size(folio)); length = first_unmapped << blkbits; if (!bio_add_folio(bio, folio, length, 0)) { - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); goto alloc_new; } @@ -606,7 +624,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, folio_start_writeback(folio); folio_unlock(folio); if (boundary || (first_unmapped != blocks_per_page)) { - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); if (boundary_block) { write_boundary_block(boundary_bdev, boundary_block, 1 << blkbits); @@ -618,7 +636,7 @@ static int __mpage_writepage(struct folio *folio, struct writeback_control *wbc, confused: if (bio) - bio = mpage_bio_submit(bio); + bio = mpage_bio_submit_write(bio); /* * The caller has a ref on the inode, so *mapping is stable @@ -652,7 +670,7 @@ mpage_writepages(struct address_space *mapping, blk_start_plug(&plug); ret = write_cache_pages(mapping, wbc, __mpage_writepage, &mpd); if (mpd.bio) - mpage_bio_submit(mpd.bio); + mpage_bio_submit_write(mpd.bio); blk_finish_plug(&plug); return ret; } From patchwork Tue Apr 11 12:29:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Raghav X-Patchwork-Id: 13207508 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADD8BC77B77 for ; Tue, 11 Apr 2023 12:29:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C34AB6B007B; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE5716B007D; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E85E6B007E; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 9068F6B007B for ; Tue, 11 Apr 2023 08:29:31 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 66F50ABCAB for ; Tue, 11 Apr 2023 12:29:31 +0000 (UTC) X-FDA: 80669040942.08.9363CDC Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by imf17.hostedemail.com (Postfix) with ESMTP id CCB284000C for ; Tue, 11 Apr 2023 12:29:28 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=k6k7bPGM; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf17.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681216169; h=from:from:sender: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:dkim-signature; bh=1qC6zHvAgcTgYm8ljFpJs+7FVJXDek+LLyQQCiQNxfg=; b=75fr8Vgj9ichGlfL1v31QLl4mbr9+yOI8fxSZ32mCaKlDiUzMFctkD1pRcz8DlYF95TCE3 yo2m6SnQv/9VyrMAtvfDPLQRiuNGMyK7fLcXMhrrgKc3mD1415a+EmREi7sJWLjMzMSzP6 sFVophpNhXrT3AA/wgKQmw2XiFENWwY= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=samsung.com header.s=mail20170921 header.b=k6k7bPGM; dmarc=pass (policy=none) header.from=samsung.com; spf=pass (imf17.hostedemail.com: domain of p.raghav@samsung.com designates 210.118.77.11 as permitted sender) smtp.mailfrom=p.raghav@samsung.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681216169; a=rsa-sha256; cv=none; b=tzafpvFKQA0AYDsatA+AcAsUQ+7mVezcE31WEWNJ2F2H9SziJ308Js5UKRogNauC9Dtfup J/J4hTr4LKZbKWEXqaZ7w//96ZKRMEKrQpzm1Mz+/Ki5wHC2/zf+tYhzQ9DOQHGCERhTrP I4DGX48sqZ2rEVrqyW6bg6mTEgvEze0= Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230411122926euoutp01e96da30d9594402c24ee8dd1b45c313c~U4TIk-all0506105061euoutp01R for ; Tue, 11 Apr 2023 12:29:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230411122926euoutp01e96da30d9594402c24ee8dd1b45c313c~U4TIk-all0506105061euoutp01R DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1681216166; bh=1qC6zHvAgcTgYm8ljFpJs+7FVJXDek+LLyQQCiQNxfg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k6k7bPGMEm2WHoEuC8ctkZLXXHIOTQHQqoV82xAuO9/lme4BfzpuXcLwM22tTO2wG L3UTTJPx6bmJ5ObCRUWkgAaYB1PogBSfjKjSwToyDIL80kxUwhaOZn2anIaaf4esh3 /HVXMrUTHDMOG6Y1maEiN1Ktyk/5rrfuuZnaq0Po= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230411122924eucas1p2a842969709d6b49b03f7c346bb6d7103~U4THBHNHL3227732277eucas1p2w; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 8E.9A.10014.4A255346; Tue, 11 Apr 2023 13:29:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d~U4TGnGH0t0202002020eucas1p1Q; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230411122924eusmtrp241d6a59a92a6a323b6b491c16e7e34ca~U4TGmSAGr0100601006eusmtrp2p; Tue, 11 Apr 2023 12:29:24 +0000 (GMT) X-AuditID: cbfec7f5-ba1ff7000000271e-0a-643552a43e97 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 1D.58.22108.4A255346; Tue, 11 Apr 2023 13:29:24 +0100 (BST) Received: from localhost (unknown [106.210.248.243]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230411122924eusmtip2237fca85463f83e9b9eeb88cf4b5bc78~U4TGX3VXf1077210772eusmtip2d; Tue, 11 Apr 2023 12:29:23 +0000 (GMT) From: Pankaj Raghav To: hubcap@omnibond.com, brauner@kernel.org, martin@omnibond.com, willy@infradead.org, hch@lst.de, minchan@kernel.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, akpm@linux-foundation.org, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, devel@lists.orangefs.org, linux-fsdevel@vger.kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, mcgrof@kernel.org, Pankaj Raghav Subject: [PATCH v3 3/3] mpage: use folios in bio end_io handler Date: Tue, 11 Apr 2023 14:29:20 +0200 Message-Id: <20230411122920.30134-4-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411122920.30134-1-p.raghav@samsung.com> MIME-Version: 1.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrJKsWRmVeSWpSXmKPExsWy7djP87pLgkxTDG4vUrOYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4 MeEpo8Wyr+/ZLT4vbWG32L1xEZvF+b/HWS1+/5jD5iDkMbvhIovH5hVaHpfPlnpsWtXJ5rHp 0yR2jxMzfrN4NEy9xeax+2YDm8ev23dYPfq2rGL0+LxJzmPTk7dMATxRXDYpqTmZZalF+nYJ XBmfVs5iKTjAU7FhzgbGBsb5XF2MnBwSAiYSzdeesHUxcnEICaxglLh64wiU84VR4tWerSwQ zmdGiRcb7zHBtDx+8h2qajmjxOIFR6Gcl4wS70+uYOxi5OBgE9CSaOxkB4mLCNxilFjw+Qoj iMMscJ9R4uGtU+wgo4QF7CWm/lrEDGKzCKhK/Hu+AWwF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UNLCz0jE0s9Q2PzWCsjUyV9O5uU1JzMstQifbsEvYxPK2exFBzgqdgwZwNjA+N8 ri5GTg4JAROJx0++s3UxcnEICSxllJg/7QUbREJC4vbCJkYIW1jiz7UuqKLnjBIL52xj7WLk 4GAT0JJo7GQHiYsIPGOUmL1hCytIAzNI0a9HvCC2sIC9xNRfi5hBbBYBVYl/zzcwgdi8ApYS c7Y/Z4JYIC+x/+BZsBpOASuJ1as+gC0WAqq50D6PFaJeUOLkzCcsEPPlJZq3zmaewCgwC0lq FpLUAkamVYwiqaXFuem5xYZ6xYm5xaV56XrJ+bmbGIExvO3Yz807GOe9+qh3iJGJg/EQowQH s5II7w8X0xQh3pTEyqrUovz4otKc1OJDjKZAd09klhJNzgcmkbySeEMzA1NDEzNLA1NLM2Ml cV7Pgo5EIYH0xJLU7NTUgtQimD4mDk6pBqZ644a9izas16pqZj209yzDXsk63we8Vq+UDWf+ uj858OvviVEyD5tS7nZNkEuSCPhzeGtvxZsE4Vsf8+aKfeq4qcv5YnFx9SYvscVmCpKdy6Pu Ofov8JZxiPz2LnZFTMI3b8lLLm+nvhNJd5dfobXNyCVgJou70brwfdcZ8nUMs3qK0oMyJnFo 2J9VUFW/xpDeu0T4aMGvpWVW4hW/6pf89MvfISCd+Lb67WOPomwfjsA5Hg7XPvYwq3CEmnu/ mvc8R/l88+U8bd79nIcWWeVu81I5pPOIz9n/bPVRW7t/c+bYZ5s9WLCa89wnNw6v/YJ+zEVT Jy7eNI+l7/VSw4/fLmy9vGnpD/lbzHfNtymxFGckGmoxFxUnAgCIKuLiagMAAA== X-CMS-MailID: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d X-Msg-Generator: CA X-RootMTR: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230411122924eucas1p16c6abcf91a3e04c6a0a225606ca0044d References: <20230411122920.30134-1-p.raghav@samsung.com> X-Rspamd-Queue-Id: CCB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Y5MayNcB ny1EP8evymqO9vdcmzgVVDobMW6W/Lr+4jrpTzywitbaXRnulVA5YlwxDncA0o7O9pwtKY7M87J/k5T489+nHeMCj16FhCvc3bak8AJRwwyyUInh9q5EoIVUuMJ1ysc3sGcO69p6Nn71VtxreWjnr35qQ7whPmP9cUWhI X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Use folios in the bio end_io handler. This conversion does the appropriate handling on the folios in the respective end_io callback and removes the call to page_endio(), which is soon to be removed. Signed-off-by: Pankaj Raghav Reviewed-by: Christoph Hellwig --- fs/mpage.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/fs/mpage.c b/fs/mpage.c index d9540c1b7427..242e213ee064 100644 --- a/fs/mpage.c +++ b/fs/mpage.c @@ -45,24 +45,32 @@ */ static void mpage_read_end_io(struct bio *bio) { - struct bio_vec *bv; - struct bvec_iter_all iter_all; + struct folio_iter fi; + int err = blk_status_to_errno(bio->bi_status); - bio_for_each_segment_all(bv, bio, iter_all) - page_endio(bv->bv_page, REQ_OP_READ, - blk_status_to_errno(bio->bi_status)); + bio_for_each_folio_all(fi, bio) { + if (err) + folio_set_error(fi.folio); + else + folio_mark_uptodate(fi.folio); + folio_unlock(fi.folio); + } bio_put(bio); } static void mpage_write_end_io(struct bio *bio) { - struct bio_vec *bv; - struct bvec_iter_all iter_all; + struct folio_iter fi; + int err = blk_status_to_errno(bio->bi_status); - bio_for_each_segment_all(bv, bio, iter_all) - page_endio(bv->bv_page, REQ_OP_WRITE, - blk_status_to_errno(bio->bi_status)); + bio_for_each_folio_all(fi, bio) { + if (err) { + folio_set_error(fi.folio); + mapping_set_error(fi.folio->mapping, err); + } + folio_end_writeback(fi.folio); + } bio_put(bio); }