Message ID | 20230403132221.94921-2-p.raghav@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2313476vqo; Mon, 3 Apr 2023 06:45:07 -0700 (PDT) X-Google-Smtp-Source: AKy350a6+xYFgw2HqF3twMeM03HWil4qS1ObDlkEMs1GhPDctPxsgB59KtVwUbNOmpF9+686w8Mk X-Received: by 2002:aa7:c449:0:b0:4fd:298a:62cb with SMTP id n9-20020aa7c449000000b004fd298a62cbmr15594519edr.21.1680529507164; Mon, 03 Apr 2023 06:45:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680529507; cv=none; d=google.com; s=arc-20160816; b=jttqREiwRlM0f9f4LqgdjYT1xoAt7btSCc82doBY8T25FCnrrUW1P3wEZyEOq8CU9e tsbgh/M7d9lD8zHYu0WJn4LStRvmGtUILr9p+SDCRKqQ/pV0Vioo+2uqOBr2Aqj9SUer lj7/gl2wmwEaB7fSH2kAub6yftl02N4zGk2MGBozULjlV5CkqBrZhmaskFjsj4662ShT Wmdf0PSUUx884kx0hAMZik84eFysg0PhTbhmSBmAY0MFlmTVV5zUq3kcXzaTzQ72+/84 21hGqtFadOZ0cfp3OuyGK1uxo9ndF6TheWpiKo4+MZLfx4AAxprJyrtDHNX2H5pNrsZK rbGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=r3yJCwvgy++or0tEjkGksO6JgkEF47Bw1cuUMKfgKoM=; b=0UL7YwV2ZeTVym7XDYFPZeaDsdzjOnNNYGSbSDi7eMeioyHRiv32EuSgXjoxwERl2Q dtE4I+NNroFLAqgI/5d+OdDlJd3f03vtJ0y8+grz+vn1V7HpwufJb3zuu6T5hIsStWDQ ypj7nX/ir7AHHakGHc3apUJA5fxlWvtHAwe1UPzT6G2k6bHxw67wxmUWfG0YmAsf0mU2 xkIiMqwW148Uipw0vK5zut4PTudysh4YH3brlRuQuPn9kuhocxD3AYDj3+jXI0D8gTM6 UIeOMa8EHPWYD3MsxoihHHGcHeP9vKhTS84tvIKHrmU/BWQ1iHDCYMMOwr7k0qv0AfdJ HjuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=fWltD6Kk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d6-20020aa7d686000000b004bff6dee492si3396226edr.149.2023.04.03.06.44.43; Mon, 03 Apr 2023 06:45:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=fWltD6Kk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232531AbjDCNWh (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 3 Apr 2023 09:22:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232401AbjDCNWb (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 3 Apr 2023 09:22:31 -0400 Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com [210.118.77.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E5BCDC145 for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 06:22:28 -0700 (PDT) Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20230403132225euoutp01970b1b001b2674e1d1df2c016899b91b~Sb3HpH6pV1586215862euoutp019 for <linux-kernel@vger.kernel.org>; Mon, 3 Apr 2023 13:22:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20230403132225euoutp01970b1b001b2674e1d1df2c016899b91b~Sb3HpH6pV1586215862euoutp019 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1680528146; bh=r3yJCwvgy++or0tEjkGksO6JgkEF47Bw1cuUMKfgKoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fWltD6KkZIQiLs6rw7FKqP0kHRAAW0lYwBmUNzefo4Vc5oXK4N7RNkDQibfTOfl7Z I/0o0jF3ciGeBau/sXEVvO9q6x1elNyuG0Iaer1trBR7e4ZITxAThf1z4eDtnOkLRn 8miNtIU3MXpzqC/SC9TgDLLQvc94kF8B/bkHURvA= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230403132224eucas1p27eef4cb0f80d1f84327e722cb3e4bc85~Sb3GIBA7H2688526885eucas1p2U; Mon, 3 Apr 2023 13:22:24 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id CA.F2.09966.013DA246; Mon, 3 Apr 2023 14:22:24 +0100 (BST) Received: from eusmtrp2.samsung.com (unknown [182.198.249.139]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f~Sb3FmBsJj2689126891eucas1p2k; Mon, 3 Apr 2023 13:22:23 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230403132223eusmtrp210c81c0bd1e7b9dfa5cc043be99aaf05~Sb3FlI5ir0199801998eusmtrp2f; Mon, 3 Apr 2023 13:22:23 +0000 (GMT) X-AuditID: cbfec7f4-d4fff700000026ee-44-642ad3104b1c Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id AC.16.08862.F03DA246; Mon, 3 Apr 2023 14:22:23 +0100 (BST) Received: from localhost (unknown [106.210.248.30]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230403132223eusmtip1f594e7a855855fa3ec15e1be498a2f26~Sb3FXqusJ2519425194eusmtip1C; Mon, 3 Apr 2023 13:22:23 +0000 (GMT) From: Pankaj Raghav <p.raghav@samsung.com> To: axboe@kernel.dk, minchan@kernel.org, martin@omnibond.com, hubcap@omnibond.com, brauner@kernel.org, viro@zeniv.linux.org.uk, senozhatsky@chromium.org, akpm@linux-foundation.org, willy@infradead.org, hch@lst.de Cc: devel@lists.orangefs.org, mcgrof@kernel.org, linux-block@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, gost.dev@samsung.com, linux-fsdevel@vger.kernel.org, Pankaj Raghav <p.raghav@samsung.com> Subject: [PATCH v2 1/5] zram: always chain bio to the parent in read_from_bdev_async Date: Mon, 3 Apr 2023 15:22:17 +0200 Message-Id: <20230403132221.94921-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230403132221.94921-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7djP87oCl7VSDJa8FrKYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4 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MdspfD6Jt2ds fPopP2/5+SW3p3CIWzyRvvpE/NnV2Mb7l6KOb2pbc5DD1GeJ38qXb4280hesCtvzKtNPm+ma mFZJs0pm4d39L3dXz363NH3/4R0ywe7ZPHoPfTl+KrEUZyQaajEXFScCAJm7B9lqAwAA X-CMS-MailID: 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f References: <20230403132221.94921-1-p.raghav@samsung.com> <CGME20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f@eucas1p2.samsung.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762162908438784215?= X-GMAIL-MSGID: =?utf-8?q?1762162908438784215?= |
Series |
remove page_endio()
|
|
Commit Message
Pankaj Raghav
April 3, 2023, 1:22 p.m. UTC
zram_bvec_read() is called with the bio set to NULL only in
writeback_store() function. When a writeback is triggered,
zram_bvec_read() is called only if ZRAM_WB flag is not set. That will
result only calling zram_read_from_zspool() in __zram_bvec_read().
rw_page callback used to call read_from_bdev_async with a NULL parent
bio but that has been removed since commit 3222d8c2a7f8
("block: remove ->rw_page").
We can now safely always call bio_chain() as read_from_bdev_async() will
be called with a parent bio set. A WARN_ON_ONCE is added if this function
is called with parent set to NULL.
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
drivers/block/zram/zram_drv.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
Comments
On Mon, Apr 03, 2023 at 03:22:17PM +0200, Pankaj Raghav wrote: > zram_bvec_read() is called with the bio set to NULL only in > writeback_store() function. When a writeback is triggered, > zram_bvec_read() is called only if ZRAM_WB flag is not set. That will > result only calling zram_read_from_zspool() in __zram_bvec_read(). > > rw_page callback used to call read_from_bdev_async with a NULL parent > bio but that has been removed since commit 3222d8c2a7f8 > ("block: remove ->rw_page"). > > We can now safely always call bio_chain() as read_from_bdev_async() will > be called with a parent bio set. A WARN_ON_ONCE is added if this function > is called with parent set to NULL. > > Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> Acked-by: Minchan Kim <minchan@kernel.org> Thanks.
On Mon, Apr 03, 2023 at 03:22:17PM +0200, Pankaj Raghav wrote: > zram_bvec_read() is called with the bio set to NULL only in > writeback_store() function. When a writeback is triggered, > zram_bvec_read() is called only if ZRAM_WB flag is not set. That will > result only calling zram_read_from_zspool() in __zram_bvec_read(). > > rw_page callback used to call read_from_bdev_async with a NULL parent > bio but that has been removed since commit 3222d8c2a7f8 > ("block: remove ->rw_page"). > > We can now safely always call bio_chain() as read_from_bdev_async() will > be called with a parent bio set. A WARN_ON_ONCE is added if this function > is called with parent set to NULL. I'm pretty sure this is wrong. I've now sent a series to untangle and fix up the zram I/O path, which should address the underlying issue here. It will obviously conflict with this patch, so maybe the best thing is to get the other page_endio removals into their respective maintainer trees, and then just do the final removal of the unused function after -rc1.
On Tue, 4 Apr 2023 08:06:55 -0700 Christoph Hellwig <hch@infradead.org> wrote: > On Mon, Apr 03, 2023 at 03:22:17PM +0200, Pankaj Raghav wrote: > > zram_bvec_read() is called with the bio set to NULL only in > > writeback_store() function. When a writeback is triggered, > > zram_bvec_read() is called only if ZRAM_WB flag is not set. That will > > result only calling zram_read_from_zspool() in __zram_bvec_read(). > > > > rw_page callback used to call read_from_bdev_async with a NULL parent > > bio but that has been removed since commit 3222d8c2a7f8 > > ("block: remove ->rw_page"). > > > > We can now safely always call bio_chain() as read_from_bdev_async() will > > be called with a parent bio set. A WARN_ON_ONCE is added if this function > > is called with parent set to NULL. > > I'm pretty sure this is wrong. Thanks, I'll drop this v2 series. > I've now sent a series to untangle > and fix up the zram I/O path, which should address the underlying > issue here. I can't find that series. > It will obviously conflict with this patch, so maybe the best thing is > to get the other page_endio removals into their respective maintainer > trees, and then just do the final removal of the unused function after > -rc1.
On Tue, Apr 04, 2023 at 12:31:31PM -0700, Andrew Morton wrote: > > I've now sent a series to untangle > > and fix up the zram I/O path, which should address the underlying > > issue here. > > I can't find that series. https://lore.kernel.org/linux-block/20230404150536.2142108-1-hch@lst.de/T/#t
> > It will obviously conflict with this patch, so maybe the best thing is > to get the other page_endio removals into their respective maintainer > trees, and then just do the final removal of the unused function after > -rc1. Alright, I will drop the last patch that removes the page_endio function, and send it after rc1. I will make the other changes as suggested by you.
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 3feadfb96114..d16d0630b178 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -606,15 +606,6 @@ static void free_block_bdev(struct zram *zram, unsigned long blk_idx) atomic64_dec(&zram->stats.bd_count); } -static void zram_page_end_io(struct bio *bio) -{ - struct page *page = bio_first_page_all(bio); - - page_endio(page, op_is_write(bio_op(bio)), - blk_status_to_errno(bio->bi_status)); - bio_put(bio); -} - /* * Returns 1 if the submission is successful. */ @@ -634,11 +625,10 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, return -EIO; } - if (!parent) - bio->bi_end_io = zram_page_end_io; - else - bio_chain(bio, parent); + if (WARN_ON_ONCE(!parent)) + return -EINVAL; + bio_chain(bio, parent); submit_bio(bio); return 1; }