From patchwork Mon Apr 3 13:22:17 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Pankaj Raghav
X-Patchwork-Id: 13198169
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 AE92AC77B62
for ; Mon, 3 Apr 2023 13:22:39 +0000 (UTC)
Received: by kanga.kvack.org (Postfix)
id 15EB9900004; Mon, 3 Apr 2023 09:22:33 -0400 (EDT)
Received: by kanga.kvack.org (Postfix, from userid 40)
id C95906B0078; Mon, 3 Apr 2023 09:22:32 -0400 (EDT)
X-Delivered-To: int-list-linux-mm@kvack.org
Received: by kanga.kvack.org (Postfix, from userid 63042)
id 8931E900002; Mon, 3 Apr 2023 09:22:32 -0400 (EDT)
X-Delivered-To: linux-mm@kvack.org
Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com
[216.40.44.14])
by kanga.kvack.org (Postfix) with ESMTP id 5FCDE900003
for ; Mon, 3 Apr 2023 09:22:32 -0400 (EDT)
Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1])
by unirelay05.hostedemail.com (Postfix) with ESMTP id 1F3E240B0B
for ; Mon, 3 Apr 2023 13:22:32 +0000 (UTC)
X-FDA: 80640144144.13.C5EFCD0
Received: from mailout1.w1.samsung.com (mailout1.w1.samsung.com
[210.118.77.11])
by imf26.hostedemail.com (Postfix) with ESMTP id 2D61914001C
for ; Mon, 3 Apr 2023 13:22:27 +0000 (UTC)
Authentication-Results: imf26.hostedemail.com;
dkim=pass header.d=samsung.com header.s=mail20170921 header.b=JhANKrSk;
dmarc=pass (policy=none) header.from=samsung.com;
spf=pass (imf26.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=1680528148;
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=r3yJCwvgy++or0tEjkGksO6JgkEF47Bw1cuUMKfgKoM=;
b=8KN+Ro8Mr6x/oYm9kNHaUIEsFjj+9UJ81en49UoQAcodMb/ttwRrXerD+MWq5KZUnBi50K
j8QmH4kPpn6182RVYMngg0+XPgjsCVdoy3G/dM7JJPAgp3vWjVtNnfVmgN25XNdGbZgFR2
+PoU7LdHq5D0gPbd+TGbA2Rf6qJNw5U=
ARC-Authentication-Results: i=1;
imf26.hostedemail.com;
dkim=pass header.d=samsung.com header.s=mail20170921 header.b=JhANKrSk;
dmarc=pass (policy=none) header.from=samsung.com;
spf=pass (imf26.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=1680528148; a=rsa-sha256;
cv=none;
b=ah33UegYvcmtBmZisRzKfyWn/sJgDjFmvrzBSvc0m6lza8FFPL5uM743ev/2kLaQKlzQZo
U/2VLzRb7o1e+PJbQQwhtRnCht/ta/gXNQDLE3kOtWhLk/iZNjduz5xFiCHjjj+SDMSkUr
+C4KyHfKJ/ge2Bfft9t+kBrB6NrukuM=
Received: from eucas1p1.samsung.com (unknown [182.198.249.206])
by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id
20230403132225euoutp013d3088c14843bd4621716cb6f2d210dc~Sb3HmqSBu1624016240euoutp01D
for ; Mon, 3 Apr 2023 13:22:25 +0000 (GMT)
DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com
20230403132225euoutp013d3088c14843bd4621716cb6f2d210dc~Sb3HmqSBu1624016240euoutp01D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com;
s=mail20170921; t=1680528145;
bh=r3yJCwvgy++or0tEjkGksO6JgkEF47Bw1cuUMKfgKoM=;
h=From:To:Cc:Subject:Date:In-Reply-To:References:From;
b=JhANKrSkrLa1IQ1mQtDKoTkw/o7N5fvkDkWocOPgATDcH+7WkAcsiu6yJOIgxbAIS
p73vKRyFFsGDV0PDEcVX0vhesyjo7qtm9QUSYgnk9jYzJAtZMDmtWgpRldg5/zZuA1
OR+6T4iSmzo6hv2qKxQcOJMjgl2FBwnBXRap5B0s=
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
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
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
X-Brightmail-Tracker:
H4sIAAAAAAAAA+NgFnrGKsWRmVeSWpSXmKPExsWy7djP87oCl7VSDJa8FrKYs34Nm8Xqu/1s
Fq8Pf2K02L95CpPFzQM7mSxWrj7KZNF+t4/JYu8tbYs9e0+yWFzeNYfN4t6a/6wWJ9f/Z7a4
MeEpo8Wyr+/ZLT4vbWG32L1xEZvF+b/HWS1+/5jD5iDkMbvhIovH5hVaHpfPlnpsWtXJ5rHp
0yR2jxMzfrN4NEy9xeax+2YDm8ev23dYPfq2rGL0+LxJzmPTk7dMATxRXDYpqTmZZalF+nYJ
XBmTXn5kKdjNWzGzZQtrA+Mk7i5GTg4JAROJ3guTGEFsIYEVjBJff9d2MXIB2V8YJc7N+MwI
4XxmlJj9YzMrTMfXKUuYIRLLGSVeHf7OBuG8YJTYtekTkMPBwSagJdHYyQ4SFxG4xSjxpmc2
E4jDLHCfUWLe7r1MIKOEBcIk9hzdzgJiswioSqzcc5AZpJlXwFLi7Q1TiG3yEvsPnmUGsTkF
r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tkrRhhZGeoaWFnpGJpZ6hsbmsVZGpkr6djYpqTmZZalF+nYJehmTXn5kKdjNWzGzZQtrA+Mk
7i5GTg4JAROJr1OWMHcxcnEICSxllOj9/p8JIiEhcXthEyOELSzx51oXG0TRM0aJv+efsnYx
cnCwCWhJNHayg8RFQOLLLhxnAXGYBZ4zSqyZ8psZpFtYIERi7eZDbCA2i4CqxMo9B5lBmnkF
LCXe3jCFWCAvsf/gWbByTgEricbpc8EWCwGVfL14ixXE5hUQlDg58wkLiM0MVN+8dTbzBEaB
WUhSs5CkFjAyrWIUSS0tzk3PLTbUK07MLS7NS9dLzs/dxAiM4W3Hfm7ewTjv1Ue9Q4xMHIyH
GCU4mJVEeFW7tFKEeFMSK6tSi/Lji0pzUosPMZoCnT2RWUo0OR+YRPJK4g3NDEwNTcwsDUwt
zYyVxHk9CzoShQTSE0tSs1NTC1KLYPqYODilGpj6bNMVbC+WRxj7Lbgs83CpTrNKVGXel5uu
m59kHZrMHs71ecXPc+GXpe83vX7z/Y2a9WTu9Qbb+rcx7nM7K/3H5FlOz5E11yelSnw3War1
57KmHPPBJ8ozez9tePon5KPl4tUSN2pKNfM7f367kdMcMXGflfCCndtzVF/EaUlY3963IWdr
Ne+TP4LeYrt/8qlcFOWa1s6bvTXqeo5wvdSjTU86tfYI7q7qV53NeDmE58B+MdspfD6Jt2ds
fPopP2/5+SW3p3CIWzyRvvpE/NnV2Mb7l6KOb2pbc5DD1GeJ38qXb4280hesCtvzKtNPm+ma
mFZJs0pm4d39L3dXz363NH3/4R0ywe7ZPHoPfTl+KrEUZyQaajEXFScCAJm7B9lqAwAA
X-CMS-MailID: 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f
X-Msg-Generator: CA
X-RootMTR: 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f
X-EPHeader: CA
CMS-TYPE: 201P
X-CMS-RootMailID: 20230403132223eucas1p2a27e8239b8bda4fc16b675a9473fd61f
References: <20230403132221.94921-1-p.raghav@samsung.com>
X-Rspam-User:
X-Rspamd-Server: rspam02
X-Rspamd-Queue-Id: 2D61914001C
X-Stat-Signature: ksma6rdp15f9gkf9kz8osk4bnga17ajq
X-HE-Tag: 1680528147-292277
X-HE-Meta:
U2FsdGVkX1+YEzwNc4223wk/W0iKcMjuWdi6/Lh2JzGk7s5XDPlKpVIoKC7oSre3Vsft3wvB95x6TBLfdshrhUdnpv1grhje3jK/zY6uLzQFc+oyy68OCKnXh2O+YgnCSOEtLbmxKRG0PvYD98GFQJmSn4tILI1BI9bck6fTZ5/F+SJTBZxDox70bb+hizGrGEAPav1bfwnn+b7qBC1k0nUCZlPeHyInSunO0slOvI3usQOffp0aYsp27w28QCBU2VbLpNMWgH0zDt6vt2/Y0LnzNhh16VQat6sFH9v+aBBX+oaofXz2zX+R/cmQoH15sivlnQ2bTgQHuXLhfaSAr+HP5w30kwUj2iIvsUojedHu5sctFI9Ic8fO8Ebn/wVDe5hiu44u0Tz0uNdvEJu6XKpNqw5ZPr2b/2JcLHD6ek03ehQabzvwC0afyOAQvIX2W29OOAQ3MBkigmgxZOCIDqfKL6wFrdrzwVu5xu8mHqMGJvPOk6AYTfymaM6jqlVHx+NsWAcpG9e+qy/YTJMcK0E2Lxcju+SBa9qfea1l2kV4TUCgCr9/RVeOYjhlyBd3GfFicLI75b28VhlpWBadlqQHQmPE6+yD9cUKXFI26GGc7Y8hhpniulxtfstBqBh6dzthMPUdelFFXkcQQjv/sxjcWz/cbVq6E2t/hQ7fV6to0KrJennR06CLpAkBZULgXPcYKTt/1ELuVlgAPWSU0QtkQN+34f7hy0R88zwBRUkyLvl3IVxB+rKyDuFMHQaAAl3oukLZa/bx5lKwBgMM/cq9Y0/mooIWC0N6tLj7+3QS3yDNjrMihc8SetT6vBTrXCt3hMI9QZ0awN9tVTH8AJrCIskhEeK/BwlNHgY+ipuJLhbA4SecJBEHQkRScEyotbtZfaiBAh05MWiFYN62Z3CkgNa6fUBluI0WWRC8bjYD2IHqZjTGjep8ETFk7LMAJQM2jI+AKgc+AAuFr+e
oZFJGjwt
dzDW5LqA4a8x8gnapRIkR6p4GWmmaoI6lppQgUJlVPMSPcSc228/8RgXVZQFdOcbVaY+Wozu/cOxp4pRZ56MCUVb5qzaOkLcWtFNAbONJTZsrLLo0fZFJoleXogzb4jsLjZZKX0bABO33iEKUhaT5VthKP2081yZKH0b5
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:
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
Acked-by: Minchan Kim
---
drivers/block/zram/zram_drv.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
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;
}