From patchwork Thu Apr 20 10:05:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13218310 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 F3365C77B78 for ; Thu, 20 Apr 2023 10:06:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E85790000D; Thu, 20 Apr 2023 06:06:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 070DC900002; Thu, 20 Apr 2023 06:06:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DDF7790000D; Thu, 20 Apr 2023 06:06:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CE9A4900002 for ; Thu, 20 Apr 2023 06:06:18 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AE71EC058D for ; Thu, 20 Apr 2023 10:06:18 +0000 (UTC) X-FDA: 80701339236.24.B202919 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by imf21.hostedemail.com (Postfix) with ESMTP id CE67A1C0011 for ; Thu, 20 Apr 2023 10:06:16 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681985176; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R6+NeAX2XCjGoXZTYs/vHx8pZBcBY0nCsbbwup4DNoY=; b=3ZJYBRCsMhYWnD0Kt31MNaZfMq6KM/2SxU7dpQ7uR3mZceh1SwliDWT3Tk5ReUZ++x5Nlg kMgDvonJXPOR5junCG9BnyuY3dj8/wCX6KnUgyRWBCncBEAo+z1Hd8wZUOCjsUZpljMd04 ffywVt0dYCz8p2H8MIwf/Oa48wuhm+U= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.128.44 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none) ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681985176; a=rsa-sha256; cv=none; b=gElBWIZieCeQrlfMV2SF3J16zFiiKcdesltNHq7ImtNOjIiXmnn3ggFiaeL3SRkp7zBOrH mmcFQ1nmFAv0dF/cYSl959U1exRmtsrCqKKRPQ0a1/fHDPgrRdYx3ZNnxBuuN1wcJnxwFB 9ebJjIBghPU0M2sSg/wIGaZwAaG3dHM= Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-3f173af665fso3391405e9.3 for ; Thu, 20 Apr 2023 03:06:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985175; x=1684577175; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=R6+NeAX2XCjGoXZTYs/vHx8pZBcBY0nCsbbwup4DNoY=; b=ayARhWH4U4uac9xDHIrosO/3+hJj3h6bAcb600JF8uVU1F609UALzURmKly/OKWmiZ uoZTrGzUBIAuvc3yn0ND/HcUWmJCzc531lode9vzY9f8LL6voPnTSqbl/HFdk6hhDL6L 5r+tgfgW/AUsWX+RJboNXXtICOrNFQ37H5e4wsYlD9LO3A4apJo+ctryggGfmP++IZKU gdjI4d0MBCpPoMRMtT90/FL1jU/Ea+qkXVJqak++6vSNpsVXX6EEMOQPtH0jhGyiBNrd gfz0ZcsTSndEhrKJ0AjOhi1EFBE67FvCrCAAWC0uzuutcVIGNjAaislj4+piWlf9YPxY 90qQ== X-Gm-Message-State: AAQBX9ccFAdosauSUE9mQWLYMwnwH5Bsz72AB6FSDK2xxUC2/NO2VUEt x1f7lqbmviP54w7zBTRjIkM= X-Google-Smtp-Source: AKy350aN3PsOr81dbQugpISlk+yjR+a+4/2N8Qu7GaXUJdAVlidoOhFCKUKxX0oN92RzWan4aBS9aQ== X-Received: by 2002:a5d:5957:0:b0:2f4:3b2c:1b2e with SMTP id e23-20020a5d5957000000b002f43b2c1b2emr951041wri.31.1681985175440; Thu, 20 Apr 2023 03:06:15 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-208.dynamic.mnet-online.de. [62.216.205.208]) by smtp.googlemail.com with ESMTPSA id l11-20020a5d674b000000b0030276f42f08sm201410wrw.88.2023.04.20.03.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:14 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Cc: johannes.thumshirn@wdc.com, agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, dsterba@suse.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-raid@vger.kernel.org, ming.lei@redhat.com, rpeterso@redhat.com, shaggy@kernel.org, snitzer@kernel.org, song@kernel.org, willy@infradead.org Subject: [PATCH v4 21/22] fs: iomap: use __bio_add_folio where possible Date: Thu, 20 Apr 2023 12:05:00 +0200 Message-Id: <20230420100501.32981-22-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 X-Stat-Signature: 4sb789tfa8f41ns988qcuekru8j8p6ow X-Rspam-User: X-Rspamd-Queue-Id: CE67A1C0011 X-Rspamd-Server: rspam06 X-HE-Tag: 1681985176-89303 X-HE-Meta: U2FsdGVkX19aftCEEKUg3kWuwkxB4ygT2uP2QBbJda5lxp+6QdbDSSWLadHLl443wo/1YvBhwzBmlKpHZCNyzv3th/CHFFKTVcv/u76HnVw+wfMjrLoAjzQY3wH7mh94IDG8o9RWKIpD1QbaQDsxXXqmb5lhISiD0ftNeHHbKkSPX3v3dl5PeKlgSwFjsJpXbrpk/uM0OnVuIiOC/UfPEPy3dsIwl2tG3hjmLnkjmtcNiLf3sbdw7OOpMNy8NcObkbGx+VtnlR9JeIHopLu/+tBPMx05wn0rqe3+m8lo7oCf+PCLJP5nuk4FaIq3lm4G0XCpMWYA86SjKNjd7z30s5a3EcvmXHpmwdRZaPykFteAYohWDMpNXzrW1Y2eqEkYrk1+l7iF/OXDeBsdFEG0bxPjwFhGQCt47YjXGUqRnGeLPEk4i4ZUnrZ0nGdyIO7BEFUoVtKSo3lneZZJrEUwQTMovsBQ7KYomjsklAM1XvOlWWwPUZcwYX3k3uYFZZSRyHFVGHdVyLKBdHiax2qt77DgOULozq5jN8ltnOSxfVOAQeY9+iURrgFib8bnaEsvuTC3GIpQQAgsguG3BZ8zjGA5PlVU1f016KzB0Fehrxz7HIYQTP1Gz5z7qBKRoXq+CYkwwWdwEFzlRZjjkeyuk+pWnT9sUq3VusiVyChvnocEuCjPzs4V3tqnJxLXmSheiIaKXffbHgvkWeYA/DVCzGq5kDZv+UVIhXN7v87bxtjVHsl5DJlT1oK+lXPgYXnPMXfl4Tak4eIy+Sn0zvqpQimG+DCPIRShjjHxQuZx5F51Vn0dtG634GWdd502xeftp+xCP5tLu5rXMOOn56TfEYr14yzCGhsxHZrYFLqVBA3P24qkvNh/xW4o16xK2D+vygbM5IvpdIaC2Y3+Y2pASrSE3NYBS55k2gXQMHGyb8RlKu/vuJKNAt9z3k8cJnPfgsEMwV9q5xFDaL//zIC rjbMA908 /BDNPPxWPsax3eFQZdDsCEWRdxm6RQh4nZHfOnd1Yd4Wem7sfaGszXa8ucmdIgFcE/p97/UdQ6/fB08FEg/LHCVYy1kTKMb50DSQemhP7/Cp/mlN7WN/L2jV0DNYPadr6iuAiDIyV3U9ax/kyxU+ZqUZb/2t4OAAvO1FYYGrfUFJrDaXlnAWNB/OmD1s3KQoGsUJ6ABTrJuxZLWMnNVnK4twjF2ZMucC6uDXfsxnsWYNcKWDaCA9oOYSG9BOIeOEAwsU5tSAaG2/hBLSCFlEAqHvxHl8SgC/+g+U32S8GoTl2sQ8fpL+qOq25fVDYJt0Nmk2nOda+nWrUHfYLKUlqo5/3Bhrmoqvcn50lw856O90F+hvZKXWlV4qd5ELolvHdKd2KpLFSzyEKPiQSu8FSwGrPbLGhxxmBNrIMU4NZBLaSzPzltk8jksVlfXs/NjDuPVXB4laFEWXbK4Wjh12QGiAMlbtakgTuX1f5ye8CgQg8TC4LawM+FkgTbSHN0mIjEuaahpYLmGvaWd/35yJ+kWRbh3ApB0rzUNi3fO3G9FJ859eS3vY9JSeH3GMIl34p7+I/ 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: From: Johannes Thumshirn When the iomap buffered-io code can't add a folio to a bio, it allocates a new bio and adds the folio to that one. This is done using bio_add_folio(), but doesn't check for errors. As adding a folio to a newly created bio can't fail, use the newly introduced __bio_add_folio() function. Signed-off-by: Johannes Thumshirn --- fs/iomap/buffered-io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index 6f4c97a6d7e9..473598b68067 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -312,7 +312,7 @@ static loff_t iomap_readpage_iter(const struct iomap_iter *iter, ctx->bio->bi_opf |= REQ_RAHEAD; ctx->bio->bi_iter.bi_sector = sector; ctx->bio->bi_end_io = iomap_read_end_io; - bio_add_folio(ctx->bio, folio, plen, poff); + __bio_add_folio(ctx->bio, folio, plen, poff); } done: @@ -546,7 +546,7 @@ static int iomap_read_folio_sync(loff_t block_start, struct folio *folio, bio_init(&bio, iomap->bdev, &bvec, 1, REQ_OP_READ); bio.bi_iter.bi_sector = iomap_sector(iomap, block_start); - bio_add_folio(&bio, folio, plen, poff); + __bio_add_folio(&bio, folio, plen, poff); return submit_bio_wait(&bio); } @@ -1589,7 +1589,7 @@ iomap_add_to_ioend(struct inode *inode, loff_t pos, struct folio *folio, if (!bio_add_folio(wpc->ioend->io_bio, folio, len, poff)) { wpc->ioend->io_bio = iomap_chain_bio(wpc->ioend->io_bio); - bio_add_folio(wpc->ioend->io_bio, folio, len, poff); + __bio_add_folio(wpc->ioend->io_bio, folio, len, poff); } if (iop)