From patchwork Tue May 2 10:19:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229121 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 C748FC77B73 for ; Tue, 2 May 2023 16:06:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6580B280001; Tue, 2 May 2023 12:06:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 608486B0078; Tue, 2 May 2023 12:06:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F715280001; Tue, 2 May 2023 12:06:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa6.hgst.iphmx.com (esa6.hgst.iphmx.com [216.71.154.45]) by kanga.kvack.org (Postfix) with ESMTP id 22B5C6B0075 for ; Tue, 2 May 2023 12:06:47 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683043607; x=1714579607; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6dks1limiAqVSjbOuL3QnwGTUxz1Vyw7q9Fmd54YaII=; b=cxdrATRebAvzjHzjNJLeiii4pg1h3YmcMv2H/eYQWTJpVQzR3Trkat1r F+NgRs/upT7fABHKG5me6As0NZx555gV/TwW4ygmZZWpQ3b5JJves9Z0+ o0HxQHuDyrh4XzqV7hQ4T0Uv8QNL+c+XQTKvI2udvkLkmyaitxy1G9IRm IAjgFa6glk5n8ZTRR8UpxImFDNbgDJUxZUH4s+VyqRwU4sd58EIxYSQ/2 DhWpHAXNadT1uZTCkTq0YIE2KnRiQ70dXZSCCAVMNqRG6nHU40QEgtmYP Wl9lx68oV9yYzHYI44Z2cNVTPVWIrEvJGuy+gDEolDlX0pXxwvC0W8ELr w==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="229735914" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:22:04 +0800 IronPort-SDR: MpXp8N3dBcBG6Af2DgX29eZ4AylzxMDyyOMnebhDDmcMjw17JKnuIxDSoOWcvZDpja/SDka0pz BNYdSS8Tf4XNAENsB5rj2KNIC36v/yMedFl/zVLlOyrzVc7Y7nAGGcNDu9KMjGz6V/i4fRBeUf 4kI5jfdjwWg10qQfP4G/cVn/a/KzgpHhqGdsMBjTMSwbZff3+A/7MEwW4T3cCsKlH4ZVH5MPNH K8Idm1J6JWrpG1Z5OTEH2L785kO41f/fwU7KNm2ehSKyr96u6Yojct+27EIs7wg3/S49wugmmN Nig= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 May 2023 02:31:52 -0700 IronPort-SDR: TXRvj4xGS7bs358T8JG44prCEdQDntGn6p0l+szUnQQoKJ/zDUjD7hIPnB3WnqR6eTNxy9YLTk XRVgfqPge2tLXX9S3JBmh6cFtTa0a693VSeDeLsqNSigQnxtFdohY1ax9DQgKdHPBtM4lfEiTv Zjg5Y/0Mwg7HWndmnbK/j/QEahj/maRXY3CFUHrYGs0T63rGwDf3VFa2xZKPr+8lNUgMWnCebU hTXKsOGNGJGduWGl5A13GiLONk3DA+8Ged0SvyX7QurqVHjtBsMs2BE1hlpq5qA4aMSbZ6U+Xr NI8= WDCIronportException: Internal Received: from myd008205.ad.shared (HELO localhost.localdomain) ([10.225.1.100]) by uls-op-cesaip02.wdc.com with ESMTP; 02 May 2023 03:21:59 -0700 From: Johannes Thumshirn To: "axboe @ kernel . dk" Cc: agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@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, Johannes Thumshirn Subject: [PATCH v5 19/20] fs: iomap: use __bio_add_folio where possible Date: Tue, 2 May 2023 12:19:33 +0200 Message-Id: <20230502101934.24901-20-johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230502101934.24901-1-johannes.thumshirn@wdc.com> References: <20230502101934.24901-1-johannes.thumshirn@wdc.com> MIME-Version: 1.0 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: 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 063133ec77f4..42c5fc0ad329 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: @@ -539,7 +539,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); } @@ -1582,7 +1582,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)