From patchwork Tue May 2 10:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229065 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 6496EC7EE2D for ; Tue, 2 May 2023 15:38:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D4B66B00A2; Tue, 2 May 2023 11:38:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 884796B00A4; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 773566B00A3; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 488006B00A2 for ; Tue, 2 May 2023 11:38:07 -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=1683041887; x=1714577887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9iZj44wPsEck0/AFW/flWeeHkPYU6GMDPlSCG+jgWZM=; b=EGG6R8iaKndUACcD7dVueaa/c8grOURztyqdQbZ+6UzOo91MV6GSEIiA y+YrkViich10rdo4Lfz/yYiXT8LvbIPxs3sMLWmShTX4p8h0WZsU2jQGR 4OmukYoAkgqT70mY/KbME0QW9w3m3IQoc/ss+XKpUkGCg+Pw+k/OWqnNo jLxWj1aSrGWKS/94N5wPKIXgmS85/L80+EH7/KBEgrWq4kZVX5CpMbNnD TDPzKB0OHzyGzBQ16wXwTK03Z8uDkXs5anoXC9yTsGt1fnvFKYYYgCrWH BlwpnvsPlQ7k4Ie5N7NsQKjl16abHRWRT1dbcDzJvHRMu5+U+KvXKvPnc g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672818" 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:20:40 +0800 IronPort-SDR: SGyz/sl+jllOj0ijlSlu1PRkWY9dqP58HzNyrDDXwB6fUazJ9roI8ONFngrIkbRAZJoBMl/uqN UiuoQruOxWBdpv9CFyZSHCfCa8a5ScRlTradPVYy4Ya5KT8JfTpLoSJcWX1QCrKEYgGHkXJPec IP2NX1okaExQ9fQV9gqsC7+b0uT/zXXdt8/nKLc0EiEU9fwIhIKqpyIW4yPEoTjNl/7KBltck3 otoQtc6UmsNFfxa6NG8dSAwiuML/ExzbYWGCw1kMInP+lqwhZDfbSVmhehk/qrlDXsJz7J+J8Z J/s= 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:30:27 -0700 IronPort-SDR: 02ts8M2ULEXIIQnCeKUUXKET2iYQVZOPeI1lsh12iKPVk+qnVNbuJKmlBBWt8kg6vDqANkUPjP S88ZBNuvUPdOJIVrPg/7LZtYELJoOWVn7WGdO66mTrgszCRUCBkByH5V0TlXgfYP8a477LSy47 8PsG57T0aCd8AhDDweyJ+TxqQuuSlzTrnnljw73aoxjoLO24lM+jJrGrwmoTvR0RGn4d8si2DH oPX5IDnKX5tdhmZVSe+A4YScdD2m+NHjpjZHCz65IpUJaZ8b+bdBmJW9nFreuq8/HgVWuI80RN TgM= 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:20:36 -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 , Damien Le Moal Subject: [PATCH v5 01/20] swap: use __bio_add_page to add page to bio Date: Tue, 2 May 2023 12:19:15 +0200 Message-Id: <20230502101934.24901-2-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: The swap code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- mm/page_io.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mm/page_io.c b/mm/page_io.c index 87b682d18850..684cd3c7b59b 100644 --- a/mm/page_io.c +++ b/mm/page_io.c @@ -338,7 +338,7 @@ static void swap_writepage_bdev_sync(struct page *page, bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_WRITE | REQ_SWAP | wbc_to_write_flags(wbc)); bio.bi_iter.bi_sector = swap_page_sector(page); - bio_add_page(&bio, page, thp_size(page), 0); + __bio_add_page(&bio, page, thp_size(page), 0); bio_associate_blkg_from_page(&bio, page); count_swpout_vm_event(page); @@ -360,7 +360,7 @@ static void swap_writepage_bdev_async(struct page *page, GFP_NOIO); bio->bi_iter.bi_sector = swap_page_sector(page); bio->bi_end_io = end_swap_bio_write; - bio_add_page(bio, page, thp_size(page), 0); + __bio_add_page(bio, page, thp_size(page), 0); bio_associate_blkg_from_page(bio, page); count_swpout_vm_event(page); @@ -468,7 +468,7 @@ static void swap_readpage_bdev_sync(struct page *page, bio_init(&bio, sis->bdev, &bv, 1, REQ_OP_READ); bio.bi_iter.bi_sector = swap_page_sector(page); - bio_add_page(&bio, page, thp_size(page), 0); + __bio_add_page(&bio, page, thp_size(page), 0); /* * Keep this task valid during swap readpage because the oom killer may * attempt to access it in the page fault retry time check. @@ -488,7 +488,7 @@ static void swap_readpage_bdev_async(struct page *page, bio = bio_alloc(sis->bdev, 1, REQ_OP_READ, GFP_KERNEL); bio->bi_iter.bi_sector = swap_page_sector(page); bio->bi_end_io = end_swap_bio_read; - bio_add_page(bio, page, thp_size(page), 0); + __bio_add_page(bio, page, thp_size(page), 0); count_vm_event(PSWPIN); submit_bio(bio); } From patchwork Tue May 2 10:19:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229064 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 DA21DC7EE31 for ; Tue, 2 May 2023 15:38:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E17246B00A7; Tue, 2 May 2023 11:38:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D19AE6B00A3; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6AE06B00A4; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 804BA6B00A1 for ; Tue, 2 May 2023 11:38:07 -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=1683041887; x=1714577887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DAUXXvncb57Ca5Ysqy4K5WgFviHvSEfqduS77WKLrRc=; b=LcXj0nHtevwEQb702BUBC4a/YDc/6py5EATOy72uFNIsxF0MJY0F1fbk MTKRmdr8D5yagUD6B8VpavkybD1h91z5ACCNqu8oauiOzVIAZGf/pFHKE 8/QMKtyBN+1Yr2LcpjinZnW4o/lgLkRTuSa9WPkkCuSf2TD7WPjq4arpA 6y5QoBqY44VbHgIn9H3HILdnGCjRFYpqTmiExDDexRs2c/LDj5ZrmW7em Xf1XcllsIf2XmY3tnzfoc2do0qv5/x4nJDrU8J2pIyO7Fjja7HgKJsd/0 jlZqOMvN5wd9WxHAC13yXZHcrGMKZw+Vl+XU1F0jZW8tobS889zlKHoyg g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672822" 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:20:44 +0800 IronPort-SDR: ckd52TKh0wmtRzfjjaQuuHAhsRSo93EGV0Bkc3rRkdhf2+R1g4nPOewPhtozC3UmnW79kHI1mg AnYMzGwPMu7N6xAwV08eJM6IkwPpbUS7hYsA0cbBG6FyRbKjbc66NkSrnxUQDxXxe4EeyOYWUz GXOuZbR5kas3e4qtQctumFLtDx4sRfcid7AZuYPp3L14HIzWMi8gW11WFI8g/It0ZgoRpLOeW9 BzRZ23OQL86clWyTw2VZkhKv0e0PINVwRUuI8buIsfRecnO2kDPtz2K6WWOxgyTa2Hc/KvWcrv EpA= 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:30:32 -0700 IronPort-SDR: 9dAoasd2kUMB9NDuUlrxf2LKGQXNbe7IcqE125G1znIBmvFKRi1+XoITUsIN9ND9OAtiPxTMbd hksUv+zcUrnVuAoUVGO2049xfknTS8aM5hmEWzvj8WhmmTEXP0n/lftv6HNELCgJiPz5gQczyl jSeLS39egvZ6QJ+taxzDgX4dDqXFI5XQUhVg1LiOWyxVbmVWvI6hTsCCj0zcHEW+RxhAj2/6P4 4ouCUXL168ncCOMo7EVwzrHUnj7EWo9bkFcQfzMoq8SDN7OCFeSa+F3X1vyKgUhvKXTrNUP+wD 2eM= 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:20:41 -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 , Damien Le Moal Subject: [PATCH v5 02/20] drbd: use __bio_add_page to add page to bio Date: Tue, 2 May 2023 12:19:16 +0200 Message-Id: <20230502101934.24901-3-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: The drbd code only adds a single page to a newly created bio. So use __bio_add_page() to add the page which is guaranteed to succeed in this case. This brings us closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- drivers/block/drbd/drbd_bitmap.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/block/drbd/drbd_bitmap.c b/drivers/block/drbd/drbd_bitmap.c index 6ac8c54b44c7..85ca000a0564 100644 --- a/drivers/block/drbd/drbd_bitmap.c +++ b/drivers/block/drbd/drbd_bitmap.c @@ -1043,9 +1043,7 @@ static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_ho bio = bio_alloc_bioset(device->ldev->md_bdev, 1, op, GFP_NOIO, &drbd_md_io_bio_set); bio->bi_iter.bi_sector = on_disk_sector; - /* bio_add_page of a single page to an empty bio will always succeed, - * according to api. Do we want to assert that? */ - bio_add_page(bio, page, len, 0); + __bio_add_page(bio, page, len, 0); bio->bi_private = ctx; bio->bi_end_io = drbd_bm_endio; From patchwork Tue May 2 10:19:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229063 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 6EB9AC77B73 for ; Tue, 2 May 2023 15:38:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 16F4C6B009D; Tue, 2 May 2023 11:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E07896B00A1; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA31C6B00A5; Tue, 2 May 2023 11:38:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 949026B009D for ; Tue, 2 May 2023 11:38:07 -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=1683041887; x=1714577887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6dUSVfajEldYN5Oupo7JKyZWBoRWVt/rgYFEzhpo0c4=; b=hTDqPRhan6JSfuTIn2DRpJ9OdwLFstOMSZyWIpm0vozvaJ2G7nsBDbeH 7eE/fuKtsi50icK5wVECeGL/MUhoFRI/HDI8+pKwC0DOp3KTi/yYkmPrs ZMQHBJ/mmrl7AXF9l2ujoyI0SDta488PtdKy80PalZ36f3/0jEybleYrv EaDNwJqkW/6eRw1Go72MWZUxunm0OU+CaV0bdbgs5WAKLUeJjG5JDEiJk fKMpM2ojm7upkZmYbf7biJQupM2dfPAi6K+s6BbbVg+KZ5kQwM9B0lrOw 2BI3VDhYfcg4hiaQ7xQUynZLDR3pS226r4hSgBglwthTJcGANIlqPY9A1 g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672835" 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:20:49 +0800 IronPort-SDR: EWLS7dweMgBHX0M8y+rGNamNpI3PXYT85dBW0ZpwRHFY8T05Qy3ovo3Y+BKr3yLch/nb4CxheL oxEHUSM8G2XiVCrEMX7RSBgRd7TiLNAuDs6BgI+MWKiXHPp/m1zPnnVMFkDn7THBj6maboq+mj EXAv/rrvfIzaIKDFlUbZjQOHY0ik1kr0OhP7nwqGJq0Y28CuGiTJPy2G7OVzmV4MpxBmEYeXr5 ojuMOz2iEhlViAjqxD4TxO7jVP+9Pn1WzL+0WVoh2AVnswJD3FRuWdpT3qo9g4R3i1CXFJOiyN kLo= 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:30:36 -0700 IronPort-SDR: izj1TLhxnELM0NHoBU04SGWT3AVjAUqJVEZ7r3PJykX/ZdoUGxAr5EDixoNXp4/1ubYh6EB4GU VgNk6nLvH0j+QUUugolt2ulmPIOfrX4gESgZjdrdfbINt/HygPVllIP4O/fbcchFgi9WiSvH9x H5LeMGLC2jUBUTkFWd2BcC05Jqfr/W3l4NjYsyVenLNxN2zWI1M7l2Gm9QIeCoI7VIuq9XXK5R QOBUOFUcBEFOcIGquakdmPM9MsnLTxE6T/58wESvv3DoqJ049BaL+cUOm2GMivDIRVkL2tDJyJ AjA= 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:20:45 -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 , Damien Le Moal Subject: [PATCH v5 03/20] dm: dm-zoned: use __bio_add_page for adding single metadata page Date: Tue, 2 May 2023 12:19:17 +0200 Message-Id: <20230502101934.24901-4-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: dm-zoned uses bio_add_page() for adding a single page to a freshly created metadata bio. Use __bio_add_page() instead as adding a single page to a new bio is always guaranteed to succeed. This brings us a step closer to marking bio_add_page() __must_check Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- drivers/md/dm-zoned-metadata.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/md/dm-zoned-metadata.c b/drivers/md/dm-zoned-metadata.c index 8f0896a6990b..9d3cca8e3dc9 100644 --- a/drivers/md/dm-zoned-metadata.c +++ b/drivers/md/dm-zoned-metadata.c @@ -577,7 +577,7 @@ static struct dmz_mblock *dmz_get_mblock_slow(struct dmz_metadata *zmd, bio->bi_iter.bi_sector = dmz_blk2sect(block); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io; - bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); + __bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); submit_bio(bio); return mblk; @@ -728,7 +728,7 @@ static int dmz_write_mblock(struct dmz_metadata *zmd, struct dmz_mblock *mblk, bio->bi_iter.bi_sector = dmz_blk2sect(block); bio->bi_private = mblk; bio->bi_end_io = dmz_mblock_bio_end_io; - bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); + __bio_add_page(bio, mblk->page, DMZ_BLOCK_SIZE, 0); submit_bio(bio); return 0; @@ -752,7 +752,7 @@ static int dmz_rdwr_block(struct dmz_dev *dev, enum req_op op, bio = bio_alloc(dev->bdev, 1, op | REQ_SYNC | REQ_META | REQ_PRIO, GFP_NOIO); bio->bi_iter.bi_sector = dmz_blk2sect(block); - bio_add_page(bio, page, DMZ_BLOCK_SIZE, 0); + __bio_add_page(bio, page, DMZ_BLOCK_SIZE, 0); ret = submit_bio_wait(bio); bio_put(bio); From patchwork Tue May 2 10:19:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229067 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 10B64C77B7E for ; Tue, 2 May 2023 15:38:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 38E9B6B00A1; Tue, 2 May 2023 11:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 307576B00A5; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1175F900002; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id CDF4A6B009D for ; Tue, 2 May 2023 11:38:07 -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=1683041887; x=1714577887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Es62g6k1ZlWhgSA6WjwLlc4pXpvWcgAwLvB3w8C65Gk=; b=nJfxA+TAx0Kxf0HxF+1YIoP5gTAR3w+8vUkG54X/0tRMl6XNSgRYjWbb q8v28mTcdCXRioSdOpvCTlsA62s85FOoM5wfOLmXGwWrOuH1bGkhW65Aw Eylq1914MgQrEHZ9fduMxAwZGnid6vCMfwQ7OMhX43a08fOfTaYbO66xk SWMpG+sw5g5SsPrVMaD2fnQa4ZewuqiJWSqM8CasGCK9Dqz4bBGl/l6Ua U0Dfeuw9K5x2HsmYFWZcdunyD8/P0fN+XHzXsdjAqGjfTcSXFj7XYJovn wq5wGSX+hCbJ4pR1lUgbQEn9OVNVSjxQeuvQspPSApKYKdJDpeut9k183 g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672840" 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:20:53 +0800 IronPort-SDR: i6Wt80WXp4nEeTNBy7d4Je3VQ6rw+MIybbQ9U/hY8LnIi1r+HmHpPz7i7uvimjxdtRr/zMIKr6 CihzMvnDFSee27SgPyfqJCBMnCyjAciI8MVio7KMCUX8Bbp+UFgb4gHnCA2sVTvi1tYxfGdMv9 WOzYlLN0P72Z+++CL2hOvIpBq1V9m+4LMkdjhHbTA3X0N4W+1V7hx0B0kIpbIeR0r8FkDAbPn3 Fv+MFVU0RvlQz95BI0LVK0tdh3mV+3rwPxSUQ62a2wQYyZFv+/dmg+5jjDLzvLfH7VxupbEgDn u+4= 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:30:41 -0700 IronPort-SDR: lZvLJJNtit6YaDaRBpAoPeA+okMXi1NgBhcPxuv1Yj1Ti6ZR/qtMcFmyzA1CfeQK9Pm52oQ4UX KijqLwLr15wFCQ51AUQnZWWjgtCohUdv1nJi/CHpIu+F1EOxkUvPsh0Om8NjYgSZly+8KyWjI/ xdAuOSlf0xZugpuHVN61JlWiVSWBV5uiFwn5N8ol3vENfCoFPsM6Ej5IFQDNt6Mdr8+XUfaqOo w1LhiCL74i+xYwatkvZWipXL1PHg3LZseF9wsfZrOCmoMv39jP9sPSI7W2Kyr6m8JvTNnzZ1Kh VWM= 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:20:50 -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 , Damien Le Moal Subject: [PATCH v5 04/20] fs: buffer: use __bio_add_page to add single page to bio Date: Tue, 2 May 2023 12:19:18 +0200 Message-Id: <20230502101934.24901-5-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: 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 --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index a7fc561758b1..5abc26d8399d 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2760,7 +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)); + __bio_add_page(bio, bh->b_page, bh->b_size, bh_offset(bh)); BUG_ON(bio->bi_iter.bi_size != bh->b_size); bio->bi_end_io = end_bio_bh_io_sync; From patchwork Tue May 2 10:19:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229068 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 5D8BDC7EE25 for ; Tue, 2 May 2023 15:38:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF65A6B00A3; Tue, 2 May 2023 11:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 885716B00A5; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4DE6F6B00A9; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id E00B96B00A6 for ; Tue, 2 May 2023 11:38:07 -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=1683041887; x=1714577887; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nHbKpL7Y+zm1E2hxTUANJxFynmRK+rVRHRUzVuIzNMk=; b=eKN91thW2ara4gSaGjUwEwWRU8JavGSWYtcGwVoieWq6raW9/2Vt/y4j a8c6jMpkZ0g332YacLExrQ7+b1jcKeWIumWHq7TIUYKZ0UaBnNll6EVZA 1AByllRDtFzrAqAyqtPmbLrrLRKghU/CzchX7y5sVE9d6UOv7u1K42Jb1 Fyugpwq7P00xq4pLaOoNJJ3O3gfFVs5BEIFAjfVwb0+lKTI4QH24cX4hc vBm7A8R8xc60s6yVsgUaQqNN1vEFiejA8QH1IyAu9PnWFdui1qbfYXzdU TuJTHqCFmN16ZV6VlbZCFR0BrEihHr1QlNth+dx20ePwXb/zsqqAPuGXU A==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672852" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:00 +0800 IronPort-SDR: 1uCOj8AsNyXUKhydi61ZX1RA7hzlbONVGCM7aohGm+2lN/PBQgT7YzPC9npvOeSzelAC6NhwdW JL1Z+omDHq7dv3+Hz9GbCEBPp8XnVjQUAvSQ8SkFI83/QbfVqkbNPvGrCb/jdPMnjVzbeXedKz sl4ZYhxTo+u5AZA7fIzLaJ+yKl6tn3gFhEaHfBKFGyD2UE7h/QtkilUK7gWtal98Wkp3W9zpHK OkWyKpmqCtUjF2dWYw2BIuAex5YRvTba35mcS507LNiFWS754LAJlyoQNwUzNe1zZOrRr6kNHa Sn0= 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:30:45 -0700 IronPort-SDR: hu84V3jZx46hwEraig0LXQQ9C8XpSBIO6XTGB9pDNLp7rKKsf6bia2072PkFMByCh+d0rCq+sR KzWze2bOJZtPKB78C8HCOcv8XZsO5wHBA97OXB8L0KqMYxhbKFaaAMyShVW48UEROyK3Qwdzly HE4mL8tAp1LxkPWrPNJ2lvmb2X2qj83N7UtkLiwo1J1LF/i9TU1XlJazkjqqJ7qmqzKklcUW39 z8BXZsyHk9r5ZiJReqNNG21+Q9+Vy+cFmuYsdmbMFTgnoYiX0FYOqz6+7Jxq8JAtFbCLRV59wL rfM= 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:20:54 -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 , Damien Le Moal Subject: [PATCH v5 05/20] md: use __bio_add_page to add single page Date: Tue, 2 May 2023 12:19:19 +0200 Message-Id: <20230502101934.24901-6-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: The md-raid superblock writing 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. Signed-of_-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- drivers/md/md.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index 8e344b4b3444..6a559a7e89c0 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -938,7 +938,7 @@ void md_super_write(struct mddev *mddev, struct md_rdev *rdev, atomic_inc(&rdev->nr_pending); bio->bi_iter.bi_sector = sector; - bio_add_page(bio, page, size, 0); + __bio_add_page(bio, page, size, 0); bio->bi_private = rdev; bio->bi_end_io = super_written; @@ -979,7 +979,7 @@ int sync_page_io(struct md_rdev *rdev, sector_t sector, int size, bio.bi_iter.bi_sector = sector + rdev->new_data_offset; else bio.bi_iter.bi_sector = sector + rdev->data_offset; - bio_add_page(&bio, page, size, 0); + __bio_add_page(&bio, page, size, 0); submit_bio_wait(&bio); From patchwork Tue May 2 10:19:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229066 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 CC79DC7EE26 for ; Tue, 2 May 2023 15:38:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 889276B00A8; Tue, 2 May 2023 11:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 837226B00A3; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 577776B00A4; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 24B0C6B00A3 for ; Tue, 2 May 2023 11:38:08 -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=1683041888; x=1714577888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rBYMP1Pe8TwSmYGwoyghl6QR/JjrYRcvKJesaYzswP4=; b=D3Wnw6H2Qwst+f2OW5H6KJIainsBTN5O5iTmPvDxGLUTSodA1I6C6Lkt ZNlxU2yXxfWkngJEihxFP2o5DCj+mLLiNKERWytShBjFCb0m4Lgy9nb8I 2+q4YxJiPJ4PzJxeUaH1b+PkHizqIRJj971dzRRXthzbE4h06SCeTKGQv 9HkimXf/yXrH2P5zOloGI2IPfaOmTwGGmDkWWwu9Pj8vhK9L/XZ6HEm9G GiXoF3hViXNnSernFkMO2+5JeV5JvRuqd7pCJFV6D8pEFPQ6qlwgxI2Dp fDZaKy8ZjE69Pkm2Jj6Cgmm9MZ8L+mfts8eSAknHu88esV4i+kGYE18om g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672857" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:02 +0800 IronPort-SDR: 9L9PWMp3/KLKmbIfO7alb3nunWHBad2ghr62R3KkxmLqFUZO0az4fYzkIzHbMlJEV47iU+5g43 68y9YaIOL0iR14muxMrlTT5aMzH5W7J0GKkT3f7GZXj+XQCzFQexo5Nsf39r5aP273jsPBYdWw NYcHwkyPFUJ8OJNGY4Lm17E2aBoLhB31Ef0aMZwsmOxU1FoBf0/uA0F8KBtX2ML8IFPBadkBPm dlXt6SsblwAW5QaTEP2RWvWsstuv5RgHMIEuWgImTjnUs4XGfiD/EkPpavey34k0JloEYeLHX1 tqY= 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:30:50 -0700 IronPort-SDR: SZmZ1SHPv3v95++GFX5GNI6yfBnql83s333Ffj/oLNOQmf9D8iy/39hpJOR20wh2bRQOn2BLgx JgK8optZpMM29mBuHDuYbtPMvrfJzCOPOjU1ETAscqM/qXxlIOLWAiI2L9V4G24RfZiHJtRFwb nHkwAJfuiGHAeRk1K8JkyFhVzb1twO5S5KKCSXFwkpHiNNZYu9hoApYEuIS5MMXDA41EViqm6d CXVhoNk5GYQRyxsfvtCIIoju6VaQTS+kujPXNp1hy/QiGKYe0KkAqZ3LX7HI48Z5fruOSDEpAU 8cs= 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:20: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 , Damien Le Moal Subject: [PATCH v5 06/20] md: raid5-log: use __bio_add_page to add single page Date: Tue, 2 May 2023 12:19:20 +0200 Message-Id: <20230502101934.24901-7-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: The raid5 log metadata 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 Acked-by: Song Liu Signed-off-by: Johannes Thumshirn --- drivers/md/raid5-cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 46182b955aef..852b265c5db4 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -792,7 +792,7 @@ static struct r5l_io_unit *r5l_new_meta(struct r5l_log *log) io->current_bio = r5l_bio_alloc(log); io->current_bio->bi_end_io = r5l_log_endio; io->current_bio->bi_private = io; - bio_add_page(io->current_bio, io->meta_page, PAGE_SIZE, 0); + __bio_add_page(io->current_bio, io->meta_page, PAGE_SIZE, 0); r5_reserve_log_entry(log, io); From patchwork Tue May 2 10:19:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229069 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 02E0FC77B73 for ; Tue, 2 May 2023 15:38:18 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBA0D6B00A4; Tue, 2 May 2023 11:38:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A604E6B00A9; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 79AC56B00A6; Tue, 2 May 2023 11:38:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) by kanga.kvack.org (Postfix) with ESMTP id 39C756B00A8 for ; Tue, 2 May 2023 11:38:08 -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=1683041888; x=1714577888; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FXpnjgB/ygwpmZKJ1wgHt/Ki7pqawjz1WS6cXCp7ZKc=; b=i2x5844rB7sCuLmMvEGJ7wek5U0WyUJS8PUfqGj3+kDnUAVIM/6sEAkR 9hzSmis1hCfX5BvmBvyKa2X9ry6e1yT7rFEqlVojG0dDpDeM0cUuf9FHK WRJnekwcq2xN62gUk+N0EMazZTUNF4ZC04meoh+jLUbh10mJi6SgCtgWz IthqTLrAja3RaRKTljvZ5Upb7aRR2sQMyoDaxBXdwT9m8GYZy4J9X9NWE R1Oa8yzytw7Aqw7fCYjtZIUSX3LNtj4OyDnAKkO5t/kuaVXOUWO1vpYFB HgafE3e547YRPqAEGe/nz3Q+yp5pB7SAOZ1HdZ7f8O8my5zTBH/NuqH8A Q==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="234672862" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:07 +0800 IronPort-SDR: x7uIzFDIpLNjfsv9gcg/sA6+9TCw+s9k3jRFTs1Df5soYCWlCF+Tb2kIXzK++eGwUbtvkxnRKo 86XmxvOJys5yMeorSEU1oY/qP8SDIRQbKF5Jm6QWeuGDU6UH7MncpyL3xNujlsZiwS3hUulDwQ bU/v0xbpgf8LXwHcmJKA8nXCCB+mHgKB/MlMRGGGamMTGW938LaJ8NV5SS2Cba1zxLTCv7rC7O 2vdz3Anr7yLnyVNZ7hqLj3XWFJzz/CMNR9cXH2srQuQ1joHcu0sJlo7JznX/CLeW3Cy2ie1KZm vOU= 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:30:54 -0700 IronPort-SDR: mWtBTTHy90djKAbegefmDyP3WKoM6oP2zY9LncgzfFocNlEb1JermO/6eC4ZJMDhie29j2OtjW lptdro5cMeGM9kaWql7Z3j6h1oOXaDvNIEWz/ThhgjCFgs+VsseeDM3qqWWaA8jtZNxr812aSF WPCYWUlvjcno+HwbuSlNFNmNJdeO4ey/RN8/SbWz6G8OgGdzvlz05cLYWgBmoPXtw1YB+d9bMD LEIXW/AruICqoDNWgLp43Ig0EObTHoQwnl65bD70v5tSToP+lRLcqP1Zp8ujMKyHqk2IMC6uia kD0= 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:03 -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 , Damien Le Moal Subject: [PATCH v5 07/20] md: raid5: use __bio_add_page to add single page to new bio Date: Tue, 2 May 2023 12:19:21 +0200 Message-Id: <20230502101934.24901-8-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: The raid5-ppl 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. For adding consecutive pages, the return is actually checked and a new bio is allocated if adding the page fails. 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 Acked-by: Song Liu Signed-off-by: Johannes Thumshirn --- drivers/md/raid5-ppl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid5-ppl.c b/drivers/md/raid5-ppl.c index e495939bb3e0..eaea57aee602 100644 --- a/drivers/md/raid5-ppl.c +++ b/drivers/md/raid5-ppl.c @@ -465,7 +465,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) bio->bi_end_io = ppl_log_endio; bio->bi_iter.bi_sector = log->next_io_sector; - bio_add_page(bio, io->header_page, PAGE_SIZE, 0); + __bio_add_page(bio, io->header_page, PAGE_SIZE, 0); pr_debug("%s: log->current_io_sector: %llu\n", __func__, (unsigned long long)log->next_io_sector); @@ -496,7 +496,7 @@ static void ppl_submit_iounit(struct ppl_io_unit *io) prev->bi_opf, GFP_NOIO, &ppl_conf->bs); bio->bi_iter.bi_sector = bio_end_sector(prev); - bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0); + __bio_add_page(bio, sh->ppl_page, PAGE_SIZE, 0); bio_chain(bio, prev); ppl_submit_iounit_bio(io, prev); From patchwork Tue May 2 10:19: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: 13229216 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 59F64C77B7E for ; Tue, 2 May 2023 18:07:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE0AA6B007B; Tue, 2 May 2023 14:07:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E8DAA6B007E; Tue, 2 May 2023 14:07:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D55E16B0080; Tue, 2 May 2023 14:07:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id C4EF76B007B for ; Tue, 2 May 2023 14:07:12 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id EFD04C0F6E for ; Tue, 2 May 2023 14:53:38 +0000 (UTC) X-FDA: 80745608916.11.13A712A Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 7F1331A0062 for ; Tue, 2 May 2023 10:59:28 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=LcyFOd5K; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=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=1683025170; 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=rsEwzp4KUsprajGpTbcSGFfmf+KMGB2h2D2G/ECnUFA=; b=fXmmSsyWrTvLXg7J32WW9cq7AKTNcZ78v/kFj/mUFBxrt3xIutelmiWcz0+xD81GelpFRR H0WaS4eZXoEA3j4C32nEeFEFrMvUb7Ab2dZgDMoALL7LCJiDyO2Gtct4Ugn/2T2ZbXMUMp Mp9EdDW+npVbvaOn51UejMpkr6UfLsM= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=LcyFOd5K; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683025170; a=rsa-sha256; cv=none; b=RueYN99XpH6dn8oHsU7G+GhIJfEFDMXiOF1797LsSRqb6j2vbMUfPXlUpctHp4fConl71q PRrzuQ4MFAVHb4yR/hH76w1LsQQnibaniXLTfnDfNIpfD7655tkabLrWlb+YruyQy5uuyc HxbcG/4KH3IHaJAIwiWyrCK42GAM69s= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683025171; x=1714561171; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GdWYuRal4gtN4Ezno5RYxoKK4shSZO/plZI344B5fU8=; b=LcyFOd5KQuvM6zhUCwAB7Pg+nwvTCrpGDbOf/p79gWbPSF73nIMLOoOY HNgJYEALvoZJhXOny1lSm+HE4kg9JSAL2sCaqHggUUQmq+DE2a8p3IlZy jZpL11vGoC/Rc4qd7jqHdqv/WldCP1+D5F0eaEQOcB/uezXTxtIbq8O/J Gc+TfX2NSNoRJZbaEeNo8XSJRfqER3zbIrJ121ydBCSWPZL7ZdLXFh+k+ 5qOvYfZHgd0idgKcKgBY4sh4E+aQUJEkV64uiOSR2Kxc2DTkCU1maKyNX 4waDKHxoGTT1sI5C+ogRuKy4TOmlYeCO5YEXxKpih9YJJDI87OcwipLVW Q==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="334136181" 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:21:12 +0800 IronPort-SDR: biZg+vDCaoP4K5Sa7PigOyf5hdxfzK61lvtlKAgTRXA8WY+X4kpxa5aWxqxaFKDC6ia1MCGIks XKhMvFsZB1MUy+t71J5hgGokOhJ83R4cyazc2L+Kq0nfc7GYzgKrzX5o/TKqEOihdX5yl29uet gIc0V8CBeBdQ0s6IvbJw8/fxDXy83RP7PaNkDkcITkILBPiB8qwICLHltLmSqNree/hKjgFwNO bmmfWOy0hzOXsCOT5NuCFPJ4FAeJtO1R11OQdXW1ZTvH9PwDi1DnuU7w2FE2kRBTTX1Wkq/ji4 tYs= 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:30:59 -0700 IronPort-SDR: /S22iEpnOiCcoykSs4awuNv6zgGhYXfplgG+S3pD2v+040jaGI8/UT37PBAwwxcjkEonrgZmkF MJPvEWtr1zVH0AIddfQ67gYFP3HKB7q55d5Q1Kb8u6skPN7kRW+WuGOCfae67Jkkt8+4Oaw0js JkBz4bNt1kGrsBmJVm+4KD8wEnX4pNgSMaG3kJRUQiB8x1MM+ujOP6oeUZFhoRrtBiBmuCy7MO c0PlJP0a2U0EUVTKgLVaxjO9oJKo1AU/i7anC+hCZa7jKJqlBykub1Cxy0u0yhF0QACwsoDW1Q DfA= 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:08 -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 , Damien Le Moal , Dave Kleikamp Subject: [PATCH v5 08/20] jfs: logmgr: use __bio_add_page to add single page to bio Date: Tue, 2 May 2023 12:19:22 +0200 Message-Id: <20230502101934.24901-9-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-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 7F1331A0062 X-Stat-Signature: u9bffd1zyn3t3wq4a6otx4d9y9pqwo4q X-HE-Tag: 1683025168-711188 X-HE-Meta: U2FsdGVkX1/gj/qSCf6LmvJYv5ExbU6cJfgkaI6LkqO4f9uJVtD7zpn+3NStHk7ZhxUHlEouAfgkUXGt3z4Gt7JcOznQVirMgecD+L5m9uUvS6ibMx7szTNWU72ZhlHsrG4xgDxYJd1oUu3A/L53NnnJTYOTPzl/dFbwyFYwl/OZV5XkwRHmo6vahU8KJR82RJC7cnPyEu5x2Cj+cwLTih8Ea2GBhU9SYF3tUsvIpm1bGUnrUrBuv/1PBNT7L2N2sFLi22dWN1MnEwqLYkb2RiOrm5rsIYmKGdOc80I0tZY3w9p/QM4f2NcogGXz3daTaVAzDd9QTu1efsOE1Oki34F/0CKFmNZVHPxgFv36h2P2zpAjJRekBWQmzAK5K0qhQt5R52O1JZax71N2RIl6Q8QZR8/85tUPBRxRNO4Lp1IwxF0akUEQr+/QAd0oKFMXydHBjYXJSH3f1p4MBgSsATk1pbe0ZmPwOkOUiBOHAM5dDcfEsKh3WuS7cWrisgrURt6kKHW49FEj+AJ3Uqc4MSP6qNZeWE3+HSY38wJ0/mHH8+S2yNYy9M8Jp/nxkZUE+huFpugOwjYfveWXj9dreGwNp1CYfQw6wTlViNkjUeQlYIE9TtyQF/nHhVV6WUSrr4Mh4hn1Plmx2z/NM3HqvXPvTWHyj1vdELRgibtNFkoBG2BAyfGtFyELHtBBOogH7dAgYnwNrMzcj2HZOajrdbLhqvP1pZqZsWmp+WAXVu/gvDR/hlefZM80QowPnig8qiBnLLXt0YKzHOJjiK3MoE3dqbB2XY+NYptjVADMvqXUskuURWaJ5yDSfABoea/6Jy8xTEMIezf/u7Ru7H9wYcpSfjUx48yTebkyrJwfg7S7gKYVxQUhdhqCgeJX69JU7RKKFjH/zYiZ4l6hfpKxzxmEFGOHEIvw3K2bdp5BfShAOHC82iUKrtPTYqMfbMMFx16ICJ3u3a1jMk5sh31 rDSk9X8u CtExg/9z41h9thsCa6XH1O0P76evQpcsI4gALT51el2g9wGDDltR4/gMhjiqNiKxlBLJaHK/QSwBaNhMGORPAneS2E/5plLufeT0ZeA50UAlVZwDB7RHKnt/BfyhNZTIyecZbe9zLK9iJcTVbh/mlu8/djsuFum1otumjN9wnAourvv1jy5OkMe5P5I0V9zp88UnEzFOQ8pXYL239r2uBxqCY3w++sA69wQE6 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 JFS IO 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 Acked-by: Dave Kleikamp Signed-off-by: Johannes Thumshirn --- fs/jfs/jfs_logmgr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/jfs/jfs_logmgr.c b/fs/jfs/jfs_logmgr.c index 695415cbfe98..15c645827dec 100644 --- a/fs/jfs/jfs_logmgr.c +++ b/fs/jfs/jfs_logmgr.c @@ -1974,7 +1974,7 @@ static int lbmRead(struct jfs_log * log, int pn, struct lbuf ** bpp) bio = bio_alloc(log->bdev, 1, REQ_OP_READ, GFP_NOFS); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); bio->bi_end_io = lbmIODone; @@ -2115,7 +2115,7 @@ static void lbmStartIO(struct lbuf * bp) bio = bio_alloc(log->bdev, 1, REQ_OP_WRITE | REQ_SYNC, GFP_NOFS); bio->bi_iter.bi_sector = bp->l_blkno << (log->l2bsize - 9); - bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); + __bio_add_page(bio, bp->l_page, LOGPSIZE, bp->l_offset); BUG_ON(bio->bi_iter.bi_size != LOGPSIZE); bio->bi_end_io = lbmIODone; From patchwork Tue May 2 10:19:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229059 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 854E9C77B7E for ; Tue, 2 May 2023 15:25:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 15F6D6B009A; Tue, 2 May 2023 11:25:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 10FD46B009B; Tue, 2 May 2023 11:25:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F19EB6B009C; Tue, 2 May 2023 11:25:27 -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 E0D516B009A for ; Tue, 2 May 2023 11:25:27 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id E818F140E62 for ; Tue, 2 May 2023 15:15:12 +0000 (UTC) X-FDA: 80745663264.03.485F6A6 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 97E0A1A0041 for ; Tue, 2 May 2023 10:59:07 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=lGxs93O8; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=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=1683025149; 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=sMfs9uGDZZcQx8RlHkkvHPT1eKV5wzaFCK+Ux7zjc7o=; b=CmrjEPtZNUfmLMdOGbBxPKh/CAGHl0bAkQTBMHCqHT+KzgX8Ji6R4eXhiQlKLt4vJTzP11 blvD7J7jOVYgERUjPYJufWpI7VOIKMleTDQD3tIMpjlJOwQYwC3VpI+5NJyG+f5oMUkrtU Gh0EcR4Bio60Fxprr4kntZ1UtP7i1LI= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=lGxs93O8; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683025149; a=rsa-sha256; cv=none; b=gUWC3N6IZezJtOcJQNACPXcJmKMf2u5aoO1G9qebTFVyBBC8mkE9Rcyc1kQ/F2Tz7d6IAC vn0Zk73BSGBg6O81OmBKA1OuHDw4EtUA0qcwRizIWondP9EPbzAKMwgCSij4S3l83Te+Fw pcpH63bthbRpq0fYYa88fTEZBGpzj+c= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683025149; x=1714561149; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=z23s94WSfkNDSGnkvvUzyIU5xJO/4E/eLJVJJaqm43E=; b=lGxs93O8+WmlZeqlMa4mbRez0vNSrNNblWV7VLULoxq8Ls3VOQSZetBt 1kVlnOefvyf6rbpcq5qz6jhTapKxA9QXq328S8wJ5oA2zbYzDbprlO1RI Xp6iLrfgkeosFtEiA1BxXdwPdMY8bvQmO7f7aGFdHHyBLw17ikZxiNV1b gM5cvBngb+WdzqgwnkfETzDV8Dvho8sa2hYsXjnzI+HwZONlkQEwT4hdg oIvYAKJVe1fJMPxJ+DQq/hKB1gKjyHPCsI9qHbFfvVbkzlI5U0dh+3kZP U9HuYH1KTvt52AyuQ6h1Z3NUZpOyHJMc55t2JNtZ1mshYF/BkMeUBk0T0 g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="334136187" 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:21:17 +0800 IronPort-SDR: k/txlx6JPpS4t2BeDQSQJWZZuG/MtGfo0soKKJz+8Asz45W0kn8qyCAWRIcaRviV6zyyKcQd7B KoFZLL1xhJR5IzsGo9mbSis+7JLiFepEG0KNw7rfz4I7JUjcPYlxWcVLlhcys8Bwlc+AwSskSR RW8rWufOp5wjlkIBb4coCeiU/d1jLJmm3Qa45Seb91Iu6jIgLj1Rra/c71foXklmi0SxH+kYq7 dk5TnFARfHqx4EL0glCPZ2INTzRWhrrS8lsNi0t8gt+AGk7lq+YPxz1+CjtUtw1tzeGR9am43n JLs= 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:03 -0700 IronPort-SDR: 4QS0kxeAR11TAsjK3q6rHbu4+NZzJ/T6AbVXb55vKDbMM+oCblWAbUFs2YUG9KGIgOHq6CvJL6 XUwNm6KOwnm57J4RnjJo/YsJf7KQxoqDGhV11a0uPsyKLzme4AtvTwC+ST9Bmtyv86ntqEq4hc s99tUUKJH1Y54xjx3kIzWz1UZPM/tbIrLj/KWTho9Mx5xM2253HnCZK5jP5kww+0Kbc2uMt5Et jTuZjzyn9MCje8+jDXXIghxbJZq3kwbYIlwQW8gMVAhOzG05xOEF+r5ej7Dqx979eenILJzMIN mEY= 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:13 -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 , Damien Le Moal Subject: [PATCH v5 09/20] gfs2: use __bio_add_page for adding single page to bio Date: Tue, 2 May 2023 12:19:23 +0200 Message-Id: <20230502101934.24901-10-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-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 97E0A1A0041 X-Stat-Signature: y6duhxwnqmp6qr6tanjhf19xp67a7iaj X-HE-Tag: 1683025147-247056 X-HE-Meta: U2FsdGVkX19FhSXuRvrMBJ8M+qudcY5yOUIW52ZoBThVSTwbnxkwqVVDyaxPvG1iNpMZcSYGl9aj83gnzMDSVE0XP1olHOlRSWTH5ITSM2YaiWwgBLU/Fq7whT0Gdatt72UEKKUQ4nA0QvJUhn2Y6JzZWPo9e/B/YNpiILiwT5ZiSQjtOlh3/uKVeOmvg62U7h/9/YThJ309idK3btCg1joPMFybYMsPGhIFZFNisVxiocbikVuXyGT2pZgi2HcdVrJuJ4TCQk4ifDp7Pcx43PwsDE6alHRnMvevclR1/lgij86Iott4ho/1VXWtBCm4sRUkiyIkWO42TcrfOdIBaFD76Kb44L4k5SnfhBFDPtNe5RdBcmOl36FBDvBq1tMomlg6t8TAz7cxStiAWGA9YHUcPfnupmeNMuCvQM8hxAWHKKDum9DnvjsRsPQ4f+XLZdwL/MWFnI9aN8fJ4wPcWriXhAMg2Zd27u7giI3i51OLaKWgHwW0VlM5W8ubFU7JYBpA3/oWbe3KrsPkgf4RJB0ITi5FJiJCm5MQv77+VyxvvA8FxdhRZW5MftK762zVf+zw6Nr+19uCXooTSkksoG4CyafprlzIYSX8lTZDNSKBUHroUy9KF6i9FvUnA3tnfPghbJjsAL7FndrHkkLd9Nv97Uebc9qV4GWCExnEC4fsONNihNYeRRCYW+V629VZa2a4jnWVEmdRKw6jU4QPeCUswkgp7d6OdmwEeSvi+ju6j61E4i6LR5w4fKnn5l1P7b279RavbhqJ1pPQQIr6ZiKVg99QspwMvAQQCJhRLHhosHdrc373rRsIRct26tLxW/y9E15niMBw5AeR/QLATXzGmB9CItUjYoC7mWuAvOiwEhT3klb/mPvBpur9HFCfay2H1+m6AL4C0BTD0KUEIPGZhm/6W9fJ7kvITTt0R30PZOoSl9XfxdZXrMlXMZgA/+VIIVYfG10cdwOoUov 6w52g6BI cu5m/MAu3oVhJ3JTn+O5PdDNWfjlq+doUqwKWwyM3m8ITgh5VIGA7OMo8z0vNaE6pV3/O4Bdzr0BmANa+t0G3QRc3K8itHXZAmnpw1kOt7Z6qGa6G0KwqHqT6+d0n+WRgvoQdbPz4Z8aoQfMFsLfMHkriPEiBaZ5wEfMqUtTjxl6aD7aIGLNyemUjXb2Pb/2NbXb2FuZLW9ACwIKVVxW2IrfisiSA25xvTt/l 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 GFS2 superblock reading 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 Reviewed-by: Andreas Gruenbacher Signed-off-by: Johannes Thumshirn --- fs/gfs2/ops_fstype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 9af9ddb61ca0..cd962985b058 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -254,7 +254,7 @@ static int gfs2_read_super(struct gfs2_sbd *sdp, sector_t sector, int silent) bio = bio_alloc(sb->s_bdev, 1, REQ_OP_READ | REQ_META, GFP_NOFS); bio->bi_iter.bi_sector = sector * (sb->s_blocksize >> 9); - bio_add_page(bio, page, PAGE_SIZE, 0); + __bio_add_page(bio, page, PAGE_SIZE, 0); bio->bi_end_io = end_bio_io_page; bio->bi_private = page; From patchwork Tue May 2 10:19:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229192 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 2D356C77B7E for ; Tue, 2 May 2023 17:07:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AD4B86B0074; Tue, 2 May 2023 13:07:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A85686B0075; Tue, 2 May 2023 13:07:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 924EE6B0078; Tue, 2 May 2023 13:07:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7DF076B0074 for ; Tue, 2 May 2023 13:07:44 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CD04BC0FF2 for ; Tue, 2 May 2023 15:14:13 +0000 (UTC) X-FDA: 80745660828.23.78DA8C9 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 82D791A0065 for ; Tue, 2 May 2023 10:59:19 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=IDN0G5Sq; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=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=1683025160; 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=3h0oefEWpX3Zb4Sip5N1P853j2l/GeNnp4CXfPNK+d8=; b=KjSyPIOXaxMsptsFpohLZZKmbhWgvSW5JcHwESYzFnoCjRw8JB3a0q5SLleANZItDSduX6 NbC8a0JbR/YN6bIxgmNNnMEzhlr1VfJBH+NZ/XbX+3sUWgWlrzXqtn/Ee4gfEARl6O1pMz OVhh+zrwOpTwOwi8/DvUJ+pztfObUwg= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=IDN0G5Sq; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683025160; a=rsa-sha256; cv=none; b=RcLob9YI9rdtx79WnD0Kf25G1dAED87djTto5VNX7BnuANrxg36lieI+n9Eymcv3QgXq3X EDXp4d1WUyzvj/BESC3ZIygbcB+STbcr8Oueb9VpYDPArqc0Cj5xNS9FwzFch38/qg1AR+ rH59ESgF3ZDSeHGJoGaN07bmrxRpDXc= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683025161; x=1714561161; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RNSKAHMvkQdyo+4c/AL7LVpo7PNOthlJkp/YVH+vRC0=; b=IDN0G5SqUOCIfO9gk390IxHUOrRj7kUL9j3cMj32bjLBtgr3nV9PqB4W FqPGyohwEV6jC+Zf4RY2FBLP1+lg13sFCEHFxQrr20v8l6BG+ttWNzCN8 2sDPUssPf29N2oF3wD6rjBEiPlGXRw7/xuQIrjsVkCYeWBnRh2FatQpXJ BCmUODy9hz/bVKdZcWOYKDwLVJGk+L29rnzLqRdyZ8dL6u6kaxjNWLUeZ DGFpnHQw7iLB3QCw7L9rSCag9Kjzyfx4FiYv/b8aF/RRCSSD4NZvWD1pV kz9eK1XhcsuR2BTVnukLK15eVhwiKe+R6xkEyJ/3KVoevZJWrDzUn5zjx Q==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="334136192" 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:21:21 +0800 IronPort-SDR: H7Lid3qbyjK/KqgulPyBtl4s4wtDrkMXnngNAm+7XlSHMoFYLxwF75LKceBmFyqp4A6/TJ/9Lf khzeuuVZONT9jO8T5a/8ZWhRBltLrp8z65ijEiZMszFJIP6bMXjDApMoL0uXG6Fr5+HE9J3RnK Waa+Try3KesOuAr3iNu1Y7HALwjtu3YCbX5UhOZGMXQhVF0Q8QkOm6R5Ch7OHbyArfNbxFS0jQ bV5oyrIclMGp64KBisk/YCVlYeJg9hSwCk7OHchozU3TSILWaNPZ51w825QcFfLK16An4Wh39C HGM= 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:09 -0700 IronPort-SDR: OXftfXuzS/ylyqnOnxToR0e4rnrEE+M2SfxYzfUhqTVRY+geH2QOyPfDvF1cGkLL9mbJeyp2hq mdIqLtoGwBXeS5BfK4Z8vSFMEtEpYjMxerMUsh3kSYcWBq9PuNhF4VGLXxRmBwCd6wr8/QNqqs 4tRqp2Zxk4Qwc4ad1T4W2sP+crvnVDa5K20G/IUHvqVpxEL7P4R/ByV2un4SIHzKx29Qilb89F qgu3l1IZBOG+QkdA+5gbyGPQWJMgjJxs0Ml9+xbzyuALTexLar2VhaNNoCD6dUf87J0wANr7pu JyY= 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:17 -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 , Damien Le Moal Subject: [PATCH v5 10/20] zonefs: use __bio_add_page for adding single page to bio Date: Tue, 2 May 2023 12:19:24 +0200 Message-Id: <20230502101934.24901-11-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-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 82D791A0065 X-Stat-Signature: q1n87qyzimmg6s8oboim5p5ztrhgm4qd X-HE-Tag: 1683025159-662574 X-HE-Meta: U2FsdGVkX1+Iq7Q6sN+d3PnBj/fZlrRlHF6AADHtrjDCDai2ceM76MrCYMiwsovuN+EqKrXei1bQnSDaV+rcBocK+go1WDFSEvPDDrhiRSok3ekyik26J/Xpbc6k2Loqw7GHudpOEcnAGbtDYUJihVjaZg4+RczX1Dx6fz5v/tmlc/HiIElN+BE3aKjKgXWaW7Dq23RrFzVPvPZRSvMAebrUNBg1qNBFupmmpFjM6U10xMgyvgwfydnPIH1m2uTjGwqhrqk76Hsa8tw3Yquo3ZUKqmyyBdIH+e9wxITGaHmVUdhKDe+6KQ8kebomQ2qwLkEMb/Tnvu/bEOWrFXKVTxv8HKU2mKEilPkYXfGdJZLpfZ6T1lSwl8dy6M6WwQ5335ZsxfnPYepWGqFbmZVl825u4/OhapmlI6op48GOGPFq6nCdC0SWFYyEzo0MQfTHM9q8wAnHxbWgj8RMmD97nTK8GUZzWMplsJa1lZs4+zfrxu1TKlzyA48DvJPN861c/qER+Dlj4kzkGNHsUdgOOVan+WSNLTs4pjt+VdzjyTEBiuWZB8VqHGtbX5HLQ4l56AfbQrdDLn3bQ7VxAuhk+zYUyaxxchstq1wL34ooonZmLuMmuKJxnIW3c20TjFRhDnKU49Rqo4Yb5N1KxxB6e1nLV3sZNgSOYktfJrPlkqxEV2+6q3daKGe2iJ/cLtB0SipD4314Ue1ce4BaE87HTm1TtR5/kjQnz3mkuqO7QuGdymXZau/w7VsR9+rOaCMiq1Q1S3mpWKtgDfYjsSwLE5zqDCoOPyo2Ja1dTEzjyUBIF45TdrbJtwrKvgUGcnvDkiSHRBZbhvXjwrIICUobTEvjbwN3t25MnpVhZXxQL2pSRVZhMZzn4INdBRYGJAHGJYmmsz38UKbdKuGr+4Bg6Io2spZm68gb71hZdovi1OiJ+cc6wS3JTK8/7pq1PNuOLKpVdWHF4dQOODiQILF LD4e6HPK Uuxt7Coh4lxWULBJYVuCIUdpvvL6NMWAWB2JXhN3sFUkgHR+usO82XYN8nFfa2DaPBDg1x1mVzqzW7QyKCXriVRRZhXiAVjyyFsQtlM3tBvNXK6zJ0GqpmZnLyBlAF21Hga4E12hNnE0p9crS9ay8SIzJ9Zp+SPwspgU2Pp4hLi0RiFPifRvBOm8bNGA7FVYU+aNOIk3Girtgx+AYl4Iz3P2gx7JB8G5glw4t 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 zonefs superblock reading 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. Acked-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- fs/zonefs/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c index 23b8b299c64e..9350221abfc5 100644 --- a/fs/zonefs/super.c +++ b/fs/zonefs/super.c @@ -1128,7 +1128,7 @@ static int zonefs_read_super(struct super_block *sb) bio_init(&bio, sb->s_bdev, &bio_vec, 1, REQ_OP_READ); bio.bi_iter.bi_sector = 0; - bio_add_page(&bio, page, PAGE_SIZE, 0); + __bio_add_page(&bio, page, PAGE_SIZE, 0); ret = submit_bio_wait(&bio); if (ret) From patchwork Tue May 2 10:19:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13228769 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 BAC42C77B73 for ; Tue, 2 May 2023 11:10:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 36AC1900003; Tue, 2 May 2023 07:10:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 31B65900002; Tue, 2 May 2023 07:10:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1E2A1900003; Tue, 2 May 2023 07:10:10 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 0F329900002 for ; Tue, 2 May 2023 07:10:10 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E04B1AE0E4 for ; Tue, 2 May 2023 11:09:51 +0000 (UTC) X-FDA: 80745044982.22.CD910E6 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 2A4511A008E for ; Tue, 2 May 2023 10:59:22 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=nvsEUxVp; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=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=1683025165; 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=xI6cyga7qbtZXy/icNZEKJMGvLFWipGc8tNCJkGzHdo=; b=5151/D+Yr4jK0UkFvZGnhh7nwYowB/NVYzJx8FneFwipV1JAZSbpe9OMLiFP6k7iyj60Q3 y+lj5PH5a/KU87d8pmT8ga6YlR0xhVRRaqM3JgS8xwcLAu2qMUnbd1p7Vusq9R4a0rhHvQ V6ZUqVxBZZ3Apd432A88dNIqbRNEHAk= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=nvsEUxVp; spf=pass (imf19.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com"; dmarc=pass (policy=quarantine) header.from=wdc.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683025165; a=rsa-sha256; cv=none; b=j5JzHPbT3OdmwYkqH7hHz6TEPYt2oIum8BZaOsFW4iB6EV6N1KLGRIccC9KiuS2COGbAxt AMmK8+3qGdIfyH80c6yPAaD8sBgMLJBIPBKjkvE9eagikao9Pudj9kc9bR7ThhECUoCZ9/ C0/3XIxoyGGm6RoekdtjGWpUyKeSLoc= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683025166; x=1714561166; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gvTmlyJDrtB3jz8iBa+x9pcB74OLTnG9vUDo5GkRHDI=; b=nvsEUxVp8vXoOawnWJNhSpE9JoXhnaRGW/rjMpy4nhhpG3ZKjtSTT0U+ GP60Shy23MaKH4Pm6S+SdKvenZoka3O07Xp00Y9eREcic3xrjwP+dIvOZ pjnSbMqWsybjm8UlD0hOuGF3rzcUd16l5f6blUcOgAX3LkHEFMFmGvMjA ANqYws+rVuRKQU5FpYs7RztC6Gq+XejGDlPnvDB19wsOHvvR/NjGa3P5O /o/sI4aBRd2U6LSxxP4Dq8vBYAaAvZulE5WwEibVnFBNiw50krzEUb+yL a2vhS/5dAZUq+hmy6O5Wpx10E30dPqa6qXZEyZEhhuT/1tvLLQIxTXFiy Q==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="334136204" 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:21:26 +0800 IronPort-SDR: CbNYf4XMuHS6te3gHl9QUsNp+EKksKAVdJgRyNHMvFb0Nx1lrrkn0eQcSQevKzD+9eU+xgM+Bl wEJetMKDG4t1aYiPf1/9H1vGis/uZOVdEBN+sz4Ukr8t4al8LsTcLsBS4g2Tny+2Xgg1a3RuDP lcGGIoihs854/upTPZsh7KqUXJjCosWH1kFmeKzjmDfmT3I6irHU1i5i+GZm0zH89/+Yfu1g5q KIKn80RxpSlT4NALIAo+mNopT/O/dgcslYpdVTM4ddRFw+ARaKEeechpZef2KrjUdgXiepSWSG CtM= 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:14 -0700 IronPort-SDR: wp2VCzSGIEBx+d279yxevBn1+XI3VuKvqj8oLKNceK55K/eOSJmgxWhB2EK2yL9r249YKUNO4M bGeHb0y1gSCYoZWdb1piBrcelHDZIIRDff/B8f6uw2wt+EBKzLtgHpS/if9aysTLwKYYR4CmyK Ut3+BZdj8uHy5barmhyvli41TJGJFb4YMPGI659Z9H7QJ+LTZHxcRB0MAMkzGM2yCWWsIECayM KNaUJNela6Ul6p5EBpXHf43F6gec7o7gG4gWdqANgAE+DXYIfyjuwn3+4ZYonG6bdrIN5mcSTK NIA= 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:23 -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 , Damien Le Moal , Sergey Senozhatsky Subject: [PATCH v5 11/20] zram: use __bio_add_page for adding single page to bio Date: Tue, 2 May 2023 12:19:25 +0200 Message-Id: <20230502101934.24901-12-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-Rspam-User: X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 2A4511A008E X-Stat-Signature: znu8b6ua35jszcxod9ynb7cftasyj65y X-HE-Tag: 1683025162-768615 X-HE-Meta: U2FsdGVkX1+CfC806vf0XbgsLEiyLgCwAGUYq//8gg8wqN6ikdCVxUBlBhkbenkD84pnDKHWcAp9IW5ulny/KnC24A5OUpLnyxduwE6AsKWaLUjg8DW8DGarMxKrDG2y/3MIhMMvf53tQ9My5iC3gLs80/YEDckeJ1kY8N6bOX57b6nFpAr8oB9aTLrsTwrD7ZyLFgiPrL5Na0S4Xt68QWifatRrkjRl+WMvTHJTVik/IR1YMYx+uKGfA/IapwpFPGbfjRG1rMcx6EkWkiDVkMBXIgxmG8iW4nG4GCu3fERO4ehf/p9OWpGDie0sGemCp6WRJK1nAuTkE5uHcFnnlI+njfn60zHMoP8ifw8ZHyF638jzedoyKb8tVUJQFxfyTnNUKJO0Seifxv/6ClCJlfYmJCM3jG2+yNtxEAQHNghYA9na+CJE37Mr2fKgBLUIUsdAprNG1dPYL48rumqoSZFv2omr1IoPJrVSbGlrmzjEwyS/Lo0EZJMHLo7ROmI8mwbvm57XK0H1qGwxVk3YKqFRHc7opiNmWgnrxsa0Fk8TarxQEHRvBY8+TErrXT1/vNByqwJlTVHgl18/Wz5QIpv33vkF5ezLzVWJmXwJC9LYqep27RGguCJOgFeaixpiWrG8v2nQiMnzDcdQq/VcKeqivCpbRAIpk1AQlLPC83+66T+nFRgSWF6SCTnjS6r+QnQAsjZK5Fc4zeBq5MNB2DeHixC7ocOAZvnJnqa8RdSDQyCpLR3F2gRUxNqHuk3hSUVNL0gXPWmTv+wxNB19669vjsLvjD0niX/mZ/wo2K9Kvm6XrgFHlZIl02m75BK2vEURigMfRESbExsgPn12QQK78o/hVM8fba+V2vcap+v8jiC4WffBWFeXoyk1//dO+L4LwQJY1jVjemxTcAdWNcqxYyhKrmD9Zc9DYfnVgBHJRBh7cEKL+A04MrWgOSYabUeOu8kPSQLwPNl5PF0 wIlmFpdh uLaKYAjcSEU+5K34oy6qDSHezvd74NhFLR/fGViOVWMcGRUQIcFyA9XLj0UyUkC8nBFMABZtK2ahgwvzUtvkoMmd/NNIz4sor7rG5bUiETHdvTZtWtnUnieg5Uyh9P132IfeHMFzpTBDXcS7NdD05dv7eBWOwx/wWCqe0uEPADHdvekK3bK6USUo06ThNH72ROQdhNWUuAjV35gKoET1khW4F8YEKCI/u03C0 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 zram writeback 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 Reviewed-by: Sergey Senozhatsky Signed-off-by: Johannes Thumshirn --- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index a84c4268257a..4b9ca6d41b92 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -700,7 +700,7 @@ static ssize_t writeback_store(struct device *dev, bio_init(&bio, zram->bdev, &bio_vec, 1, REQ_OP_WRITE | REQ_SYNC); bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9); - bio_add_page(&bio, page, PAGE_SIZE, 0); + __bio_add_page(&bio, page, PAGE_SIZE, 0); /* * XXX: A single page IO would be inefficient for write From patchwork Tue May 2 10:19:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229181 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 260D4C77B7E for ; Tue, 2 May 2023 16:59:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9C5E16B0071; Tue, 2 May 2023 12:59:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 976966B0072; Tue, 2 May 2023 12:59:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 83E866B0074; Tue, 2 May 2023 12:59:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 720D86B0071 for ; Tue, 2 May 2023 12:59:03 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id F2A271A101D for ; Tue, 2 May 2023 16:28:53 +0000 (UTC) X-FDA: 80745848946.28.56D2F8B Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id CAC84101633 for ; Tue, 2 May 2023 13:16:46 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=RJH0mIwp; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033481; 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=6gN+DiTA+/9c3wZqFyeMfWipuKVVV7MzHdNdjuLDekQ=; b=d+ercAfOLIvuPcSMv01465rm2MFjryUoVTHEbvVVwAOJrGYCoPHzRPS1Ulb6iKXMLJcr6k JPffmHu/2yNIK79tfbHnxoB59SkiuRzN4yYuQL0pzKyTjrQwa6wvQoON/IyLkyvQlBJUfh fjfkj9rseJ4vck2lBLO+1XdHCEwmYJw= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=RJH0mIwp; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033481; a=rsa-sha256; cv=none; b=4gA13y9+ec/Vp/AN96/bKbRctdDwjYzSWrjt29nQ0Mrj3Vssrq+s2cG/oxW6vHahqo4rRZ 6vDr6SV5GKBPB4HsQxtWbi1eqV+LCCdN3stNvE06vIz8eeCZY4zIHBuke2cmBJCSNMOSrF rW4aCBtFPTJIXI/w1FtfDcT/x8lEChM= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033481; x=1714569481; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lM+HCnb2fRYqmeoa2+i+xDIe68f4nLZ6E3joh0Z1hsQ=; b=RJH0mIwpy+r7+QZ3R8nrgISsX8DLbW3SwAObC84eKiKPNaV4qu1diaJQ E3Fq7aBYw/RaZZwwu45VMVWdyM/zQ7kGlY2eyk71OvL7hpw/CyNlOib5L o544QxkLhRYYgMOkfylplgWpI+IFRnJ113Tf0qVztKpupxR6PS/JLPn87 1e5QhNlGqzBIjJK2QAX6tXHdflqBpMYqcx0kX9sxy34BoSwuBRjpgs7yT K5bvjv6l4BeJbq/0cjToVkZwm40pf9aKqfoz/Gm6bIMJ+iZ4gJjwyveaF I1iBm+NiJRTM4of3UU+iVFD2Cpw2Wyw5ctfBQOcGuCLOa+tY47E9mUz0q Q==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747200" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:32 +0800 IronPort-SDR: KwADaa3xjgp95S5leiZ4DDbD64Tv/UdExHB5AuqQxxNSlxIdNJ5ToR4NEJoXvt/DLfhTZrUe91 A2d785Dmy15+NM6eA6CBejwpYt3T9tPKdM36C5fdjF4HI13I6MUGmPCU7MU+QqoLVkb67ttIHd Y/5s9XNRE7ONwljdt2KL6pKbSrA1G+k4jZ9HZQ+U2aYY/PUhK6TJhahaU8puCkMRzkgXD290rE YC0FsmqI3MDge8hxewYwYjHDhkKkXWs++O732usdBctNvSp8VFlWNZHd1oqUXUK2dued8ktajP JZo= 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:20 -0700 IronPort-SDR: TkiaafEvpeoB5UVbk6lYF+MYIKTW0x1TS2RRFIsFup5dg77OzPOoA5o4aAAos3PeRXd1TAf24l JlqeganwqRXCePrMzLLQEwqwOlT9adKZ9UM/6C0SJSTqBI7//XMecxlqe0zSjF0DpZR+H3rbbZ XfOqZl2WmlO21QDDTnBVjbgyy0RtJrgM6I1boLg5EX+OGdLvmaW0Ll6RgEcSoJodKWqqflGCKs Tu8A1VT6jrxtAAfmzI+1Km/Qb4+fbicaPop5zyn8h+LvanboVG81oLtfNfwngSXAbDiAnyp6YK ZDE= 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:28 -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 , Damien Le Moal Subject: [PATCH v5 12/20] floppy: use __bio_add_page for adding single page to bio Date: Tue, 2 May 2023 12:19:26 +0200 Message-Id: <20230502101934.24901-13-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-Stat-Signature: ndowm66m6bzinjhidmdfa1o73abkf59g X-Rspam-User: X-Rspamd-Queue-Id: CAC84101633 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033406-30714 X-HE-Meta: U2FsdGVkX1+myHC0v1UuVaxRsNAl16rMYfy1QxiiSTsp5e01ZC00GpgJ5eBEudNQ7Fh6sMIZc3mP+RhIDB0rPeyABHWfSiKVOxIlgM5zaGcKmjPjxkfwX1y8dZuwsIG2g2l+qt+jJXtx8n4L3MEUnhl9kCV+biQRxk6RMtReWljPcAyHhqJJ6JtDInfU1rLbXEvNelxU8eW1OWZjbqY7tg9a2ixW2g2PXdNVRoRFyp1Y2dNBnPcKjG8gqE3w9gCC7Rih0Dy63bJCnPfn9zL8hRiF9Zh/lTElgeb14vypviq0IWiHzl7pJvJcbXzkSG9cwQeIz9UJnudB6B35LwVXQeJZTX6icEcksaw9uHhJbGAkXNmDoiQ5yiMhzGfLKDo33xq2TgcGrQD+IprOnXXAW3kb/W+w7hyOMCOLeXzlWLOVPQGpPGqTftl3ZkvZFbqD0Msxh92WASx9d5SnN/pTFnuNDq6cVYlWQ3vUsYw5om6O5XUNVbRbWDnuew7advgeZ5HCSs9TBsacMlLN7MY61GmDXbTBo7GZEVdrsPNpoEdyDWYIGHL4+He1gNIPC5j22moEXS2qViFxfNohgi4wYI3rTpXTx5lDco5tMprerta5cOZANzmKOIWDHZIu1chIu3dOZO6pp5ErPNkXH0EXAlRuFIEcfqv2laqqPwx24Kdy4AwqJd2LK4/PsG5Uc7H3soFQa4JbuWokU36/RuyVItqYpV3/mr+3+dwdfJJ0ec2kLpy9LYzvx+wwYtNgxf2a3RJNEvfzFWlJ2AAE1BcixU2AkE5k7CtzqUaJuGaPdpi1HRdkSw0O3uVSXuJ4OxCpIaTXqvwNktw/VJTHvWrBX0ECd3HUjnHZf++A90twXKFUnwowLeqne9GM4tlMznolcVWc7w2peAnvs4poJ/fU3ESZOEE/P014robCfk+JP2UK1N2/x6uku5uuYTgQm4J6HvK3Ru1JQirfQQDaGR8 Hlk5Pz7k ZyfQdJ3M4Ql45MmwAAQGtgCEPmEULG7ot7NHu0eSpVQM3MBYU1wgOD8tx7Xojv53CyrHVPLJmpWpwcfEVKldQEltrwfFtXA3UwJ9rBOCnnEVD86Ny1YbE/OAYuYCBPnhMsGEpeLwhRgVC+9TVLYjDd7h6eY5C4jpFeZNaoL3TZ8LgUcjkRA4/YTtnfpF8WoxtFXIiQeNy8lvZ5BPFXLepmuctgl9GDrCyTCli 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 floppy 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 --- drivers/block/floppy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index cec2c20f5e59..28ec6b442e9c 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -4147,7 +4147,7 @@ static int __floppy_read_block_0(struct block_device *bdev, int drive) cbdata.drive = drive; bio_init(&bio, bdev, &bio_vec, 1, REQ_OP_READ); - bio_add_page(&bio, page, block_size(bdev), 0); + __bio_add_page(&bio, page, block_size(bdev), 0); bio.bi_iter.bi_sector = 0; bio.bi_flags |= (1 << BIO_QUIET); From patchwork Tue May 2 10:19:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229206 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 9877BC77B7E for ; Tue, 2 May 2023 17:43:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 326D46B007E; Tue, 2 May 2023 13:43:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B0716B0080; Tue, 2 May 2023 13:43:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08CA16B0081; Tue, 2 May 2023 13:43:18 -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 EA6106B007E for ; Tue, 2 May 2023 13:43:18 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id BDB8981340 for ; Tue, 2 May 2023 17:43:18 +0000 (UTC) X-FDA: 80746036476.17.54F9F79 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id DA80D101648 for ; Tue, 2 May 2023 13:18:08 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=miKmQNAV; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033519; 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=mLz58nOU27a6t/084l1Lf6vRkGjs+YDPAFvRSQ2t0Y8=; b=Mi8xo178RIunJLsZ6XNADboMwsnW1IlgH2+g2buDowbIf2GxeTqh5nrcEuR6x109gZhKIJ btIEkwUZr/Wyxp2ejQFNSGr9i54mgaV+BSmUsALr31Ngvn2i57Gp1uUzA2nos4TEerz35u kW+taOemcPWD0hLA37hYzqVHUP7piiQ= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=miKmQNAV; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033519; a=rsa-sha256; cv=none; b=fYs/xn618vUijhtiE3PwRV0cEajs7zUaQW3VEl43VaLiegXqXaSHiLcwkTQd4syRBzAeOF /kW2tIlexh5oRz9o5xfUPY0qF/ZTb53x49pXYq14/5Ro70hNtKE+3veFWtE8LQwQWaPWqN 2JlAnCUffCRDrZOeSkRXlgzqVfgihIg= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033520; x=1714569520; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DzvJ6wZ3Sui4RZ9TAlD4OlMyP4gDTchzDlmODiRTaA8=; b=miKmQNAVvFyKtmMDQvRKhYfiTAIPO3iz2ibDWKql+vEmheze2OFTyz0l kqKgoNBWOM75xW95KoWmmfX7UgUpwkcy1T2w+swa8ZFONKhZW2CGZaCIS JkkRxvDb9V2qy0OCJzkkOW5y+BlW71S8lqgz9U9bViNzxo02UnD4M7bDS lExfaCY6sK6R+wTm5dESMKFXaE3k8sCverLPxYjOjMZwgUESTvtYTSrDu pRJiabGt98xGHT6+jAFtCUAfOFQ6i28SFLB6OTPw6vL1s14OymtfxP1/X yip9fZv3ohkawNuukL18pQRbKHzOB69uL6Tz8BYEX9k2tATKNCd6Hjy3Y g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747203" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:35 +0800 IronPort-SDR: zwChcrq9mVA0fYQ0MaY1MQZe9qp2BkImyz/0vJHZp6gzqEsshXslKcZPtNqYQX0fMTLAixeV5T lmsGz3WRIIMrldN9X6uyqawEwZpzIM7awJ5rJzjJoyNm/zpDJkX6E5YCSZqARgYmkw//lpzuk3 9frvEGlnJlYYvt1Rpf/yuokDtGKJpMjcCXfPCzhhqaDhnJ9dNtCBfTQbZPArZ7R7T+sfx3BywT IxvT7uMfp4p8qzS+ntgIUUdF3n4vSUR1IWz15ZbRlja2gLjuFCMfjYimx9XRBS4yhlHRESN8Yl fbk= 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:23 -0700 IronPort-SDR: uGIw254wyz5xW63y6mKPruYBxsDCJBiWJn5HyxXEKlHH3a6WQB95MJD2gL1U37MsE73pDlkDfH XrAQKE0o1trWaMuwmkCjZxReOE6bQKTuwcjttjZub9Fo2NWOrlg+l+x9Li4fpCvU8smOVgdBJe iX9LTVSMXZH6O+ImhKiOGTSlNSVog/dyr5RquJMBmwgwChPCFkHcE06ByPGE2sBKs5rW/DQtzK T5Xxpb54D4Yuz40YIDXaPoJ+wQXNcche+tu3/6iWe/RHtJ7xSAUbzgyNSPsRVFjywOIFjhKDZt 2iU= 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:32 -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 , Damien Le Moal Subject: [PATCH v5 13/20] md: check for failure when adding pages in alloc_behind_master_bio Date: Tue, 2 May 2023 12:19:27 +0200 Message-Id: <20230502101934.24901-14-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-Stat-Signature: o1agsjuicudu1ws9y5nojh86wuh395ek X-Rspam-User: X-Rspamd-Queue-Id: DA80D101648 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033488-733986 X-HE-Meta: U2FsdGVkX197SItrXYSfG6OGg1EbCfUG5Cbx2mLijJ0tPJqNcfmxls7iSiigRaXm1DPtY1wlvPnoFhI+K9tKbicVLT48meocO+cgIJjGJLSTZTH8MOBXX4GMRV7F3Z8ytEWMuUG2OsV3L87xnh9cvUy79E6+cXWgd/dsfOmvWDBputWrHaYCfKX8iXeec+MoNCYjzhB85Usx5iW1uXECgi0Tjgb6LBi+ycU3dlxFUJZ9Ip6TgvtL2SrH6jaNzNL1VpWYEtK4RGoI2bYBvRwGZeljjzT/8o9gaKjW4ZBlyI6MYR9rfCXn7925X8cZK1VKIirZpIuDGLGfSN6enEV4ON17HUgJhVo/pBBmVkymVbZewLbHZdgUxR2/e+nRFlVR4WK1XlNbcy5izw3NRAdRpmLl0ptvsPt7SwIkgZi6FIYl3LC1P40KpYQDST9ShpTCEzEdzWfQcSIgXMYKHxzrXYPIXpBr/32IhZx9vlLzCwC72oTZIbtgIPnvxRL59oylsOKvOO2NmIue0hdv/PcItv/YXq123ymE7F0aOtO5WSU3Q2Xt6+0XwbO3obrlPR1rdxwK6J4flfzjJ3X1f2xqiSFISYw7UT1+HXPGm/n9DZ2iWi9QnovDcmv+3WNulDoeyrt7TmF5iVOxewcMkw5aA6hjIA+drC5aaXawEUt6STODQZXJij+mRtxXbVy4NWPec3fpI+DgNOfykjo1H0i3Oi+J4KI4krHXWfIDsI833Ri8xuSHUJ1UAh6X5j99Nnf5VcifO1r4noDCK5Gj+vgMKtwop8q5zE2GKEObpfnXLPaigYsTdzt7+znkn+E5mzyXCJF1VM/I6LsWgFjwF//2YZ69R0ZWxeoXTDUzounXh+weNTdCbLNkNYixFRzB8jdKBkGu+Zq89xWATx4B0OXVEmC1t70QALQjHVBv9Ye+EvHs4n4+veANfKr+LiIVX15n71Q/e1m3hwmdUur+vMj f4wgcXdF W/ybf340ApSG14Bevrx1aEcUCI9uyB5xOEpj1jYC8nlgo97XHwQKLW+B2ovGQHFR15r07AHzgew/LUkgN+psSCPXP8d5472tKWENRUI8rziGwFPwRytX4u5/8iUffaItrDbYHyYwQp67efwtbI585+R8CdzDMD2XUYXFG8qFRf9iwx4SSGF4PNYINAb+8UlD6d2fnuKBXiWCOfWVlRgCsK2VyyH4mx9QG0Uo3 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: alloc_behind_master_bio() can possibly add multiple pages to a bio, but it is not checking for the return value of bio_add_page() if adding really succeeded. Check if the page adding succeeded and if not bail out. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- drivers/md/raid1.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 68a9e2d9985b..8283ef177f6c 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1147,7 +1147,10 @@ static void alloc_behind_master_bio(struct r1bio *r1_bio, if (unlikely(!page)) goto free_pages; - bio_add_page(behind_bio, page, len, 0); + if (!bio_add_page(behind_bio, page, len, 0)) { + free_page(page); + goto free_pages; + } size -= len; i++; From patchwork Tue May 2 10:19:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229204 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 7B9F6C77B73 for ; Tue, 2 May 2023 17:39:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0B6816B007D; Tue, 2 May 2023 13:39:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 06785900002; Tue, 2 May 2023 13:39:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E71496B0080; Tue, 2 May 2023 13:39:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id D46B46B007D for ; Tue, 2 May 2023 13:39:19 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 29C82160E1B for ; Tue, 2 May 2023 16:48:00 +0000 (UTC) X-FDA: 80745897120.27.A3D1DD8 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id 6A18610165B for ; Tue, 2 May 2023 13:18:47 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=jqP0izCR; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033556; 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=KaSFDGkhunda3gtibHVAaJqYH3WkPsJ5w2IIJp7VLpo=; b=MXmJuCQXjzvj0dTC9VSj7xxf66mRmOJfbPfy6f2m8JrV43YBbkvWVII8ig+af9qfv/mWlA OPO9BKI0atukSxIB/GJ4KLnLMJpr/CROrlnWtipUxT2WIoZ71gDEwFval3yaZyJ4tpM10t +iEhW0v0Q28L7qqm4QNhr5mv0UXb3yY= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=jqP0izCR; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033556; a=rsa-sha256; cv=none; b=8nOLDN2Ar76/xSSjssPkKl/Ks+RbUIaDXwZB3/zzdRQMgZ2q2wYfzHEbYac5THxGnSheR4 3mOAQ5ZwzQzEviuj9lKGiWraAbi2kLiYfaa8+eQ5Agy7c3ZIgUVLeJFLHskY+kiF4E0L3m ID42R15y6OSlbVzpdCOgzttALRMimhU= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033557; x=1714569557; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Izz1m415iRpIH2KEmuCSasFE37owqNrtjCwL859ZmdU=; b=jqP0izCROv+o75BAFt9hyXqAF2v8GxMgqHqMrzgiD69FmZmv/I49mYJI ppiMqC2XDEcZelEZVJNIG/uiJ8M088cdW6LcyspJlT4D+uvbbwNsuWVOM fZA9Rt7B0DkurqRgMWiKCpGaYFHU14ChRqPWTkpEbAkgjuh2XpTGGsW8k FhP4IDTXEplLkgZJa3ZHqbBN5gx9SE7B0xZ/uyh3YYaLSdeP+GYJv3b6v Sb8u0BeH5r/SnwvqVjDPIuqfXJnD1gcXwMLb03RG75/VvVFVqWuuLc2bQ c/arnMIJKzcvdD22cvC2LQpTIxOfEfB5yuF7EGF2rpC1Ji8u/llU25dom A==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747208" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:40 +0800 IronPort-SDR: cJ+HouPngrfs7ufVQp9f+8WFT9UVwwFCZH59JUttjqGp62CozJ2+4+jenabmA+vR445+XMMHYd n6B6ONnI7n/cbgy3EF0y9OQUJ4pGpZndluspBbZcgIx+ob1Wr7wu3hr7YOA/gAO/AIKugxuomS 7uBUm7cRSa5xWyEPymb96ARDf2HOrK1f6ikk8Jd44FZfUAj32eg8GYEl9r03rNsl1FmwqeziGR 8kg3gtLLM3bV4HvpHQpUjB4P5xM3YTQwlBiqd+IZRdEUL0Lh9vg+9RoH9brQdXHt8L+E3D7pEV yQM= 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:27 -0700 IronPort-SDR: 8hfezwIRYSWrrJUCjb8qjdEWmvQTAb8oREcSmYVL+8wk37Pg8Tp8roG1ZW+mjz9+6QAe4BsYpR EmWDRLcNeuJA92n5AIBbxiEh8eaf7kNTQoJEaoTjt7fYdn6r17LR46CVYDGJSihbaVMPma1L+u Irr0Z59+CdymlR+nAOTRZX3GKZJBGdjXU2UbPpLAYvOc4YKURimKOUi/xKoEJ7xmEC5Nk9TAiH owgOpkXcZgnwpHauY5btjBdZk+mI0uRcc4XS7SdsdzmLtvgoeCacNXPcdywNwlmur79/2ZnvYn +MY= 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:37 -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 , Damien Le Moal Subject: [PATCH v5 14/20] md: raid1: use __bio_add_page for adding single page to bio Date: Tue, 2 May 2023 12:19:28 +0200 Message-Id: <20230502101934.24901-15-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-Stat-Signature: eite5tbxix9jwgxy3sx3xgxrh74wks99 X-Rspam-User: X-Rspamd-Queue-Id: 6A18610165B X-Rspamd-Server: rspam07 X-HE-Tag: 1683033526-823276 X-HE-Meta: U2FsdGVkX18LEv5PgXUPnbjNvSZ8v3DWXjE/N+TMhj4UG/jNvtw5rujC0Zc5pqncgurKqXkxLyhqAttS79JZsJhp+/aHSuez/nsm0EbXZR1YObL9UHZnksgzEcneJSiLdOV9eakwxZ/zRapf/IviJySQPUtKYVSrPcTbSS64gb8erUipWfu0jSsLj2Y310vQ1wlDQLCAge5bRYHTrs3F8/MeMWCBsybXIvv1yUOCNW+0GsWejuT7B/O7E2ux9dncz4fhgxeMM2YOuOKBZUKMUaNTDkgidrdKRPC4qSq5n7lYz1gnwcBjg5OQIWeCDuOqG9XZSw5VqdhBAEX47dDpLfDezHNsME2CoIGfYfd7G5BT1zldkm2sNpxQDtd7euMOHsRT1SjlbfnLgN0+nGADIatWvlni8BDZttRgZRVRhlbhvki63Xvwg4SmzRb565NsqFcPH20R0vrCmL6ghpR/s+OznDY3lJ94OLWcYv89CWWlgxcSsOKL3ZvC1qIq2Sxh1zRnffuYO3Kq91CDLIZqW6mc6w1MzJONQwrmqXjUAx2iXXGKihQ3myzbQJP7EtDkRlZy3Lkl9QAHOn04j+aDkWJ7wQLyo6rAHWpRg+TKhgN9OHzRx64xJrMf6WwD3Sh3RqDEKNOjMShxVrGiQNsCvzEGDh79btmfuGvP6lycfKtgvanwaOEqNOtA3X3WW1zKIhnHGjIdeWPg8wZVVECX1Yw+LhIwSVbXJa2cGmwKxSoNyo+a17uqtybQaFo+f5ogzPItf5Ms8erpfbtXeJi07tuXp1UTR/Qb/2CdcB+H/lt9QtLx7AZyDpts+1bH8lh/aFxpvVRcZMUPGUKHLbCCVd69w2tBZI18cSLAKUbNOcgjVuOH2nlfuvgZz+Oz89iVjcVpW/nv/hgIsKKffYBwj8TNokbs2XucplDz9/YPmkoxj4KlURLgJLcOFblAl1dJU2rjCSYUPTyAERRLcrm WB25o/hT fs2O49mBHLEzIYoGgKAtQ/nSf2SSn70HRhnDJtneFzTjdbDkkQVAOPbas70jupSIQ5CPp3RJbGJcDsH20Rem2AnpCkVWfrq6KafoTBZlqymad6eJXjY+G0EK6B3R9+WmpJ8oVQfs7LS8+l7WU5ZSpHC3zu/xRUnqeLr7WWKvxxpbJmQJgj04Nn9xh7UHnJLNeXr+jG8EInerCA7Hnjo2HrR0mLrwQ4SsJjrVc 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 sync request 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 Acked-by: Song Liu Signed-off-by: Johannes Thumshirn --- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 8283ef177f6c..ff89839455ec 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2917,7 +2917,7 @@ static sector_t raid1_sync_request(struct mddev *mddev, sector_t sector_nr, * won't fail because the vec table is big * enough to hold all these pages */ - bio_add_page(bio, page, len, 0); + __bio_add_page(bio, page, len, 0); } } nr_sectors += len>>9; From patchwork Tue May 2 10:19:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229214 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 9F002C77B7E for ; Tue, 2 May 2023 18:02:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3BB906B0072; Tue, 2 May 2023 14:02:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 344A56B0075; Tue, 2 May 2023 14:02:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C0FE6B007B; Tue, 2 May 2023 14:02:15 -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 0782A6B0072 for ; Tue, 2 May 2023 14:02:15 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 9BE571615F2 for ; Tue, 2 May 2023 18:02:14 +0000 (UTC) X-FDA: 80746084188.10.E465AEE Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id 75133101671 for ; Tue, 2 May 2023 13:19:22 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=LWpiLqFs; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033587; 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=NgNLaHU9QWlESCBVKUtXudFIcgaF0fvH8qy0QANXYag=; b=ZG8C5Tj1bdtznF5cgDkEYt5iX8Tst6KF6Ya9Rp88Tw/s/+GdeM3uEOwsn974Fos4wK3Xl+ b20WYd1Uf0qwtBQGloV80I8rWuYDrj0w/sQQJyPoDSlNPAYzbE4jDUGFeeaYLlWOomQG3f 67TRtpuMoasMjMl0DYqqdRsuT5PfHj8= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=LWpiLqFs; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033587; a=rsa-sha256; cv=none; b=Owmi89kQQ4zZpfgEWWenxAGF96Yrnkvov3kOPsjcghi4GhhFN3mKIuahVI8un/LffKeTye EBDD1I45bq6w5sLJVSVJr3PggABR1RufoyuquVDaPJn5yGbLaFf2MHib4CwY6jE/iUAQuE o/iy6BrpJFKUQN36KF3NVgsB2Bb6+aU= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033588; x=1714569588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sbko2e75SNzKYCeOJLmxzwzkVRoxsgBH9ZlWCz9oYps=; b=LWpiLqFsdbSe7rQIY0qipj9HdXN0dQZCzSdkfg6OXPpDOx0yTqmgaNMK gZK8Uex2gS5nr2OutzlhbJsebvgANGBOeIoiYqONWU3e3vfUgaTk0HYqA TKWQ5BAt4CpBI9xtPb5sKSumHXw2UjehfhEWdUMC/a0PMAsaq2zjDalrM 8TOFMTC7HHvh7u5WWuB2XXGszRcrBjDkMNboInpwK+6tiB3y2OQKpxnWo Us7BC5TW5Z1XWPST7h8qqBMNnkDWSzoQ6nwJnuvnwwrnv3yMYdNTQkctw N/J3ebz2Nf170uzPqATeVs0CSKsc0wH+sXsQysh53vzksOwEEyT7sAuW/ g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747214" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:45 +0800 IronPort-SDR: He+GrAOQ3HgRlzVqoF//s024/7AIGA7e3uJ6yd046s2kU1fkwttWgNjaKbbMf+jhHSOEwNRro4 Dhvc9+uORVJr7BoJCcR/i8Jkkf6HOMOvvv3aPI7zGB3y7CNF1OBkzqW+rx5oEKJU7JNIeTz9ZD y4uVHA2tgCQK9C7DGFq1/gIdnQVQ7nXKShj1WSjO+qBLFkE0KM2Hzd+74ZU1+Fyw4V0wI4Kex5 1rGkSRHw9cRKyID9JlJKCY0DzMD0JISh6uuooq6HMKmkOYSEW1unb4VuyWVTDrR9vcZUQLzM3w bRY= 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:32 -0700 IronPort-SDR: ZWr6Qm7aWZaY8bdOiwef1PvSCYtgS9U9pquupOCJUQGWN9visATuWUPqvCvOMfvdDLIKZAhW8J 8PvGJ51TwreVCGTmty9sPSqI6NH5c9sZK7RjKgSCX/HDyjXRo/PbJcwapaM/ecHhWIXqz7Kl8U jgHztRbeeu58xdyiqpFqsVBRJgUjSHLJlzeswv16TnR3VZpldJyULjW+gWhIkfd2QZoJCL1ndd 3CxfOoIKDBYHgQDbb+Rc/apQ3FCRJszz/CpBb5cAqd5m4klOwv27bN++AJvOZeHo32NNrFKhtY YR4= 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:41 -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 , Damien Le Moal Subject: [PATCH v5 15/20] md: raid1: check if adding pages to resync bio fails Date: Tue, 2 May 2023 12:19:29 +0200 Message-Id: <20230502101934.24901-16-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-Stat-Signature: tueihcazwtmk6rw359nd8u16ufdjccjd X-Rspam-User: X-Rspamd-Queue-Id: 75133101671 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033562-137780 X-HE-Meta: U2FsdGVkX19zX2RAF3S61wTJfjLIB99n5myEiwS2+Z6CWqmRQg9N9e5DHyM4rfb/DDV4h4p8gpFIjs8lCBfI8/NJMAkHeJR+9WlE13/kzG94VomfaguqQnowy+J4056ygBRha0oVm2/23R8pA/VMBcsCZFx9O7wXn8F92PGxRlNwhg3u+PnpDPiDYeLOqkBjEWLhtkMUAD4EPa8RS3r6GY1fKU3lpG7UA8eR7w5qhrOcR4WJdirmcYk2uIeKbue3jxqm/mi6kkvPsKnBcaq3S2qyf2j9ZZyi39PV2K9+bMm5+HBREnZtPL2gHEW7GEDuMjGpnaXhoTFZRjGJ37X/PNTx5s4+c1JwcbMnvH4QyeIbVcZBOcGULrX08AW6phkNZoeSd6XrMmiRFhCyOgkrXQPl1SLn1tbpxhQ0gS9GUM6Yv1oa9pbwNVl7HnXYoIWA3BZ8161WMcNfp164GC24ofymzFYgO6h/7DNib2Axn8Z2Jtsphh/Kh1JpdOckyixZisLlix5zsgaBQTvXxMdv7oKspjGamdCZaoR19CUWonxv2ACTtJe6y56imlB/FiZ46J99Xq75LuK2/IKywjryP0VN9dVGNv6LqqBYye55rJzcuoSsGPobZGg76cqG2pGJTk1UfnRjEUqYC8d0T3mNPBkFoqKCMctQYCoorL7e4WCV4y91QOQb8SPtl2zaCTm57/3rYChBNHwcKrfPuMQAbKEvFIYwl+1m5/8049zvRFg6HDv3swSTfoviGwXK2edoncwF3f6YHz6laH3LQqDZDslcTaVQZlCRJrU5bPN6yK1MEWkvs4x1uc6c0za+2flMMK5oZULNQANzmq+1YM/TRZx/08ZyT2iNcyaZacH4p18iIITEGSaEJJvHNe9Ht+9KEtslum0i8f53bkASbGeqJko1GbD2kA9//wDrjgDPq7cJhuVgLrtT55sJJuOJlOF5mCjmSOx8+0J1xPCnt7V 4d2DPB+k P9bww8fKT0rAE3sAuvgZu2WVQnTvLM4T70V3dq+rkjb5DsB6HCklZ0i/1My08iflkeO2+kXuDK+EbaBZ2zRrCcCENhiwCkAognfoxnHv92nou982+D5x2dp3D4kheUBL4h/3+//FdGOnFgZ1E5g+T+PT6QOWmNyrcPeB8eWrVQPbATJmQ0P9eWWxo/g== 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: Check if adding pages to resync bio fails and if bail out. As the comment above suggests this cannot happen, WARN if it actually happens. This way we can mark bio_add_pages as __must_check. Reviewed-by: Damien Le Moal Acked-by: Song Liu Signed-off-by: Johannes Thumshirn --- drivers/md/raid1-10.c | 11 ++++++----- drivers/md/raid10.c | 20 ++++++++++---------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index e61f6cad4e08..cd349e69ed77 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -101,11 +101,12 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, struct page *page = resync_fetch_page(rp, idx); int len = min_t(int, size, PAGE_SIZE); - /* - * won't fail because the vec table is big - * enough to hold all these pages - */ - bio_add_page(bio, page, len, 0); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + return; + } + size -= len; } while (idx++ < RESYNC_PAGES && size > 0); } diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index 4fcfcb350d2b..381c21f7fb06 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3819,11 +3819,11 @@ static sector_t raid10_sync_request(struct mddev *mddev, sector_t sector_nr, for (bio= biolist ; bio ; bio=bio->bi_next) { struct resync_pages *rp = get_resync_pages(bio); page = resync_fetch_page(rp, page_idx); - /* - * won't fail because the vec table is big enough - * to hold all these pages - */ - bio_add_page(bio, page, len, 0); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + goto giveup; + } } nr_sectors += len>>9; sector_nr += len>>9; @@ -4997,11 +4997,11 @@ static sector_t reshape_request(struct mddev *mddev, sector_t sector_nr, if (len > PAGE_SIZE) len = PAGE_SIZE; for (bio = blist; bio ; bio = bio->bi_next) { - /* - * won't fail because the vec table is big enough - * to hold all these pages - */ - bio_add_page(bio, page, len, 0); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + return sectors_done; + } } sector_nr += len >> 9; nr_sectors += len >> 9; From patchwork Tue May 2 10:19:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229209 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 65D0EC77B73 for ; Tue, 2 May 2023 17:53:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5CC16B007E; Tue, 2 May 2023 13:53:29 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CE5596B0080; Tue, 2 May 2023 13:53:29 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5E776B0081; Tue, 2 May 2023 13:53:29 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id A238E6B007E for ; Tue, 2 May 2023 13:53:29 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 75D10AEFFB for ; Tue, 2 May 2023 17:53:29 +0000 (UTC) X-FDA: 80746062138.11.868A30A Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id 20D93101687 for ; Tue, 2 May 2023 13:19:53 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=SvKjxrAL; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033622; 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=A3Uxb7ToyZzCXpo6dytQ6jfGB5eFnK50HXW6JYeP39Q=; b=z7Q5KCXm1gmS3lNVK+B/Uu27G/L4szuQl3w/xlMbIpX2nTQbBEYCxNC5NP6Quo7NVQE9nA DlsdA6seArqBQTao58unaWWMUT/EVDRvCJAFGT1Qr7wkcCTWRpQJfukeOOLJcHTFGPEkmB MBApyLNv9o7z4dQjOZkDz6TGt8FrHCg= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=SvKjxrAL; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033622; a=rsa-sha256; cv=none; b=fxRDcYQd8Nv0IzPLufsYcX60d3SxHOpkhq4s1OesI1BVXnfaBV6G8mAlrcH8oF6wvPmUTK nyZ3EtFvi8N/EmnR7nGlDJuqvCxat11ONkUfqzzZVl2jBFHTeknTs43MmomKgE0njYo4vZ Bj128FtrfgctrBBZWr32m+4xFkxpiGg= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033622; x=1714569622; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=V5SKzmXLiqYlN1FT56vogdtjTkaUplMsRNtsQa39yz4=; b=SvKjxrALszII4WRxX+ChsAFfeX78PCOyLeOh54vPI6kI43XKw9agwi25 aGZmw4GQIFgMTyjqVWLcOvibdMuTY8xfZrKYKFEjHukBUQRxqRuk/IxKc wIR83EZC5pvZQAfs8E8FEQ0CVNJydMTPrBPXChNvgYQ5OnBDzVH1QHuML o/iAgL3brb5tgL+/VNW8LZwcqwfYkcc+aHeFkoklcV8sLATJbWn6/8OOr wQaPgqSu+woPEQ0su4H40DKl+Mg5RiMHRp2Ot3/ubqhhyuo7kDs4WckTY x7f4lolXxGLk2jIlsjL4R+KdNKUDk9HNdQq+M9cBLZzC9geHQKOFN3eSc w==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747221" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:49 +0800 IronPort-SDR: 85viGowTjS2O3YT9HkEnj45k4Cp0HglTRBoD3utV7EK9UL73pCaePLORpIrI8J7WU5HUwwOTEk BciuAbwJhPz78iECwTChfNAQPNbC6fwn2IiZkgRpwa/0G9KvG76caase5tweenN/MPVexliin3 8Fy3f3VVeiEdEQmwAUPEiai2k/yu/wWT5L3s50JnZzIKMOQHFpsKdJLjYiGvjec8U/8GkglQkc gDKqlokLmbBb0+OjrSCpHycO52uxFQhVlwjn4Awg+FNbK4I8/hCNfsVPWd4OTEDgSaAwV0KAtQ fNs= 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:37 -0700 IronPort-SDR: h/+Uzz4d3DSZxkslqyyemyuLPtMI7jhBm8cQQC8WAsiGwmug14lleOQVx+xkHcNGsmIX7lpU55 87VMP+4tfW26aWu+a5oN3DVTq3PFVs2iF9WR+8oTmTwDIaFXmRGIznTUpQ4aZU0a4rymtj3WZj kk/AGz0dRlK1ZycoHqrgPH8iVANoXrBCJuUG9lP22ljDr/8WOx6RnsE9CFJXzzQSnh3bYujqEQ 6hczuVykrgqMnIl3wnx+DJrdhTydW+7Qj1cYcXsZMgrNIFeXRvMoDlU7CYgbRhYHjf2G0hJiZj X44= 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:46 -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 , Damien Le Moal Subject: [PATCH v5 16/20] dm-crypt: check if adding pages to clone bio fails Date: Tue, 2 May 2023 12:19:30 +0200 Message-Id: <20230502101934.24901-17-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-Stat-Signature: 5q41ddfk4uxjb6fir65w79wxqrz4pggj X-Rspam-User: X-Rspamd-Queue-Id: 20D93101687 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033593-135805 X-HE-Meta: U2FsdGVkX1/h5n6zY0PujXdUCC4rK++dM+64e5ANBQ/nCa7HXecwrsF59ud6Aw8pIEvCyo8ncaQOq/Hk623ZYEV4YyfixHpcvhxkckhGKSTmnX0RPg6FgPaJOKFBeJclDgp/gjwkTCc+uCeeSkHBcMdQvmFvGD9JcwT2rsydgyxPb/ki7GNg217Zfo5AMTe8GIlSDE0wvcIRdUgANih/PFT6j4MUNCMO40ooYMYT/iVPRfYUQP+FMw+oUEHd7TVZua+eB+Z4tG3wVWHSw3m8LmpeUMZ7ivmLr7UbpJ7cGVVjTpudYCki/evqFsCZbcTkpizmecBxEKSw1agT8CDliZ3V6GkcmNrFabwEtfRkDqBFOry87F9ylWuy8xclYwv0FqaM51LCkzJNLG/dbM/DU0gPLeZG4wUp4zrV3JXMDTndybNMZGhUqNeJucfxBjSuTi+aPsEI52axQDuAH/WzD5oDePYJx4TMWmBVZavMX+CVxYpvDKkT83Cwld96RqPvQTsAi2FpcQz+mVpKWbAtRxRgXLzmDOW2k2voki/1VOkZ2pkcNjUEaNG73lo12OCI8r19en6ijtUDRxLrtBN8MTLHkpQeYyk96NkB/XZOhkxF8RItxWSUOQeFKfc7zgBrrudWGlZKRyRVYGfsZ5JGeaGwU3h/rUnXlywtNx1xLvPcrVpgc27fy3ox9FRjtq2ieMOXNakUz5MjwgadPjtwnmJrpvJsVITThnTr3UwEMKpIwD8HEC92MgtwwZ/9QotNsMYxrANu8ieioF8jCBzGvZz1FErOhkbEUzRSRpziAxjKsuD1+gtBGEfBpUW3gOKd7CXxjP9PF8VrVecMkvrOdAOq9A/pbaVrUyIHPBAKNFsJhEOfLM3l78jM96ftXY4UJPcbMZofZcrAg08mS90c5q6FOw9NqrgBbJMeVYGmZd0HmBjjIwARWWLjcOEyDT4IUxgyNxHhG7OMgVM0mxb 9iPxkeTY zXT0tfL04bwUibJAj7nz3GuFO0baqPDHtFuZYJR58WM60nlcJLNXj/OdKRx/wbDj4RHy+D6Zp/WaH2L1P0YSjUdoZPe+iKgT+7VjNtMtivR2pN8bHC7JpLF57kp2mydi/e48/neDK8Lc1Zw6LBvyB0bN0VrI3XtPgvohC5uthP1TMVUozX1P0l0pY5Q== 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: Check if adding pages to clone bio fails and if it does retry with reclaim. This mirrors the behaviour of page allocation in crypt_alloc_buffer(). This way we can mark bio_add_pages as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- drivers/md/dm-crypt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c index 8b47b913ee83..b234dc089cee 100644 --- a/drivers/md/dm-crypt.c +++ b/drivers/md/dm-crypt.c @@ -1693,7 +1693,14 @@ static struct bio *crypt_alloc_buffer(struct dm_crypt_io *io, unsigned int size) len = (remaining_size > PAGE_SIZE) ? PAGE_SIZE : remaining_size; - bio_add_page(clone, page, len, 0); + if (!bio_add_page(clone, page, len, 0)) { + mempool_free(page, &cc->page_pool); + crypt_free_buffer_pages(cc, clone); + bio_put(clone); + gfp_mask |= __GFP_DIRECT_RECLAIM; + goto retry; + + } remaining_size -= len; } From patchwork Tue May 2 10:19:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229191 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 A531EC77B73 for ; Tue, 2 May 2023 17:04:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 30DD56B0071; Tue, 2 May 2023 13:04:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2E4716B0072; Tue, 2 May 2023 13:04:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1D3AD900002; Tue, 2 May 2023 13:04:41 -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 121426B0071 for ; Tue, 2 May 2023 13:04:41 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CEE5080CAC for ; Tue, 2 May 2023 17:04:39 +0000 (UTC) X-FDA: 80745939078.11.BEF80CE Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id 30A9D1016A9 for ; Tue, 2 May 2023 13:20:52 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=PgIn514w; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033682; 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=QUuRbp5NP+IPgEW3PFFjEPb01UVY6wlfuqfl6L8i1Mw=; b=Bfq9p3BkTSJIw3u/yVHFMkDDZycf5hanWXJfYfF06unOukO0au79Djmya7KjgvSUbA7hsp H4HYvYZCSonahx720EAXpIzyuIwfJVFuUvAVY6T9zSVsRJe+PiQL1utH4nYIskDMWeYCUj Z2uKTk2E/w+pRw8dQ+TK+ref53Em5z4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=PgIn514w; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033682; a=rsa-sha256; cv=none; b=1TXy3GpKV1/lEeZjgBLUd23rjWO6lvahh4fgOeVhlx4HSqwLAeHr23avVvR/XCbpyPdqtJ Gg/+tAIUvi9kk8m//ZuhABcRe4ejuqSvj/pcJbWt9x4exf1/IA4Jm3RLtY4xEXnQabXLSc OS5obfcL7mnmjCAwAydRp09Kouoe0nQ= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033682; x=1714569682; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=6AfPyqd2+81HTNsYYrGTux663HCZhra0xBEupwD85bc=; b=PgIn514wIoA5oghyGw3bFezvJARiId1m4OaMtovgwYEYIxw5PRi95Pj8 R4ycKGk/BxgsZ8LKfZnysiQtUx+Jznel9kh28rKCWy6etLGHw9NROh1N9 V8bSrnWOqOuSINSzigT8CTjdVkrCXBAd3Il7L7xKwsBjRcMk8RJIprDoS dMZ3Bk6nj6dza63PtEXxkc1QcDumNwmQg8+rR16qZ38t91QyI9IU4kH0z aoNZVdjACfIjE+/ZQHCiI7BpL9oSWvM5AXlT65o9xhKgb3oOyn+ZMICUA zRISK7pfePTdArkGtxlJFNktn247MdkgbM81VXU8yBMRfqt9nm9kodZTd A==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747225" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:54 +0800 IronPort-SDR: PUaPiGm3d+TX/DugMh7DZyqT8ii8ZZTZPzH4lcHlySkNTctPtOBzNf1VDEjzlWO7yILRqAFnuK SKwPVyeVuxg++i1XS4Od2qObe+6A+Wz4p8UlgMg6cQ30ohSds1HjXtDaih4Uejtv2WhQ0SZULq g9rY+wv4Ku5QkfotNTZ0aZ1t/22HwTod/Tts3TewaVqFPDejfc7Cn01GBG+Gtwn7sib1RvMj7C TlKPFLuFldfjQxqYeMTiw1zsYGPpJg2mJOlBeCo9Tyh8UBN7j9BVNVv1qqhCYUJVCUxfxRhlCj lWc= 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:41 -0700 IronPort-SDR: xRv9qUm/jkFHj47mGNA/6praQO5Yqj7qnIh22218g9Ii/1T0IZaxn5IqFfB1tzk0UZbvAYefj0 /ajkmqJdSFIwqCAr1990sRV9STv6FmnvwMuCFh00tUkv1kcz55Tru+sZ+t3DxI2ItwUvm8O/TT gAhMfAT/LF6mCdTT/kjCHonXe81T0BejQwdHvS2IGUexu6EtwJUc2lkNjjtG2t8eY8jjwTl9Fp NYdkUfUEbsQHza/zSMGe0al18yoLgAUHBBNoGU5+ItYpshssTx8F6JYNPfvX9YwFGkWwD9ZVsN NOY= 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:50 -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 , Damien Le Moal Subject: [PATCH v5 17/20] block: mark bio_add_page as __must_check Date: Tue, 2 May 2023 12:19:31 +0200 Message-Id: <20230502101934.24901-18-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-Stat-Signature: zsuqw49oruy1czyu94uzeujm6y5ajs4w X-Rspam-User: X-Rspamd-Queue-Id: 30A9D1016A9 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033652-50910 X-HE-Meta: U2FsdGVkX1/zbcVs+AOL0ErFp7q51XlohBvtkvkr+54XLD+7SKmBijHhWBwh1VUN6+kaAFI7NX+g0QfdO7wu6PNTUt8hFGdD/N2KMenwfFemtBoBU6qgUGxRKgPK0q3mXFl4Jl5K0CqnyHEg6qj+wiCLdRGg5pBrspgcWv2Bv8cGucGKXurVIpoCJ1wVqgvdT8/M7Z2DbGfN7wqN2N0YM/z4oX2oLQkOn+L89VJmDeRz3SWhr91duc2xLpbrSCmMjx/072HnO01k8pjmnvwQw3HKHXAMuQktLPVuftiT1rW5OXYoJBKGd0DNPWW6BNMrfX4cQximpzKy5W7IOVjkOHT3sTLvdPZoqhGx+MONa1Y6a9If2ml4WQQtrTcGwS8aMcH4uIfXWLRvbufXmAgMcqYkRM61kQwW6aEbpJWwPI6xzdLPIyBfhX3TJX/Las6UgdXxTGC457CYc27mEzZmQLttJhbp1+JVnbkexFvFfddn87PSby45fckrFUCJUhBd0XdTTW+gRkq1r/qGLutFbtMn/aB/8xmnSdcpyE3FlTplU1j9m0IMNmMa5Co2PHZ+IuE/g/aHt21K/jYjkD5VDT1jH3wfYasHK3OfuvcNlifJ9C+4GMTOpgF8OIhIxNiLht1bOe81p77IIGO61ZXlluP9oXmmaTpq9DZD4vp/d4i5URECJqrLvo/sihPDr4ATd1YFeooGCEnRjZESllcf3uw9u4fSY/J6sI/t1UjVbaZg58/zUuCvWkopDU7L6KcxbK0C1DkzBiElWZSM5u4PPX68C4zmq/J9dBdm4KBWSSMBcc1KgDef2tBbh5ZWDZmcpyHwvnnvXw5LhMSxwpqRlRtFAtvjkYeXeQkI/QXT3u5HgUAZZBfVIqjyfvEBXuEF8gJApfFEu2JrFZGcznqfx03u7G4wHkrc9/03VJJxx2Qv9hNhU+eCBk4AYXkoCizymILgZIXiVvC5AxNtjeR OfkN6f/9 RpaJrQ6FMlxCwLDRryhUWVzXWI7eWUQ78rp0/iuWxEsIu9xgQHmRQ0dXysQC1PyC1SvfOUOLqooRCa8FGHvqw7VGOzcQgB66mbHb2biFzw6fjvqypC829f9S6+QqD8BFvnYiMYLg6QZMdJ+r0XW+OP+H19gjd4chqRIT2lD+KsJM0tJZJhuSrYxjZiXW5b6jbVilO6hSK1cil9NZKKdR4+2u47PGCOOF2Ymj7 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: Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Reviewed-by: Damien Le Moal Signed-off-by: Johannes Thumshirn --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index b3e7529ff55e..5d5b081ee062 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -465,7 +465,7 @@ extern void bio_uninit(struct bio *); void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf); void bio_chain(struct bio *, struct bio *); -int bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); +int __must_check bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); bool bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, unsigned int, unsigned int); From patchwork Tue May 2 10:19:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229178 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 E08F6C77B73 for ; Tue, 2 May 2023 16:49:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4E78E6B0071; Tue, 2 May 2023 12:49:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 498A06B0072; Tue, 2 May 2023 12:49:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 360016B0074; Tue, 2 May 2023 12:49:27 -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 2725E6B0071 for ; Tue, 2 May 2023 12:49:27 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E562B1C7F4D for ; Tue, 2 May 2023 16:49:23 +0000 (UTC) X-FDA: 80745900606.15.7CEF3D0 Received: from esa1.hgst.iphmx.com (esa1.hgst.iphmx.com [68.232.141.245]) by imf05.hostedemail.com (Postfix) with ESMTP id 05CC51016C3 for ; Tue, 2 May 2023 13:21:28 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=CVnT4Ujy; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1683033729; 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=MYBDhVOwI/2b3PaBKbTYoIa/G/0NeynYVC65r/J9gLE=; b=bLA0utmq6e/HBNTiewXocyKykcj3w5zX+qXmXqg9oCV5kushM+/Pdt6kf5/z9+lbGzOMs8 cGDCTJLCDCcHCD58JyslFnNTNqYN3pyM5HcfPn/mY5z9XeWMBJUIM0hlF7q+tYuYEr/dG3 ZTh3KrmJQjy/CSq6rlhHekOd9d1DTD4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=CVnT4Ujy; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf05.hostedemail.com: domain of "prvs=479dded8d=johannes.thumshirn@wdc.com" designates 68.232.141.245 as permitted sender) smtp.mailfrom="prvs=479dded8d=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1683033729; a=rsa-sha256; cv=none; b=S+AjNzLJxK7uQL6TdBaGZpo+NaiVLRIaXBCtR31SFAW3U3LlQNJy63hSd3Ckoy4suH7miw 6Hl4bVrWGbsU+jq6cTrKN/4BX+4SRC1SpUGzXS6+u/3xA7s4vOj4Q2wES5KOFy2jhVJKIs SNRe1BUM9RiRUOPjFNKYOYzuNGAwkTU= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1683033729; x=1714569729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MB8IrW3XRF0b8tjpVHZZO4VEKTGu+LfkwhaA4xbI4qQ=; b=CVnT4Ujy67MaKc1Oxk8qdqYiuVnccHaSBK757tjoJEW6ZfY7w0apar3R Psh7v7KSWq5q56K1apukoHn5W8awEPJIUZQw6zQgI7ySr4ZFUX5gdzGNk ydMCDz6VytwHFtoqQS9pnDXeFzMu2gI4RjCvPL0y/mWawDi5WcvaABN5r xWvdTJBU8VdYeD5bf2sCRbNWXdbtv3MHoEMS6cQXwMfudrmchdF3PUKbV cLjdwVu2AjfSpqXBJOx0PKWsB51Dyqxz+VdRueGSKOdb6Y8lOJvhnNXU+ 9t59spLNwtXexm0r4O8nfTox9ffcPmPHW1TiWGnJtO11Z2FYLRU4BR/MD A==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="341747231" Received: from uls-op-cesaip02.wdc.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 02 May 2023 18:21:58 +0800 IronPort-SDR: veaakyWQoMRG6xduEbnOw7lA4sA2LdwRzvFqydr0SW9onKHOJwP7mFArWYk7eA7FxEAvKhYUu9 FVWkYPfxcMld5tYz6CCn2AVZb9pWeb1F4cHpRAwdAJ543ZDtAZ0vHNuQ3FAA3Lml37WqlNCALh 1KqWgG9NwLcCyjRjUlyrAHLOpitWLni43565RqEW1beIvYiLr9zsBR6tZXprhJ12RFZ6hux45X M0xOyCixDFYdJ9z8FqcoQSMNN8hfiOmCi/cwG0azkxt/Iq/KPDWprHcQAe/CUKJ+3djVPT1gvL evY= 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:45 -0700 IronPort-SDR: dt0ORTo7y2OvtYPVqxqZKcSlk8TEG/M5IxYJloXDNMtpbFDpduCookvi33MCWWG4kgtbDfnjoU qNWcylSMPeGsO0kq0NXDl4G2C7gt3I+rFtkistntPpO5mSXx+HBp1mYREWSzEfGneChk6WparM /i8YU9a9mKVsFFGu/e5aSvIr5Y8Ea9LImoNB16+9AysmzPJOxOBZEoak3fvRhFlXukbVn/nkDx drQrakT6xd36x6OU6prDHLUpKa5+rnrr2e8A/8Ynql1R4XRsK2thU0KyPWPdS53E7jOulhZ7Dk rYQ= 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:55 -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 18/20] block: add __bio_add_folio Date: Tue, 2 May 2023 12:19:32 +0200 Message-Id: <20230502101934.24901-19-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-Stat-Signature: 5mzfnu57xr8h6a5jt1fmbzk9833ky3jd X-Rspam-User: X-Rspamd-Queue-Id: 05CC51016C3 X-Rspamd-Server: rspam07 X-HE-Tag: 1683033688-625362 X-HE-Meta: U2FsdGVkX18DaNLossmYDdo0L4w8hNADLVYuO5rpkRxssAKQh8/iDoS69q9e87I9FmL2oUFFlDk2pcXlFBs+ZTW07xd8BIkjYgPr9Vua2atv2O+HgNZAJd7f1bJNEwT/eWTIRKxjVSckm6rjGd9u0424RPhuZkIDnmby4Ml9grnqZ7H+CNdQf78oZL9ESh4DSYTJb3DJXH/B9Q3zjbenPFJaV1xGtocFVAfs7JXQ7Dv16kEijKoPaTbOy475h8RC9roT6oTKrdR3elJAwB5OTG6eOaS/bned1sdhycoEGH3kWVTzCVY9SST5h/DZIlDpzGsUxmS4NhZON0unG0UfH6vc8ob2VXT+siaoTmGwyydcSuG6iirOOmVoc3P86UGxGBzKMXKgEZAjHJdo1FuAs5N28nb4BGfk1oZm8cQyjjW2N9+WW3WVQzKIkvTbPQWqD1fUNQU5Db/W9YG3T7lZ9KYb9S73Gfetsmz80/8J/LW7zuOugY3alC6UWXG5dvdtMhtHSk3KVViCkg5MfJVoWkJ2A7B4xN5YU/A10K3PbJ5XIDWrgWoX8nExC1UQv2HVR6L1eb87kuuKQZRqaEa9Ju060VVNWl7m1M3PXbgqHHRXvJluXVt1mexV2U7g04m7zjWsypt5JEPjrcF8xl5zOW/Kcm9rbUjUJ5hLPjsoKVWz9Qh0r/f3kjqzmJzNQPqSaRH0K2P6XuyilAhMt+GqLV23z+E6zmz5m4HevLpy3NozT9s22z9qW1PKQe/OvGhTqRif7R8ZHrzuzH0TBgCoDA+F91txD9UCEBl1DyuX7Y5uAftDKYVkyfCbyVwxYMNyO37i1AZXpH6UEbsH2WeGwZDMplU2pQHUowuRcCBIlZUw0wriSpgt0sGRJ34NgJBslbr0JIfMv8mmgE7T6UgQU1tK3g1wOwBFiivhEA0151VlSt/O3Du3Ws0g4Unq6EkB5d85My3/KeLot0Vppm6 WvrgqP/g xpAo76vPhR/03/Rjrf4kFUwF7TP29ubz2z5FG2Qi8uaO4n2dYm7OT0oYXHt5BxKCw/GegRzHVv4pukyunv4jLdXhn3dYAusBtdKTGm++IcTZ8bwcWXHefK+ZKLT7Mhi88H164PGNxVN/gyGNZbE+SfEr0SB0eHa1/HWqY6OmsC3JNcmKhc4tBUAILDiRGRgaFam/elfLYVeuMI6oN2Obqxd9kHZA/McWSVBGP 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: Just like for bio_add_pages() add a no-fail variant for bio_add_folio(). Signed-off-by: Johannes Thumshirn --- block/bio.c | 8 ++++++++ include/linux/bio.h | 1 + 2 files changed, 9 insertions(+) diff --git a/block/bio.c b/block/bio.c index 043944fd46eb..350c653d4a57 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1138,6 +1138,14 @@ int bio_add_page(struct bio *bio, struct page *page, } EXPORT_SYMBOL(bio_add_page); +void __bio_add_folio(struct bio *bio, struct folio *folio, size_t len, + size_t off) +{ + WARN_ON_ONCE(len > UINT_MAX); + WARN_ON_ONCE(off > UINT_MAX); + __bio_add_page(bio, &folio->page, len, off); +} + /** * bio_add_folio - Attempt to add part of a folio to a bio. * @bio: BIO to add to. diff --git a/include/linux/bio.h b/include/linux/bio.h index 5d5b081ee062..4232a17e6b10 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -473,6 +473,7 @@ int bio_add_zone_append_page(struct bio *bio, struct page *page, unsigned int len, unsigned int offset); void __bio_add_page(struct bio *bio, struct page *page, unsigned int len, unsigned int off); +void __bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); int bio_iov_iter_get_pages(struct bio *bio, struct iov_iter *iter); void bio_iov_bvec_set(struct bio *bio, struct iov_iter *iter); void __bio_release_pages(struct bio *bio, bool mark_dirty); 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) From patchwork Tue May 2 10:19:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13229122 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 9A598C77B7E for ; Tue, 2 May 2023 16:06:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 104826B0075; Tue, 2 May 2023 12:06:48 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03D3F280002; 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 E45516B0078; 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 78DB4280002 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=Td/xHpC7+cd6575Kox8h68Aq0j3mdhGpI0NO3tgGxpE=; b=OuO+roAoSYvqifVi+KlHznAbBHwi9ecwvg4gWNYzIiQtt5a1ZOuToPcR h7EpZyME1GCGNGmCS4+piD3UpYbt8mY/mAuw/HL4r9FzcNK/MjrMufwfv Wq4eQNvKs5r457w8mWYSWE9j1dC0ys/zIe7hu4xDQ8G65yoKfJlPwS6DF IeEwkzQK0rhKJ4ajzF+Wbc2Hg/872owaWWneTzdB0LqzAuelVKfTQLlyo LSi6/kRWKYF8C09rLTwW42IETmJ3K37/qVJzZtvqPXutgiBJKnfEW4ho6 P+cLp7RAZQLVJbrE/8Q2ZmdMzJNVf/AWfXsCmRapY37edPgrGyeDd8flL g==; X-IronPort-AV: E=Sophos;i="5.99,243,1677513600"; d="scan'208";a="229735916" 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:07 +0800 IronPort-SDR: 4/e/Lx1Ku6vn/uuZR9yAV8Ict2AsHGaIixh6XmVenzSzKZz23JfUOGFo8yvSt+JzcrrTAx7SL4 ZzOpVLghciS7AZXNhUrJDtkusiAJg69qNr1WunU6907S8oYVzQwFxJCrbpUEa5SqF2j96Hu+fA aFpu8PGz1FgmRxJzBKcymLRttCQc6csTkE/+aBCNLRn3mXi1UAEj6mon0a3Uj0IvqDPNHKTHhM I9ukvf2jn6ETtRwacn5mTUyrdcPLObq7adRlem7IFvmhq8dad3oIPIUboD87l9GbD9SnTtcdd8 EWI= 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:55 -0700 IronPort-SDR: Vcxt7Z41NExxCvUESz1tELNOOoVAmCt8KMe9S2wfxXY5MtctxeNwByBgzDDJWsrhCsj1BHWV0Q ZGiNQRrLC1GqKKuIRpNOC2Vb5K9nW2DMjlmAKUuOtSKbHa7NR7aAFqUudcN/yAoLh311Vt4cBL y00A/34+CNpVnLGm46O2cceVC9lFxIP0NOPuIkoffYDZmLB2WN+NgV+aYC3+VTf4qWL5CbSVPK XjePJIBx125icTf/AqdLDhEFFImtpkj2dXIQOUMatT77zeeqXyuVF+60VJakWBDYsxQwY/CpIf OkY= 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:22:04 -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 20/20] block: mark bio_add_folio as __must_check Date: Tue, 2 May 2023 12:19:34 +0200 Message-Id: <20230502101934.24901-21-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: Now that all callers of bio_add_folio() check the return value, mark it as __must_check. Signed-off-by: Johannes Thumshirn --- include/linux/bio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/bio.h b/include/linux/bio.h index 4232a17e6b10..fef9f3085a02 100644 --- a/include/linux/bio.h +++ b/include/linux/bio.h @@ -466,7 +466,7 @@ void bio_reset(struct bio *bio, struct block_device *bdev, blk_opf_t opf); void bio_chain(struct bio *, struct bio *); int __must_check bio_add_page(struct bio *, struct page *, unsigned len, unsigned off); -bool bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); +bool __must_check bio_add_folio(struct bio *, struct folio *, size_t len, size_t off); extern int bio_add_pc_page(struct request_queue *, struct bio *, struct page *, unsigned int, unsigned int); int bio_add_zone_append_page(struct bio *bio, struct page *page,