From patchwork Wed May 31 11:50:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13262057 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 4B4B2C77B7A for ; Wed, 31 May 2023 11:51:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DC2746B009A; Wed, 31 May 2023 07:51:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D73366B009D; Wed, 31 May 2023 07:51:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C12C26B009E; Wed, 31 May 2023 07:51:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id AC7136B009A for ; Wed, 31 May 2023 07:51:52 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 8EBD7A032E for ; Wed, 31 May 2023 11:51:52 +0000 (UTC) X-FDA: 80850386064.26.1413DAB Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by imf26.hostedemail.com (Postfix) with ESMTP id 55009140015 for ; Wed, 31 May 2023 11:51:50 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=hpjBHI7k; spf=pass (imf26.hostedemail.com: domain of "prvs=508ef2a02=johannes.thumshirn@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=508ef2a02=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685533910; 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:dkim-signature; bh=YZb2egHLBrx5N6/I+IaDtqHDbm42u3jNdIR5Vm3jeo8=; b=h8SRCBTc7EW/XoQGVpDAiO2EqWD57vJy47xoMwsJlKGgdK2iBo5xStyXpda4r1s4lCyYNr YXp32Hweg9UX9LzjkqQ9hYpB0XGFGn8cokAEENlcDQ66mCGElZNpI0ofZjqz95B/PCGt3N OxPYBqVjPXhi355NFlUiHtG7voSNT+U= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=hpjBHI7k; spf=pass (imf26.hostedemail.com: domain of "prvs=508ef2a02=johannes.thumshirn@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=508ef2a02=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685533910; a=rsa-sha256; cv=none; b=ICI7sCusj1uSK+b4cEGyRa6cnujbQAkj4dnYAnp3W4h43//BO7rgPxCpIKfCkaVP5al2lM naeJL1HioQuA+C2y4XxDAiyfcK7alJjiUtgqIFHIkxNYcezdhSp34bMgU126M/JlxCU9Kf Txx5uXnwiq15RJ8l+DzWZdTLDG/AO4k= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685533910; x=1717069910; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FGWqPfSW6ep3dW0Pc7XFAqv0X/wPwwa9HWdy1+kVpjQ=; b=hpjBHI7kc6T8qLG3x4I7qwXWNUCf7eIcj/nvNInbqMl/SaGLx9GDZPat eBcYgF+NqnrdbxcsY7+/hEwFwP+goZP1OQ2OoYrU259er6DinZswNHdyh R/lPc0Whh+D6vTlIF/8zt3vlbY5TFnl2cHxIb4SLRf7lREZGon6HJyDnX a5K6dc28NlZLOHNWAjTxbfYNSvzqXm5RGNhB5mELEjbAWO61dTZmHl2O3 m8QB18vXtzW2doZCkPlPARO+F3spoxGOBCRRUdJVvHOwqQlXuDWCyWmlS wLRSyqSZNIA152a8YYwjoxkk1VuPJSUDDbrmBeENLEm5QHlznl15xsP6J Q==; X-IronPort-AV: E=Sophos;i="6.00,207,1681142400"; d="scan'208";a="231985159" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 May 2023 19:51:50 +0800 IronPort-SDR: Ybr7vdVNUWJl98vj1khu16iM2kBLnEjLUY0ezeKGqRI8O9w5zNFhT43ZPFvxeRiTqG4fDzIglH dYB1/AOdba+zUeDIf90Iee3mLcQ3pLFBfarA79JdLjo1wZ3xgfIvcYvjWh1KIeaIqAAEPhtFwL cJqAEM2rEIJCRhNvNI84YlViupWS+KVGnE3j8Qv4DMECx7KpBUj1kFr4Wcuir/bKqMv3nF4FRo Ap7niGg1NL2iDeBNwdBgUjBd/gk1GvpwfRMg2YDSRQLmcQKTE4/pcOODeFStn3hXyu2Stg3TG+ xPA= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 31 May 2023 04:06:42 -0700 IronPort-SDR: uHFIf7/iHU8Czax3/d36X72QqGjG0msVMP/RSX+n0ryZbgTC/vQVTGZ34sHyh4iM5x7IyMP7EJ 7cQG9Yw608QeZLGyP0kQIFeSZCDD8DcLwHNsm/JxZC3UnVblDfvw8IWh3MbAtONyBZjBACr8dV 7m9L+ffLx8wwrUzS5Nw0EQLVRsl75GdHE4S7QFxRYSIaxJJ+Q94NXHETUOLN+Q12WILx5359SO w7g/jlWqUSxuN3ILW6qvcbufS8ZTgefKKE0a6L1aJq6XjTvn8zzXK77PIN3epTN1HJDIFj5z9X G6Y= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 31 May 2023 04:51:47 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , Mikulas Patocka , gouha7@uniontech.com, Johannes Thumshirn Subject: [PATCH v7 19/20] fs: iomap: use bio_add_folio_nofail where possible Date: Wed, 31 May 2023 04:50:42 -0700 Message-Id: <58fa893c24c67340a63323f09a179fefdca07f2a.1685532726.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 55009140015 X-Rspam-User: X-Stat-Signature: ft9aq4hu5tytz6dnc89qr4zytwioozdr X-Rspamd-Server: rspam01 X-HE-Tag: 1685533910-362429 X-HE-Meta: U2FsdGVkX19p1/cY5soeLpVxzk0LabcCgug0/oNQ2Sinkuwnr6xfofqL5uPdV23A0A5rpxcOWLrUIfAjFEnrPuiVWUlCd5GpEvfaAZ8A9dVtK4EUKo38iwffFQPTNOWlM8Y4mzUFV1znNYHWTL5JYwX0qK1Pqt2or+Kr55ze1iJqcwCJ0b50phXF7jCdBfYBinpvYa2rYNCPbqLXpwTtaLgtD8K7HwBO2nrw9nyn13Tn3KVqmcWoMMfimmiSD9y7JGGsxs6BeI0ItS6y1AkPImetIVciPxpgiGlfWIkPe/ton+2a658QLGEMD3AEofGgbrtslFvTxjRXgvWxIDPQ+EW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1LeL8oo3VIJJyaA02qHfP5xyo= 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_nofail() function. Reviewed-by: Christoph Hellwig Reviewed-by: Matthew Wilcox (Oracle) 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..0edab9deae2a 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_nofail(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_nofail(&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_nofail(wpc->ioend->io_bio, folio, len, poff); } if (iop)