From patchwork Tue May 30 15:49:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260566 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 F2EE3C7EE31 for ; Tue, 30 May 2023 15:50:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6ACEA900006; Tue, 30 May 2023 11:50:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65CA3900003; Tue, 30 May 2023 11:50:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 488A4900006; Tue, 30 May 2023 11:50:30 -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 3374A900003 for ; Tue, 30 May 2023 11:50:30 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 13A4C402C7 for ; Tue, 30 May 2023 15:50:30 +0000 (UTC) X-FDA: 80847358620.26.8F98B4D Received: from esa5.hgst.iphmx.com (esa5.hgst.iphmx.com [216.71.153.144]) by imf27.hostedemail.com (Postfix) with ESMTP id C582D40010 for ; Tue, 30 May 2023 15:50:27 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=PTZkcIk0; spf=pass (imf27.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=507b913ec=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=1685461828; 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=eIMNShzbX4d+fuJlDQGVddQb83DiGokEGK2iaexvnMI=; b=R0xXa6xeZdNTeeUkV+qV11e2kEFOaqKuFBviHZsgi62w1p6K7P2f6bBqyZz17rcppoB+vu faHp1KmGNEPk1Au48SAjP/gpppFVKs4pKtBMDNYIf0agg74bZeswKlUlfTDWL1XB8iaA/Z +8wa9eEPf1IZ63Z9EuJVW+Z8dn/ePWA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461828; a=rsa-sha256; cv=none; b=gFORBBrx/dI/cV/s04SJ7XWuDLMrbp7WXylwdq8GUdn5dux0AKpTP5PMrh2gfqICqDS50w if4cczgGf4xeebCmnpYk22fZsoOSDPxC7j4+JGf4cSkFvWZUsslC6T4WwaPPtk6RTS3hfW AbigiOjJTKLDVxBkar4DgDaqgbDeKoE= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=PTZkcIk0; spf=pass (imf27.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.153.144 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461827; x=1716997827; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Mcd/H07yjDNLd/X+ei4F/kInbJgAqWy0dojDfw1QWYw=; b=PTZkcIk0KtnwDwSQzUA7nqgARKxDH+YKYBnkqf/ALRMRXVT07PPikqN4 KQ8IpwicrfANfCP+b8hpkuFVi3xYOdWxdx96rlvdo52GjR6Sb6E+ms7X/ +dCch7tY8qR9g1vdsz6MMmESBoOw+V6ozahzCBYAHyL1gQD4n1yMwzLYs Xo5LHtuPaM1fATdmtWFp2CrXVTBlN4dWrdry4o4hEoQjd3lpejFKU67H6 VUZD0ogC0fxxirPiGlMSEzuUF26Ayt30/PTdGEmUSfcilyW5+ckcfE/Zb UMDeFUyvv/ZnCROHy9wxbC26ty0bB6SIsHZ9B+zRYGpr3gHqkeid+t8jI A==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="231905799" 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; 30 May 2023 23:50:27 +0800 IronPort-SDR: ZzAz1X97S0NWxv9uymqMc7LH5P4ch1KM+J3+W3TDL17sVZA3ZAgMTlQt6kzuPqWDJEdvv6MzD5 mxInpsM2i9azFNZXDH9DyG1T0Rn1LnTLloR97FmEpogmM94CjnWfxQz1p84/yRn/OgaKqdRJzJ il1xLKDEI+0ZWl5rVYGFzXfAqwpWdLR82jOlyE85jsdiZpkOxOgiwmZf3wgAfSxlQs4pfr13uC gGCD1dc7axT51e1P8pvNiMMC41QIxZ5bDnJB1lwzdHUo4sFsBE/ZUeavGFrxgfb8UCEJZaDvPl 4nk= 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; 30 May 2023 07:59:39 -0700 IronPort-SDR: vm077LYPjNAgf5XlpecJ/3icJc5CMvd0lv/Avf1qt9Q/GL6TJkcMXRi6IgIjrnSc7COF5QrvoM rybn4aIsk3ovkS/odxyg0sJi8dTutwPKjZDfzTgOQd2shRAOUl0eyZW+AxMzq0gSSpTLt0zblr UlT5/9heJdPYSEr71OD35L2+mnxp5yfUxAvMikvD+47W4RcDny9nyhyoPmkkZUZCDcFsZlAdtd Z+zkSGqfSgcxDW2nlTOB+X8K7FgyMtw8b3N4WfdZtYRGEapJ7oDAz61v2TGB77bpv7441w8fn/ igk= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 30 May 2023 08:50:24 -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 , gouhao@uniontech.com, Johannes Thumshirn Subject: [PATCH v6 19/20] fs: iomap: use __bio_add_folio where possible Date: Tue, 30 May 2023 08:49:22 -0700 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: C582D40010 X-Rspam-User: X-Stat-Signature: rrjjzwpubjj8rnte59i8b1zepw7m8ur6 X-Rspamd-Server: rspam03 X-HE-Tag: 1685461827-936313 X-HE-Meta: U2FsdGVkX18STj+icSDvCNcXgYDHF1JL2png24CzXi9pxh1SUqIZEF8wyOqxZ1NmL4VTmJNkQ8RkQAWcqGmsBV7+GD2KhvRyzscpwLF+jwVXtBQEoFuUjoJn/OplvYzptXy8IzfSngoHmSOlUjasEJW0li9TCRDLbt9F+guuw8VRLo4hWtxRJGiKEhlYeMAr1DIt+jRfxU/eJwqQ8PIF+99xn56VRtHsQdio5bT45awelYgp5zkQ5uHU3OQ1PlZ8rC/80s5sor9crNk/v4NKnU5zoytioN3NsX7OWvVFpokmMU1J4mfh6ipf1JZQFZ6Lb97XB5KxK5oOCesRO6LUjV7yLvWI3ViKQWuDiEU4dJOlwVCC4VQK/wkEf+VScplgeLaY2S9sDciTMb+yeoul5x5C2h1q5ePQhY1CztIzYpcgXBWKcy6kNal5khwV7XPieR1EsEI7dgrXb1znIK46TXXYsyz0mnjAHm+McKyxPwz3RrjssxphUxf5b+HaU++y6oPQiPn+3Fg2lw3GVYlWmhfE7fdGFt1sfsz4ObVU3yfU+dhDuexbFD7DK786EToAgNkOQ8z0TWcqRpMS/zCwIYbPOhTCdR0sZnTjAUifTiEmCTDLtpD+tHCGVJl1qAcCY1RfyBxzfB3V3pFam/TDMODRv7wiH7gs9eytzI7M5up7jIemhVzLqXdFpsCmYP3k4oJyhpOaoZ4JNXGsjecHx+b+QJP3xZoulqYH+ix778TQgi4HQJJeVcPUQx7G9YgybtWE+t1wL5/yuzZQx4Zo/rmrU/2TLbP5CbbJjqYVDKkdywh72J3FM4+kcsfGvY9aAjO7w2/HPCQdpgL8IjrlGlGQpGlfAltw1EPlebsL5KspY/cqUJ7EJ0s29aprvw18pxICsqlLUXIklCZK4dogjZChsgYj1hb9eddgY8yYH7uCI1e5XdYlM/unLrxshxuEWz/7iIfycMGtamfiYD9 TfIDZl1H vD9GE+iCMJTq0zTvbEutqZp28tECgHLbm7wO+YZ2DUUVhy1YM9yhcuA1VANN7rv/CKHECpYttBV+d5yS7JJsPF1SueIF+347z5/+lbQ54v9s+g+IXJRJQvXGmHiu0xLyNC9+IM5WxMszv2+M7kto63k6oiXx8aVPtUmHUau6vcxkc/KpcUpa7/P2GHC/dOiM28lf3iVqM7UIlrxnmJ5M4q1Vrw4Gn+HTGTIahFlRT80hN5N2/W29XEgwvcLmhD5RqNnFGlv+6KQ/vWXwJPblVvl9wmfTaqtW1ZYDe+prKwRmF7PZTPdvIdqHDKpePNcD5olN3n0hUkNeJi/kXoAfbe9JMOyX1bj/rObqS8WsODy2dncd/vfkalLQbKpUTLW+9Y8KPHdSo5BYoMs6tEIN1fe+EeA== 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 Reviewed-by: Matthew Wilcox (Oracle) Reviewed-by: Christoph Hellwig --- 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)