From patchwork Tue May 30 15:49:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260551 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 626D7C77B73 for ; Tue, 30 May 2023 15:49:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EC328900007; Tue, 30 May 2023 11:49:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4C49900005; Tue, 30 May 2023 11:49:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CEC3E900007; Tue, 30 May 2023 11:49:45 -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 BC8FA900005 for ; Tue, 30 May 2023 11:49:45 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 46DFEA0274 for ; Tue, 30 May 2023 15:49:45 +0000 (UTC) X-FDA: 80847356730.13.0DF112F Received: from esa4.hgst.iphmx.com (esa4.hgst.iphmx.com [216.71.154.42]) by imf08.hostedemail.com (Postfix) with ESMTP id D923C160018 for ; Tue, 30 May 2023 15:49:42 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=S9udaRYn; spf=pass (imf08.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.154.42 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461783; a=rsa-sha256; cv=none; b=oXb3cNSmH92pcdCVLcYjnYpcsQoOK4/FYfpTqNgUf+bBFWqDTeybRAMaoilQ/cYACouyva M5vTMb3UJxgPkbT15ApOapE5o2ZdLZLeUKU8WOOSoFuFWGfv1+Dz5A9rcvQlnR+2bIYZlV 6FITYyCswSXXjx0p3iJ+hmv6+sBaIL4= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=S9udaRYn; spf=pass (imf08.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 216.71.154.42 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=1685461783; 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=eoF6iuNNlEmd2vTdAFbwRg91T5G4Yt4OJwZs2LN0KKg=; b=PDzz/gh9Dq1X7WcLW8iwtCgJ2TWk+SvC7Nej8mtenmvRQoE7ft2Ot1ml2W520YpoNvuwtv hyguaWPCA3G0AmL/XA9uyRxCZLEPbZsqFCZwqBFAxQw1owix8/UVjnl0O7WY66ZOp5cCgO 0/6GSupG3vAjwdh9+wCCQmjiRaXf0bk= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461782; x=1716997782; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=asDmkxFBDABNDNnwDePSoyQARa0UoC2pBVbkyHt1eyc=; b=S9udaRYncrp56ozvBX/C6nYCqgh/jxrIsukVkVOlfEFOY0eGfUwQwG3N 2jbsrK8ZjArpyF9oz6krmxeHEjWHB/5XATKvM8Z3gmNX/qG5zAA0bpZHl lowffwyF/V1pG08obImxobY4K7k8n+t4txtxCumsj5IcGXz1+Azxi6SCM j45r8GVqGAPLiCory9y/xKNwVDCkqlK4oi/6Qo7dJ/baV2LkxZIASADHE UySLItJFvsxXpqrDQxt4KvhTTIa5vOAQvagFQtZZFlynMKezwrXxbx8c7 hpcNF61V0ymP74BaV8k4VHbgnryhuYI9Y6mpXg0H3ENFzfDx4o0APVe7/ Q==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="230129748" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2023 23:49:41 +0800 IronPort-SDR: ZF1y9CFSuZrIChRjApghk68LSrVJFx/gMdYtlVJUBBlYvyElLMLxBZtUHoQnFUET7jJBZCszU1 aDZHl1Ae645djnAvjzAewUgW0OPRm6xMkns0ehyWbXXtEY+KdhIG4ZYAnze4lcKVWuJykalEj6 KGbMyNw0SWk/am2eVTQ8MwbPpXhGY8aJ/IIXaoZYKrHGk0urYA5pUYwtw5jbEv1VbPhGNI4jtx CJbLnBHR7gSlql5ju7zZ6PHD+0MrwSXzI8u4oiP3f17PmMNxNJVsxUDL06rgYDjcvZ3OWca6AX drA= 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:58:53 -0700 IronPort-SDR: flqRBN6t8oeSRa1BabMxnUCvrp7PztzsM6fP6YmtGqWahobry6jFcPjHqu76BmTmRg0k7xB+eW Xd41xDIbR1903c6oA+KNiyFakHUZmxnJUerK8kgF9kwCVwoChx0oBjxovMtZJ/BUIUTKUH9A2r 71Gjv2BTIfgq1jrGmK0RWrNe0WL9Ca0Hz/IorQC319U3yD+iig7YZY1mUOiG90XjQrt9L7sEd2 guJGoE6VxoZaYn17klSHxaUFROzgECTIVBStNd3SnsVgan18w3VkwfB17pJewsQNiwzdzvk0B0 ZGE= 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:49:38 -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 , Damien Le Moal Subject: [PATCH v6 04/20] fs: buffer: use __bio_add_page to add single page to bio Date: Tue, 30 May 2023 08:49:07 -0700 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: D923C160018 X-Stat-Signature: gizfhrbyyirdqdgt54qr39oqkfi9cke1 X-Rspam-User: X-HE-Tag: 1685461782-776563 X-HE-Meta: U2FsdGVkX1+IB8YagiWArvZI+5vB8QkyvBADcMT2xvSLoqzBO9Iagl1VRbarCv8gciJ043zmVWFb4fd2a8hBMzdQKPW1H2Evzua2Na8wa0msMGKENiDorq/uEPJHL7NpH+eCqEf7XSc7DCdhBjE36GgNLylo4nnlPYELwI1kEU4qIX+C+CQEQmDAHJLFmm4l6YiQZ/91fVPz4JsgJrXvtrR+kf9LUK4kXRUu/w6hP7kmkLOfcKZ1uDU6pc1Lb83lqxa8ME5psqVJtfprDfNPTIFVkFFWqL279NbY3OzkdWIb5G/XfolwRg033MDEuoo2eY8DdWVL3NW7C73cXl2TN4nPX09tllL4ezw0WwlG8hDtm2475Ji9B5o3yKJLPkXE00fnp61kzAlfHWXe9dBGfQ+xtEXnRbqsMgmlcNOBqP8jeZRhFeDizUWn6pOV/K2QchaB8ZTNlAd5av0eUsgzPvZ1vp57VSYXHiiPENzJo5GDkAqhEkmxcwppPb59D8uABaLYvAq1NG4z/xJ5PY6tjRmOTwwrrnIQH/8lxdTbeiGREBybfOlddZ2MNkpiC639yz8NVbze+MtYCXLp2XeVRKRdomBw1V34XyczdpVvEQwh+YWUFitNGcAv0XIzcHhQQJZTkDG1KfL/9oHYA2xJNgOGMYuJjmG23ybD1ciD1UKURkvkTrRlDz3ydTo2l/atqcezjQcKadF7U6fPCM8J58W8IfONcpnV3M/ahlQwI14PoSpt1B/kTS4UkeZN4a0Xg66XDXhkRlQ1XzrHPHdzI3ndSgG6eM268vOYJj9BO4nkmNnB1r4N91uNs6ggW5LZ582TsvyPWyAqa9vb6tXJq1aZcTXjtAdElURv6oHQ8Uzm4PpB0ANcfcsTTwOiQ2TYefVwpqhNaWLhzjj97cvUTo1kSWoPD1hlf0Zfe6SWXdJYONCsvetXHjYORUSK1IKAs//JmizEZowjcMGvp2k 9PLj98Bz uH6b415RCvmR69RPlTAY9HWcS+OEJJmVYTfAat5StIrZjg0Xxx49DqAy3DxcI2OAR9tsB9UifU3GYESKoqtKpTVoWik131jmmH/uml6nSa59LoXT08Nr4J9fdPx/ReajhYi++IpgzxyVwCRrVo/8Wwigms238kvxtxTf0flGdPIA5BYPuEdhBJv8VZ6XwrQ2GNixqMuYbWEiZx4zgfpt4Ys6sk+GqftDBlcg3a/PVRyrjLvh9XDY8gntRyadrGw0ifs6PQAxAgl+EVdJbAUyn3Rc+7vvcKJ4eOz3ZfBSvVIjv4f6Xu/sgQ0/uwPf/Zksg8n7IFBhKfwwaCVY5kDx5qC5OX8C94lveqK70uonJcgUIm3HQ2h9aDAa4ONYHNsmOQ7ytnFSqamHKc9A= 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: The buffer_head submission code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn Reviewed-by: Gou Hao Reviewed-by: Christoph Hellwig --- fs/buffer.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index a7fc561758b1..63da30ce946a 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2760,8 +2760,7 @@ static void submit_bh_wbc(blk_opf_t opf, struct buffer_head *bh, bio->bi_iter.bi_sector = bh->b_blocknr * (bh->b_size >> 9); - bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); - BUG_ON(bio->bi_iter.bi_size != bh->b_size); + __bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); bio->bi_end_io = end_bio_bh_io_sync; bio->bi_private = bh;