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: 13218380 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53919C77B78 for ; Thu, 20 Apr 2023 10:08:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234570AbjDTKI2 (ORCPT ); Thu, 20 Apr 2023 06:08:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229729AbjDTKG4 (ORCPT ); Thu, 20 Apr 2023 06:06:56 -0400 Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79C112D5A; Thu, 20 Apr 2023 03:06:17 -0700 (PDT) Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-2f833bda191so284642f8f.1; Thu, 20 Apr 2023 03:06:17 -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=eroq0UuL6ABqRZQlB8F8vF7OTfh1p/KlTbcuEPRGiFPcJC0Z7X7NnrHVMedFMdwUgm c7xfh/KDldPoGZ6x9BCUypJE9mJce9als4rQSc8j72gjOKxXwGoF/hMZvD6BWyd0iCJ9 i2RYInU+PVfE3AcvX57omqxiy52Sa1sKb94AexK85BSsehahWxQIQ1NIgvboFA9XRAHS OzIaT0evLBlIcqBJMRuqb8ZWIiYH6k45OLzpjTLwgrJhI1IKQi+Mrj4UWHvEchN9uxhP F0FMvgukc91x9P8iYyEZCigfuu8eSxyIJSiqsKeC2CwE7tv0qW+N+NSVfos4fAjrsfo5 0N6Q== X-Gm-Message-State: AAQBX9ce8H6ppG17L0g+VHYkhI9tgbDjtcCeBG/KjkveXFV7oDPg/xdL 86ibqEjQ0phQPjOdu8aWCvA= 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 Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org 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)