From patchwork Thu Mar 30 10:43:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193880 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFDE7C6FD1D for ; Thu, 30 Mar 2023 10:45:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229734AbjC3KpR (ORCPT ); Thu, 30 Mar 2023 06:45:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229475AbjC3Kot (ORCPT ); Thu, 30 Mar 2023 06:44:49 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA3B93EA; Thu, 30 Mar 2023 03:44:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173063; x=1711709063; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MeMNKZaQHr+yr8lVVtTFZ83iufEDICJEVqW1zFBrgYk=; b=C7Z8KU+IBEEGYts1suUeuTPWdiGA1LAgo6JsDdqJ09Y6qjym/kfa1zMY 2PAzRQIBHJPoyiHA0g8cnfh9dHi2StcXfDFfX8Bo+sujt8UQWnDs9Uz9F jVXiduM9IZ2aildFgBD+HTSaeNG+KYKFSIm3KOXlqy5D/SApOs6J9rDEt VmC0R9m4oVsRRs6BFiupvWLun0SBJTkMl4awjFbDjQuA1rAN+f5pB3i6w qXThkooWVa6kLRp3hKi6mQdc37FR2rHlnsfARoNW87IZyEFmONcCN4WVW r74pn3CFVHsQux3Rl5Xmc7ubFHCQixSSkZbJ+mbM9ec5MeSsfZU8gjqC9 A==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317795" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:09 +0800 IronPort-SDR: 1t/aib4aoulpKbbRCbC4vdyYcse+wqtLZhv0CeSyrKd8nRFMgiQDee1kKPuh8HGieNTSDZq6o+ lZOA41Tvqyfq18WNXEEdXfqxlWmCjxq0CimpkxZjVY73IYmPebQHfGJIsdB7bgodKP9DmHG1Ep pAwcPF270na5uiS1AIHEu4hpeFY1R71Nx+HjsICTBlJN5FY4NIvfssQGjH/7iTbC+/rDRLv24+ WFvlcQBqWrtx9+ISrDkgaOLVx5EbZlFuR3bPUQjNnXHpuGkbRk7icLRv3wOJrY54WMPmMLO5WA ETk= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:17 -0700 IronPort-SDR: irX6OTnvg9dw1UMM/jf7hWOL5xe43IpHWVi+biFSVu6y2d/gmChxKlBzDVHMcPFGp/PtB7lqMk pBd6N7vcJjZegk2VaDw0/5ijey8D+sko6yUo9ep1HredzXQL3kXwoHvQPgPQwgLytjM1orqSW7 qft4pnKuKQ2O3XfxcS2iqqLj68WmBpFjU48f2PwSRkyTtwxu5wYQn3fHIka8vzMjRF5aE80zL8 5pWdl7OIVMeXoW6bPQzgsDJLAEL2hVYT6WjK3Ym27QSIeOu/Mm/2i/OBfOoisD6h4Rm1EKjgoI tzE= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:06 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 01/19] swap: use __bio_add_page to add page to bio Date: Thu, 30 Mar 2023 03:43:43 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 Thu Mar 30 10:43:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193881 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9E257C6FD1D for ; Thu, 30 Mar 2023 10:45:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230239AbjC3Kp2 (ORCPT ); Thu, 30 Mar 2023 06:45:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbjC3Ko4 (ORCPT ); Thu, 30 Mar 2023 06:44:56 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 151CB9774; Thu, 30 Mar 2023 03:44:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173068; x=1711709068; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=L3cfRA2wikfkIsf3C8GxTLr6ByhKgTx7ps7OwYMzkj4=; b=POEKyhA5Vk6lmOfMkoU+DV9SU4PDKYlj4WaIbCESewaBxJVZAFyWuHtq SoBryOr8hqkjXCwO+0g6bCRfpYyR9xNijs/TnxNRyjxzDwjZSvgffvBzL SptEixs3EBW1m1H+vJmQsH5ukIJR9o9ogPhS4m23d1W193r2Lvpig36eo a57xmD3QvqTsQ36tCRtynV3GSXDWgWJQplcABfb4MzxJapAyZ1gV0NEpQ 7tFRgbnw0Fed/svKh0a+ilDsy0CI3gR3Qj7HxnoZmY8ayoAn/nX4GFVUZ Aj82EO3TOXtc4u/jZkbmiNOt99PasZqFlK8s5xPLZ8svTmYfOZLThTynd w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317818" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:12 +0800 IronPort-SDR: /jLUXoPmBUMaBeihSuIwE/EGwONQSD6pRBO17B5ukOMtrKUiI+G6Ooi4UwdOPIU5aiRiVekypH sBcbXMblBRx+d9qqN9B+xqDtcaxBFFHdg26vQH1Vu5rIV0pEiymWSlb/mjwA6e5NV4h0iDwmk7 9GJWgKdkFR6LbMkk1rnZ2R927b6p96A7YQeylkS1ri0E1sT/TXQ4S2dXQ/MCYgOwhX/TMApx90 Dl99KRqUaNGunL8JcvBomxHdasUZquzCwAF738BfKJUDXrdfra5Kntvj4TN3UnPeUp+0o4rs2Z F84= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:20 -0700 IronPort-SDR: RehRzaThR0hc37wNjqkltJ+dfO/hlRGJetFrnAX1UOANVz9k5ZIJ+kSDt8opKJGJOwIrFyEeZk TwtDv9Huypg0wYz4dm/8NDnvwLaqh3eVfRvAkWkT6VvIVHouxmJ9cojW5aiBrZ2cuUyar8GmxH pM7pZBufBx/ouszcaAOPMBaDxfOwlbo6DAOIZUQEsZdRgiXOJyXcbpTXXM52G8GbwuePmG9tD7 6CT3hnKgyfR15tAPquXFKRiXeuWuTEb6OxiN0Sdo2XMa4aDdkQ/G6vt9d7MC/I6z4RZ/z+UW9i T4A= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:09 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 02/19] drbd: use __bio_add_page to add page to bio Date: Thu, 30 Mar 2023 03:43:44 -0700 Message-Id: <01716d15d92c2dc01607b0491199d7a4ad3fced9.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 289876ffbc31..050154eb963d 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 Thu Mar 30 10:43:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193882 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BA825C77B6D for ; Thu, 30 Mar 2023 10:45:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231149AbjC3Kpm (ORCPT ); Thu, 30 Mar 2023 06:45:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231190AbjC3KpE (ORCPT ); Thu, 30 Mar 2023 06:45:04 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF879760; Thu, 30 Mar 2023 03:44:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173074; x=1711709074; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BUmURHFdu9KejVTyXSm50CHGFvGjlqfpSblNCpyXxd0=; b=Fx+u75zK3MpiEm8i67+PCrCW4tRMLIoia7s8mMq7HlC9B/otm7k7f43R SYBWRb5HcYv2YlRuHUM0fmyRRfuPv7GgVTe+QIAk1isS70jIWsvGxDhNc KCtEnyUjZ9P3ul+lKBELbLcTPmdMgJu3P6PRGKAC15yQXGsSVwvbsFuHU l2Y9GXm768/WPQsZrz3lNwAAG11Tlfi2OfaI9i2MH1r+WctGtA0y29Bov glzzrXe20uk5bGx7jFRbPgk/hTQb72z9xlWT+4M4kVpqpBTAdK5VqnNk1 yHHB6O2RNWiv63FH/dYrGr+J9dYQvRQYzq3SkJnjTxjATz2o08lHQ8ylp w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317823" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:15 +0800 IronPort-SDR: IHAm92Wxhv+3KwieB4WAOtJd01Qev/gW2mlPlWquqgb/ikryZ6IwiBYInhk25bHnlSGPn3d5Ch IiUrxE6eFWxpkyvyCjFbAMzhAvxa4fgHBzo4t3z3cF3RxDps0zrx9mcIc4GuUWK0pS1mYXLbze 1rEeCi4rSrFC0BU5X7LQPgG3WBcDHDzSALoq7D6sRWzOmGVPDhQLUHLxu4kpxUKlLAwanxJ9nQ 2gXHbRuhT8agbOf43gzZSSl1dpF5reIKXBvImEUqi382JP/vLSwwCdmWinitE7CFspbn3RUftQ P6o= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:23 -0700 IronPort-SDR: zqJUuuEWGvtk5ynuIvdoGSTcK/Y7DxRZqa2AqDl93PHBq8zvX3+RgmnnfgDIeH88tY2GRigaWC ksCV/5j5AZp1gugBzl1vz+fSlxsewSxY1IwvAF8Z1UQmeURLZPv6rUrbXBVcc6ZKqszwyeJr9U LQsK3/q3aYuyJzksTzLRhNklEISxCuzFF/G4VTc5KVfAu43VSgYzFZoy1iZQGI8hm4vbdG/U+b a9LQ6+vlvJUUlbReY3s1WU5G9fOKBxzpyEUyM461G23b/3bmRf1IU3OFcf2/9bo9XK1+73YPu+ eEA= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:12 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 03/19] dm: dm-zoned: use __bio_add_page for adding single metadata page Date: Thu, 30 Mar 2023 03:43:45 -0700 Message-Id: <0b8d78cb8d38e4d4e3c5b1c187c81194b6403251.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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 Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 cf9402064aba..8dbe102ab271 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 Thu Mar 30 10:43:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193883 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 595B4C761A6 for ; Thu, 30 Mar 2023 10:45:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231237AbjC3Kpy (ORCPT ); Thu, 30 Mar 2023 06:45:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbjC3KpO (ORCPT ); Thu, 30 Mar 2023 06:45:14 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0273293FF; Thu, 30 Mar 2023 03:44:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173081; x=1711709081; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mX1ugZUMlV3kS9C+vBwAioR51KxgcrVIz/0Juw9keV4=; b=kxgucMZFHZngJRIphtUiMZHCCF99RhALhzTv93C0IKrIboKTXjvYmyzg kmTmIkb+gn9BmAA9lSQ4UuOF0KHkg11nlaQ/mOTvkj03ff8/Nu9eucnZO shoI1kvMNBATcLVY78sb2ceQJOyeu4LWgaZZ1bXkwvdcS7IZjFotJpD4D dTi4ELF1VleY+HH2uttoHQAWYSOFA8dKAefrN2esk42NEpBNIlSzU7s9/ 5iWKI9wsrRCDpGdozXRqL3XTvfsU3Ik65p5ljXxjlgRWFnRWiuzRzakwC 960ZgmOQzu9qzzOUKNbpznEsa5yvqCYHWnobUU1PdAimu4/ktFbDaiBI6 Q==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317825" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:17 +0800 IronPort-SDR: zLBRuzayB0LmTQpVzrEaG2RJ1SO9vNVasUGitEF3Sk6JYH+SJZzcIEvoINwodC5shg+T5666ww WI3bCBALY8Pe1O5w4dhVJfssxYdbNljoUccd9ZtWLaVm2J8T1uGVFzbwoSU6AML0CagxnD7zmW aUN4qHR46mB5Ul7SjkV0SVCvhfJInCbk2YTq/gkXpf4aPmDgz8FWq3rjyLLgtumkYepvNPfBI1 r+bnr+xLNzJendN1/BoinWuRVYWzwPh0IJTQqOzSWdgKu1tC3efAwnOAer3inB/M1bY9Ng8AvD yqU= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:26 -0700 IronPort-SDR: tGiYEQMjhW4+FrecuKxL+pgIOJGkToeN8EqS2UrmeIc+jDKs2LGUqC5wI3lkpfIG0rY9KtD7vW nIXhgAj3MxSOzjMcp86VQe4PR65gCJ8t/Hr1B/e2y6ez9iviPUznUuSsFvmn3O88X1mcUdVcMt QW0hYZrihvAJT5JS7wACEa1P+gmczN4rkDt/LCKCq32xB6tvek7oUUECHgErjCvhLuoZBvN/xK 9puzg1a+1RXgqpR24l5LZUwbmEKk1F58oXHxor04IMFieHnETCM2z+v6HEWQ9+B8eqMai+lo6B aDQ= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:15 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 04/19] fs: buffer: use __bio_add_page to add single page to bio Date: Thu, 30 Mar 2023 03:43:46 -0700 Message-Id: <1848c9a0ec37fddf7bda3f97c6363a7de97eae19.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- fs/buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/buffer.c b/fs/buffer.c index 9e1e2add541e..855dc41fe162 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -2733,7 +2733,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 Thu Mar 30 10:43:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193884 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18CEFC761A6 for ; Thu, 30 Mar 2023 10:45:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231312AbjC3Kp4 (ORCPT ); Thu, 30 Mar 2023 06:45:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbjC3KpQ (ORCPT ); Thu, 30 Mar 2023 06:45:16 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 19E5F9776; Thu, 30 Mar 2023 03:44:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173087; x=1711709087; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RpitYrbMFeR5j8yxFMmc3tnhDIhgkd0gY7Yp5w5KjZY=; b=pQ9N5ry0xmRuXE+eOsHj0Xf363suLqYlHbt0HrOnE43dGHP0igxYboEu skQEF7AWUCJUmuMtLI//TzFpmx8zW1unwZKnhYkpjIN+QBUpHXtYCKw4S a2N5XoXJukVe0AXCWeDbm0LIP2BJhoJE7gQczraQM+5AUieyhPHF/wmCT pOY8q3WDVO0bc0fVwJ3MPOkpLc6AUI/FEmvhrjRSR50NGhgEWhRAojaIl DegqvuatQG1XktKVgAEvl/ag49Zu8pQ0P6jhNVMv5DecpzczahwPGGUEu UkNzNMfhMM/gfJ/FwWlHmj/IcpNvcqaB24ZpLT8FI5lWLVqB2nMaPyUEv Q==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317832" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:20 +0800 IronPort-SDR: jYSMVzLejmvNweOdpUeHA2/RfftxwXH2GraK7eW0xM4nNs0KsiCzk1d3REuwdSkWn+BTRV66p+ JJr/aUFOUWQbgKkFTNrak1JUIQ+sgrb4n4B58oyxV+S5LL1+BQJpk5c9HFAmTElvrL+XwBg4Ex yMH0TuNZ4TDAtzEzyzDa4tUe3PGXwNz6glQpcybfDb1BnxP5kPQHNa0pFlnuP2OAxxo/1Gwu2e x/PwSppJ29OV0d18TQ6+XsfjdSYVu+7TUkgy0JAlybPaXmEiBW6hROq3hUy0DIw+5kC0DriAoU ViI= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:29 -0700 IronPort-SDR: +ifl+ssGQMJo1793QyummmYdxHd3XzP9XbjKXn6B6L9A/71IfxQfpv8qYdarzpWEctk4Ql3WMW tPTK/6UQPkyog3HY7qay4dpVKeTmP5uIdnwjy4w1mx3YP2Y/toi1PbzB3aslZB5M04afc8o1z4 yZQbo9Y6NFNa+sXQ/Q+D/AMjunNqR24ybNaqHMPMmSEop2iGUVZ7PeH8+3OU/sv+eDng5CjLZz ga7rpWvmqRchNNkmOIEQBKIXfa2Mc8UQommU9tZ/kK5i+Hil+N15boStP09k/34t8fBi6p3L0m tHI= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:18 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 05/19] md: use __bio_add_page to add single page Date: Thu, 30 Mar 2023 03:43:47 -0700 Message-Id: <359e6d4d77ee175e2ce7c315a3176ca360e10fbc.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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 39e49e5d7182..e730c3627d00 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -958,7 +958,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; @@ -999,7 +999,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 Thu Mar 30 10:43:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193885 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20BCEC6FD1D for ; Thu, 30 Mar 2023 10:46:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231270AbjC3KqI (ORCPT ); Thu, 30 Mar 2023 06:46:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230139AbjC3KpT (ORCPT ); Thu, 30 Mar 2023 06:45:19 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BC9D86B4; Thu, 30 Mar 2023 03:44:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173096; x=1711709096; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Kw/gd8mi4cp3C+0+JmkC18fkS8wJMSIrrh7WtKkZNvs=; b=ZO7bQcqFZlTxhjHpBb1YdUsdPFShgOLUZfgwMKoWDTAlkJCYtaxHG1cz m58HPiprakXtOLt1ncCHcErC24G4+doEwPM/cErLtgiZofryT/Vjibiev 7IocoC9fFXAFmZj4o8UeCfnSPHMRgx5fG46eJ+J1B8mFB536kdTL3w6go YiQOsf18GYn2RbXuPe0Z5SeLlaudHT+5a8t9DaA8yosHwk7SMBpyWo+lZ lbqYUWTs6V3Tsw17LGwtffAasBm6+d5le70Mk2BRffyB2tdQnb3FNi8/p DgpMKYqixv1rNfFo0SIzn72+0rTjRip8rYmbAZ+4RvWBaKpViFVQ1eP7F w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317836" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:23 +0800 IronPort-SDR: zWrmNslAH9mXoPhIO1nfSD3+TZtK6ONNAgznD4vQvxcbBoSrT958ozDl5DBkXLOlSZlfkM+QWQ LpClT/e19GiIuAFN3jGrm8WbKg0srCBIDAotrSZcHJw0xOqQxVMD664iPNnvEfCE/yECHzOs/B TWT4j6CYcY3+u3QadLCLF2gIligJS91KoDBO7TSW2w4LY0DzOvTJH6gFgtWDpNkaCJjDP7VlnG /DRylOyYWB2s/hzTTNmDHTe1Sn1paZXD6qHPsBu40tqcN5iC5v78pHECWL/B0h7UwsYNDTpD0/ dAY= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:31 -0700 IronPort-SDR: V9njnv+t+GuKggx1vZa0T1MyyD/4iSSXEJKOary+Bq17fidU3Wq1CXNYZJCw9uLZGgQvn++tes OUuz4YBad4EEj5SCwfzseRk61pTGeIXQTJ8sWWZ6C/a6IojWDHpOIMFR1kBlWwqA9+1RZimaU2 9ugMrtf5vwEtfAfHMV1SAmH0gL4ClOl0L1H4690JPAzrH+EYrtPzKQsIBiaqdN4IhpHVhohUHn t7AtVhCoScM7RNoNSFn3XL939XSpDOx7ZCfy1+MZ2oQUID6IQmdyOsZrB+CvmCXJX8/vdquFwu xWc= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:21 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 06/19] md: raid5-log: use __bio_add_page to add single page Date: Thu, 30 Mar 2023 03:43:48 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- 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 Thu Mar 30 10:43:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193886 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74E94C6FD1D for ; Thu, 30 Mar 2023 10:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231338AbjC3KqM (ORCPT ); Thu, 30 Mar 2023 06:46:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230321AbjC3Kpb (ORCPT ); Thu, 30 Mar 2023 06:45:31 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35D397A8F; Thu, 30 Mar 2023 03:45:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173103; x=1711709103; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=r2Sf5mUt9HArXYNHtNNZG9NyfVeVIuPp2J4v5VCyro0=; b=pNKHTlKdjtAr66z8itc+R2bSBm/dF236chhGC6KgQICGMN964S5dQg8y XGqjnwD4F1KOeJ/zZBApvVIi73fEiDI9Xb8S3FYjy2P2tHppD22RKd4KF 15ioZk1WQSjzIEI7ww9e/opuNTObiSIWhuhLkpzOMwAYv8MV3f0cH85Dr R4rOS4IdOBCZyd9rLQomdpJRKV9tEazflzcFjf5yDAKI11ZO+VIjRIFgh 2Ljag3Ksj75Oz4eQIyEXWycCCGCk3kUbi7KPQUBlr52c+C5T8O7LdmDy9 Ts75ghdbLjSb3Bpl++mg2SfEGtrzXfEHtckyM06GRufUeaQQUzXQ4CFxg w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317841" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:26 +0800 IronPort-SDR: gLp0YoUfK+2189GRSg+8eK4AKUvglaignSnQSZWY5IEpxibvclkwRozVxi58f/jWIgXAraY5+J 7MAPFoJZ02cCwgiFhixeSJcDAHNTUFri4sRSYS9SdC28/gxSeTqj4xqhAcoosOx9QZVDzznoab AAUwtej3vr1mJA7gpD6ETz3DnV+/YBbMQTfHKyMGk5tF2Wi4cE8fRLmnBvd8/7wphN4JwRVskk GP2P6K1ST4PgIMRr2VrHC5cuFaFvn84thYWpI6M1GnIoncouPWaRPgpYzW5tF/mMtWVSx741Y4 7Zc= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:34 -0700 IronPort-SDR: Rnq9MYYdPgA09fnMFGRGvOdylFjRCrkzOVUrlWYy+L3Pme/NCk8sA6Zn7WCywdDLeWt/7Id+So 1032rM9LOkm6qL/hQgb+OsbJJwqKy6GZX5osAi0JcBf/+HCsJ3q7zLHVPXdvUb7yKaauSdhmYJ UDmdNwRTrKFtqsgT9GXLB7RhMWPPebX288EPBWtvMGFgihtyj6p7/rQAmgavpLeyucAJfIzx2x S6vPkaGyF+tI9E7e6BtHitbJy6rXVY95zbtc7Z9n0bymNi2mvwGRpwXi+6ApwH7c67oPbylcoo uXQ= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:24 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 07/19] md: raid5: use __bio_add_page to add single page to new bio Date: Thu, 30 Mar 2023 03:43:49 -0700 Message-Id: <29a2488aa641319199c597d1dc1151c700e32430.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- 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 Thu Mar 30 10:43:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193887 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B954CC77B60 for ; Thu, 30 Mar 2023 10:46:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbjC3KqN (ORCPT ); Thu, 30 Mar 2023 06:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230423AbjC3Kpe (ORCPT ); Thu, 30 Mar 2023 06:45:34 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 754358A61; Thu, 30 Mar 2023 03:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173104; x=1711709104; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W9gE6QmsdFRmz0ZVCVa1q8hek9wq1iRj98EqV3wB4Jk=; b=Usqp6+76o9Orepyc6tpBQQYooJ9MLxfeZ7VcvilS8l+MmPS9udekgB/7 ct3UeuCPzirAyBlrYw1IBKs7dw5SjZ1t30On97rUIF5garkgadtZCUd7m 8vYYRzlJx3nG9ej50bGQPN+9gY/H3EYhZAZDVB+hgCHkZwhPCObcG3PI+ 9A4jn8yHRCQhm0h+vKBr9kloQkw4/Rcm0ahfqzuLZ3KGAC7KFY/qsohIj 0hS5A4XJAQaiH8RYYty4vpTp3V1OQUhbaGqaYZY+NSTbVMu1qkrCPo/G7 Wc/xqngVXfYAfkDaq+sO/wOmdGeZcekmMI7byVlyHWLZeoyDJma31NQ5K Q==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317845" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:29 +0800 IronPort-SDR: bkJwR9quMh18/UdHxvOwQpqb2SzSgEn50+zkPLSwtqbTKKVBqmR97lq6usjPzNW9R/glqaWlEA HfcxTOQ0foluggd+EEOuLPHabRZv1pjFnsfs02JMQ8tyohlO+Q5V2Ufabq8JhaXanmrj5QsO/6 3JJ0Kv3tZxzgbNeIzyXhatgokf/x9q2adBLqStbhlLTo3y8SldL8r0zTyr7iuHI+cxxG5GZe/E QrjP9+gsDVEpPMi/nUMvDD+TvigD4QkhK32G5sjwlCqPelC2FtvsGwGy8NEBraLW7187d+VhJA Iys= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:37 -0700 IronPort-SDR: 7VfBtatRUAMSKGZJhueT2GpjhxB7O4zmUTxm3R9MTyW1KAXQy9vKW9iV7AuhhA2jy1ZSsCp98O U1y/h8ZeZN+sRqZVsvVO4hAs927WNwruX7ksWwSZxQaZ7PhnaOJXPNDyTm+sgyqtE99mUZ4qrY atKl3lP0PB5GGkREm/HXgG7Yx5KK5w8jOv26buUSZPHatbFFFBRCcm6OyZcoqfvlkdXIYWwkqC cF0K5nj/s7lS0zwe1pS6KOfyNTJKWJLOIHUhjXr+avwW9dLSK/XfwgZxojo4KfnWNQ5FGo1gwc c7Q= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:27 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 08/19] btrfs: repair: use __bio_add_page for adding single page Date: Thu, 30 Mar 2023 03:43:50 -0700 Message-Id: <92c80a1b14a7f9cab366cce2e7c5778de5e0d6d3.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The btrfs repair bio 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- fs/btrfs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index 726592868e9c..73220a219c91 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -224,7 +224,7 @@ static struct btrfs_failed_bio *repair_one_sector(struct btrfs_bio *failed_bbio, repair_bio = bio_alloc_bioset(NULL, 1, REQ_OP_READ, GFP_NOFS, &btrfs_repair_bioset); repair_bio->bi_iter.bi_sector = failed_bbio->saved_iter.bi_sector; - bio_add_page(repair_bio, bv->bv_page, bv->bv_len, bv->bv_offset); + __bio_add_page(repair_bio, bv->bv_page, bv->bv_len, bv->bv_offset); repair_bbio = btrfs_bio(repair_bio); btrfs_bio_init(repair_bbio, failed_bbio->inode, NULL, fbio); From patchwork Thu Mar 30 10:43:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193888 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4749FC6FD1D for ; Thu, 30 Mar 2023 10:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231356AbjC3Kq3 (ORCPT ); Thu, 30 Mar 2023 06:46:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231138AbjC3Kpi (ORCPT ); Thu, 30 Mar 2023 06:45:38 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DF75A240; Thu, 30 Mar 2023 03:45:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173110; x=1711709110; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=losNsOzC/f7Y139Rf9MlNoUaYWQhJEhtWroEro9w4/M=; b=Z6xh8ceIF4/MmBWK/AKeTw3V/z3jJyA2FEum3jYLjv1W/6pJ34z6Pt+L 6Ygkcgp2Q1Bqm2qLsJD7pekPoYDlkS7NkoxDCIQ20DHkz28kEkp20eYdU VZFHxrRJrs52gxlYDoNRMBw3YsAnriuBdjfjXqBg19cZB3lU/JYkuSVPj smpAPxQfqSbAgQgA95hSLHmtYs9flQni0R0GoN0nf+VN1lMlE9Zj6YB7a rznnV0XnrprfMfKi1FEIxv3JkCxdtqzPbbFBf7UN8EthlxbLulTsM39PG DmrHKI3m4RgEFaMKtuBuCLB3FOLoC+BgwnL8rT+BpnCR59rzNLjSoukbz w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317852" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:32 +0800 IronPort-SDR: 7GPm3hwvU5PR7DWk3eeGl0q4NEfRdmXuCWHBbhIwrx+aVBSqBKkWEgByoh+pTlYsyFakbPYZzq 4/x52Y/wmZLDvR52nirPgD4Uh+zoz3ol5IBoHvYHEIKw3EF+g/cUKKEtE5Hkk6qbQdnx/XZejm CwFTdpTd6pA6BDfPJlexBuLRpgYT2Nbt1wBp9/Sdr3XK045wP3V7H8nQn/aT9QOeQfVZhtVXDU BTKUfGXKGIJpVJqwuhLAfF1ybZX/IAhHKLSrNYoh+2Kt2Ti7j9aZoteQr+sEngDACUomiVd+M4 q+c= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:40 -0700 IronPort-SDR: LLyR2Npm2+MAJM3XIZClgMxoi6I/W/dIVvFOaKwZbXR+FXU/hAizNCjpHL6vVJ53LRicCLvlw6 5vJSG8HqxBWOqmVv/563WgNcBAKcQrTbUaISiCtdAKhBTNUkKx21Cw/LpFv6nwsVXjwJUXttT1 Ouz87wSgGmy/lK21UBktPDa5DL8h2pGw5G6UoHn1GsKFWFrgaBgxcgxKAEyMdk+8OOry+WySWP 2F6SU6oJeDkTWv5KZR1md8qL0MPIRJYLz7AIbGmgoPFt1/WpjDzmEIsUXysP0EYjsW8qL4qhU5 Fe4= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:30 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 09/19] btrfs: raid56: use __bio_add_page to add single page Date: Thu, 30 Mar 2023 03:43:51 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The btrfs raid58 sector 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- fs/btrfs/raid56.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 642828c1b299..c8173e003df6 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1108,7 +1108,7 @@ static int rbio_add_io_sector(struct btrfs_raid_bio *rbio, bio->bi_iter.bi_sector = disk_start >> 9; bio->bi_private = rbio; - bio_add_page(bio, sector->page, sectorsize, sector->pgoff); + __bio_add_page(bio, sector->page, sectorsize, sector->pgoff); bio_list_add(bio_list, bio); return 0; } From patchwork Thu Mar 30 10:43:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193890 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 941A5C761A6 for ; Thu, 30 Mar 2023 10:46:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231376AbjC3Kqp (ORCPT ); Thu, 30 Mar 2023 06:46:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230023AbjC3Kpn (ORCPT ); Thu, 30 Mar 2023 06:45:43 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78E55A244; Thu, 30 Mar 2023 03:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173112; x=1711709112; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HqGEov3XVaUSsU1qoKvlSzA5WCxEWJpL8TqhnbfeoRI=; b=FMSsMNmEbe2UUJAcD4iJuSmj8MniAl5M6taPCR9j/TpK+gfDRnj8l1Fa xAhNUO66xg0E7oZxYXL8XnLLQGzGCNqvZBQ7+6cSgLtlLukuEPj2oWJ57 G5th6GuqLWgBh90QZ3Z0GJbUMVWXc/+W/J/vGn3p29KM4qCD/l/fUmkLY nO6YhqKCBXUhonzsnqi8aE5TXeGnLsLViIxWcWd2njV1jlHhhHuwJ1EOM GzA7V03K+hH3htQ5I7XNrDyHnbhBsIhlKWFrxg0qrpC2Ptvu7aIfd4/oH ohe50kHJZXBcOvurflozzvumMiZnB4VfnyK5yGFA/5F81msJn9Cg57cvD A==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317859" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:35 +0800 IronPort-SDR: 5bnsLX/33pT0DHZ9usfxn+SFAT+D2VhNk8VjsruKwnA/k83Gv5eN1X6AxTWQph8deRhtx/KCoJ 85FK1dUuxRLuTDF14bNa3XR2mY5ipDiiRuc678JeXzKY0fmteoIOF/XNgfU551UX/kZj2GKP9z TcCh1Etj3X56usCv/DPOVCQ++URzBWpKM+Hafq/QVW4b9GbYPXi8ubn4ypT/0d0CiWmR6ZtZxL Ov+e5b3HADkezwoIKAy0c6MQRg0SNFYduOfKRgpoqFJa9ZKGgvwCA174CCBwCYRkdIcYe06oKx tA0= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:43 -0700 IronPort-SDR: 6WIc8day8NQBouRdTegvxYDP8rVucIjXCP3Xboyy2sbFZ8keAmQDsm9vsW7DO2uS+PyzZmmxhh KWnBTNrkDqHgMcs2uBQzwRKlG8tO/YWT1kyWWWUk13jmX+gnspuRhfKtnbJCyojYxI5SUBXIXL VN+gFqfEZ9ZD+g90ovrKSGS1DwHcbU8Nyz3Gb2ej0XKsCA5/rzxVTofn5VQAQFFvJRswQRcvYg BnU5nWDerGRuzg3XZHk8LHfbUEZFO9ewLWes05uTBeATlTFNUM+742btiJ6qAWVfdyqNm+r+ki dRc= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:33 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 10/19] jfs: logmgr: use __bio_add_page to add single page to bio Date: Thu, 30 Mar 2023 03:43:52 -0700 Message-Id: <820f11140138c2deb4a649014556aef27474c13b.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Dave Kleikamp --- 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 Thu Mar 30 10:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193889 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C132C6FD1D for ; Thu, 30 Mar 2023 10:46:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231294AbjC3Kqo (ORCPT ); Thu, 30 Mar 2023 06:46:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbjC3Kpn (ORCPT ); Thu, 30 Mar 2023 06:45:43 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78C3B9755; Thu, 30 Mar 2023 03:45:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173112; x=1711709112; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+EV0JXQ4xe5HTVfKptkUC3VI1nVjFYuHFxhKcqwjlik=; b=BiZAlvEPl3M9tE7U421INIRKlD/Yk27O62by2tJUDqzbOFok2RyLTnEQ nFL5TVtL6oHkZryrzTXkXFhxYFdvhjVWzifvIEg0ifkFfRqDXbZxKxRql 9VZOJAGrwix8ABdKosX3SyyYj0CFBUhzFTAO3JjGUOrSW/mVA6VYWEXLC Ef9aJjUG3Rntg0gzstxEJCmtjq7ag3ck3cUaiXw5WOsL/eIm29xR9I75y 1efrHELHQGTbXb9c6xTAgwG5aQ7OArWII2a55zhvHwl1iE1TYClzBXsw8 J7ih21imrp73OQy3wwQB/gswt8dcjyETtN2Be0aCf2OnhS58Q9b7ytNtd Q==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317862" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:38 +0800 IronPort-SDR: 0winjPGGK+OUaLgvj+p12dxE4N6LTrOJ3JaHKzbcaFhnTy2FxRsDms4PdW2FTdMCsP85ajN5/s 082H6J9iRnBtNDqLWh5VpeGwpeRkMrL9IaPK5GytcgP5z1F/VFzuVTSXnUsTVtVNayY/ryAxNt BZFBUS0Xlar93v0a61Pe2C8Y0oBAZZOFG7onSQAZPnT2xCZ1h6l/1uesiOAoqMMsqQNql+NB02 WX6z2SL7w/XT6FnspKYysTEbOh9yrjxkODNaVHMaAPDdJROvB32qsUlTZxXqjHgGN0bAw2rwuz q3E= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:46 -0700 IronPort-SDR: 0juN/UCrJrwrTW9FmNQ8IreQ3Z/kXco76QckMcW+qQoSIff9Nyhb6/OfK/wD1wpfYAg5ZX87cC hHTNwhN6I4j0PtZkl5gWf547ViC6MsjnMiBEri75CfYRnl72fKv/Ii3ZodjlNoW9efkmVbaTT1 Dz+z9w4GmptBfajSperiop6zUnGQTatXM6ubDhqu32VMSVzozkhANFY1FLEu8lZ5j3+I02RtEr AfbmNUU2OTcGt219K9VJZ5i/36ngrCQVIiGqlblt18Dsz9wpIPU3/3tF9Rx1KRr3aX1G/Fwzqk qgA= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:36 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 11/19] gfs: use __bio_add_page for adding single page to bio Date: Thu, 30 Mar 2023 03:43:53 -0700 Message-Id: <2ede486fde05be1b97328579c5f84da48efe9156.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The GFS 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 6de901c3b89b..e0cd0d43b12f 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 Thu Mar 30 10:43:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193891 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18583C761A6 for ; Thu, 30 Mar 2023 10:46:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231386AbjC3Kqt (ORCPT ); Thu, 30 Mar 2023 06:46:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231177AbjC3Kpv (ORCPT ); Thu, 30 Mar 2023 06:45:51 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5198886A7; Thu, 30 Mar 2023 03:45:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173114; x=1711709114; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EUpgRxBtOLFJ91CyJDOvQQnrN1sWY+otarb8WY7sZkU=; b=f+mFjP1JB5hKN/wTckCJ1rYgOnVmAJO8pJDvRoXwtjZy8zVq/EhlNcAs PDU7Op1UfwaiuluqCXL7b37Q2TFkuOK0tzNzo888m7+1MA0fAEYMDo57Y cU7KePlIGM2bHWVyIElNNXfrbiaituo6gP+PIy7G02t8Ym5rVRsHhe5pm 23/zzyVgwqJla2VimDc5nz/vzewbX71iUaX8PDgNx5x6WLZsQcdXJFgtM AfttzAQqFhRDm8nEIi8u1J/Ke5UvjB5J6dTzRmG0UfhaV6e9KWSOghXWN VzSvncBG2EMvknF/gNJp1R2XSPJNUnCFYvHVnoWdDg7Pqt3qfgzTnh27M w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317867" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:41 +0800 IronPort-SDR: leugHQ2MMY+lG0Uz3hUmuUcoQyvY/36fR6/IjH0wPATj9uGbIP9ralPLbOpO7yX6yHhNk0EJ4q LUW5RWT2wNahjmZdQw67NpGMc1G8dp43MJ5ijIJyhTNxc0BFvF52LDlmLwaEjIjhDlOpBopkYs rvF7bQH9reFigBqaIIMkEBe/YdKZvNgeAs4KlGeHhNOKipCX0qMTMq7963EnypC7HH2Y36hEVH HSkG7u7f1KNnlNue/Lzk8dFMyOeqENJB+2Q+NN3ajrt7qVZg66JG8vDkA+eW4z8sIM44StooQ9 M5c= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:49 -0700 IronPort-SDR: VYA9BgUUDr4sRMMfeFHmoTvJAnU8njSRM2w2NjoxJH3Cs70Kv8EJ/NbwobjN2EMuJHAYNPSu+2 Nv24R+meZtBuzWBLMI2rGIlIum+FZJ3DzLLEATptDFEbE2+Hak6NpQWmS1jl66KjmWQRpANrQO SJDRkUryKsiMGPqt9zUBSBJ1Bi1cbUurM7jtK569mscScXqA2oFbNgVwXqIwxlQ2MR+O4fo2VQ EV+jUSVXErWdsRYtr4iObYolOTAsYF/RWA3lThvvL1VeJ33ahhyJvlra7p2jf2qsTPNoO6Xbj7 kMw= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:39 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 12/19] zonefs: use __bio_add_page for adding single page to bio Date: Thu, 30 Mar 2023 03:43:54 -0700 Message-Id: <1b1bdd842de5f699d76191565fb2b6659aa38922.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Acked-by: Damien Le Moal --- 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 Thu Mar 30 10:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193892 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 651B9C77B60 for ; Thu, 30 Mar 2023 10:46:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231400AbjC3Kqw (ORCPT ); Thu, 30 Mar 2023 06:46:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231216AbjC3Kpw (ORCPT ); Thu, 30 Mar 2023 06:45:52 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 625F67682; Thu, 30 Mar 2023 03:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173116; x=1711709116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RHMrIgXLZtjmRd+5c9MBnc3q/BEGhtEER4XpeifNGfw=; b=ThHCu9v9GepSTURv/6BPujDIrCStI1CZcjpCYREkGgpfJT6C57a9dWZw hQewALsDJTOw8YdEowhVsEKKHUVN5TIt42lbirNzyCgToY3CQ6LauszLU XPUPSPq97+K87nsI/e6Os7AWcufCRkMv52vHOhdD5IUxhJYCfBButHxkk PGX/c0p8cymGjWVKwRSTWklRCNJzFAzmvI5P0VGHiopOTHILJFlKGJcJU 6I8SqOlfL9RLzc530mEZZUtIb+OuJ/j5khuLonScbBy7a66thBKOwwCdg brAN5+tjMn/eiJBFciFkMiyXw+j0SYLuGSLWK700hFEVVXYjMr/lZqhnQ A==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317870" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:44 +0800 IronPort-SDR: EMs+hjXjayv+kc2CNC5zlzMJpMnl8Dncg7ntZS9J/68lAD3ocXKcoLS5LNopfHu0OjwL2bFYLm aNIHxOt7X2eheO8yN7CmnAqc3YIrn9YuR+Nfg4E2gybw/gZWV/lM0AIyXSisQSweTdM2DCPsnu ATL13Ivo5VKTiEpebripwOkAn6C/aWajr+fEO98Aes4yyQQ+PxtyBnvWqjbYCIp05ZgzgZglmx 1ulO8ByTx1dy1W/mICxWJitTYFBhBvddV/o3erCYshro54A0b4toHWZR76Ek602uccGUXLkDC0 qSY= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:52 -0700 IronPort-SDR: skMtz4+keJr/cRyrN9pwkgS0ewLiSNPb2M9dHYXrhuJ4g5fW5pyblL2I46HGHIXXc8RzTaSiVQ vh/QodlyDksqLq7Dbn7EODH7rPaYpLyeTet6XndzDCHJq/UDe4ACMF5fuQcuF8b6PngN7P5WFm 6bbx8cI+1QGvEI3G+Itr17jIH6UA32wollKGVJ8Lv5OT101pzER2Ix5fj4DLVdWgljSJSJ+fAE pfT9r3OX9yQGbEd5JejAszDBVE5RDoC09pcH9t7rXTz2l8qBWAe6vvY/LavdGZzoCYiQnqJYAA 1/k= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:42 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 13/19] zram: use __bio_add_page for adding single page to bio Date: Thu, 30 Mar 2023 03:43:55 -0700 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 aa490da3cef2..9179bd0f248c 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -760,7 +760,7 @@ static ssize_t writeback_store(struct device *dev, REQ_OP_WRITE | REQ_SYNC); bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9); - bio_add_page(&bio, bvec.bv_page, bvec.bv_len, + __bio_add_page(&bio, bvec.bv_page, bvec.bv_len, bvec.bv_offset); /* * XXX: A single page IO would be inefficient for write From patchwork Thu Mar 30 10:43:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193893 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A73D4C77B6E for ; Thu, 30 Mar 2023 10:46:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231216AbjC3Kqw (ORCPT ); Thu, 30 Mar 2023 06:46:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231221AbjC3Kpx (ORCPT ); Thu, 30 Mar 2023 06:45:53 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AD28F76A5; Thu, 30 Mar 2023 03:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173116; x=1711709116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=b77AEY+fFVaCfrBI9YuTDKawey5CeI/SslH0xXZFoZw=; b=eu7FIYQccOat29wxehOG+evu6b0f0Fo24y4QdUlOo8w+RuQ3PgFyST+J zTKhQDy/UWiCWbZRlfW7dbGIlIrZA8v60/vX12H/qmaFqUpk7YjIGNgBa 3NR46CMmHHZ1z+v3grPQdzbKSSODujJYUeY+Uc5ODY+kAm3nn2H0mP3A2 seEf1kXvkloKZM/DYbVUFE5/mZv1W9ijXzjcopZVDE1vPYtazWLmoD8uS 5hudLcDo3WxL6PoMTQm4RdPKEZ4pXKVUAGBLM6nad0EoE+8F8IYq3CoEv o3WYOs/mMjxMGEKrcrUgCymv+e/k+ASeioQG7+/p7mf/UAta2CR6TV7Ss Q==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317886" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:47 +0800 IronPort-SDR: Bvufo1FPVNnraUt8RoyfEUJB/cn3DcR9sYpSQ8i7nw/YuC/NS/HsyUnqj8L9nrk55iTG/fenas OWYBQEGcBryRNJMywW+Y6uLuWpmfdHrYCzJTOdRLu6Wu3W6Vgz2lf9DEDpABHiDMpEzowWdIwr u9WVizk4dAvt9XHsWN4KRMymK4G5ujD66WL33kpG9h1auN5jy3QA5qUb8BIxEeliWCCK7pqgfq gCGpEhqlkyndtKEUI3qads9GC/+n2mGJuTsPPCwkbMig58aPki5Tds3jUdaqFKUWdN6BZs5KJy MV4= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:55 -0700 IronPort-SDR: bPTbKVKtlEcHRrx/gshidhFG8cTmJ7BMiKZMBOrx7BvqKjv6JDBLA7DtLgnQ8cD5tBy5QB4Li8 EChWA24CGnvJ2Bor2+MClUrPy+r+I5aXuZR5uVZa+29PcBU56ON0tvsmmOLEdtLGgyfwshq8on uLUa5y4KbY1OsCGTLPOq9tHpy9dt3I1YsfvmNS3+L0GgTwHGeuOWfftTPpLJxuguO4KUD7Csdp y4baPtiMCCJStynBrqY2vXX+RwLmiiCo6Jnox1p4aCnNgMOXQOiTLaht7Zdw65/ETNfesjB+DJ BFM= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:45 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 14/19] floppy: use __bio_add_page for adding single page to bio Date: Thu, 30 Mar 2023 03:43:56 -0700 Message-Id: <35c82b6fbc054342cce6a2084707bf3866813f33.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 487840e3564d..6f46a30f7c36 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 Thu Mar 30 10:43:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193894 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D18D4C77B60 for ; Thu, 30 Mar 2023 10:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231426AbjC3Kq4 (ORCPT ); Thu, 30 Mar 2023 06:46:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231238AbjC3Kpz (ORCPT ); Thu, 30 Mar 2023 06:45:55 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 156E18A53; Thu, 30 Mar 2023 03:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173118; x=1711709118; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WuVso3FIWpTS9t16blIu0lxfhGfBw7QOq0E/ZSZkofY=; b=aw0fe3yKjpJQMIjwmMYqwxx2/B+wWSRzySz+rolLQqksQ3wMF8NuLLNp WWeNnrYC8UnGuK7s//98156efY5U9oBCX8IbHZs1Q/3xFjKQAhVitBBwe EODmfZJbiW5KJx4DJhrSvwnt/VuX9oA6GhxBbB55bjlbzbq1OrfkMsECM dD7SfaRb3kcpMC1N+Tq0mhiss/Q9M3NV1vExmit61Ok4uQdWG4e1i1Fj/ 92GYuQdMmtqtNcPbNzW3+l5jc6Iag9Y7C8ICy8EJCsdr97fUKLN8UHPUc rGZAYdgL3mjvijv2+KJZuV7oqGyVagMmPEN+ZKm3QlToPjtgglmAH23gt A==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317894" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:50 +0800 IronPort-SDR: txa7F6mHIGLPVhZBTjSCDTv1T7W9r53GQRRCgqs5Fwmm/ErjQ9j5k6xThlRSrFj/6Bh/Zm4zgT QPfyrTcP6kQUdgoAECNfMDZTn+NYixNpOyddm67f6HhD6QHrbvaNU4512qYrc3iwSGh6EPqjx3 zhErg51ChQJXJTDcMLtsCsHaAAQo2TOdP6SzS2EUfmsAoQKPHeTQXboDOrkNQUzvCzHerANlJc sd+Ui1okbaorV5F3AGbpufTwTq6o0m3nyuw/HeSPdxC99GpkJw4TlGYNoYrsCw+o4cLJXiBoF2 T+8= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:00:58 -0700 IronPort-SDR: xbv9CWFcSC1Bzpr8BamikP+86dncbp6oACJBXmhmSmN1KLO1tjzjSUny6VIcaXoUQyq5sWcuL0 lQBuIK9Qs8v6PE4kuNsKWptmdAB94A57UA5HBiwUoF/UZUfY5X3vAWQoHSh0h+S/n670fLweqX xwW8OqqSonBv72abzryYNSV2io841vwnNZJ8IY+0p5wqBENYMfSLK+JpFOg4uVtqcWWbcuN9UN kEpt44p6/oIeo1ie9PLw+xd46a5i05H2OEhI1oKUgM+t3BiQfepTKLv5GkNzpVe2yAChE6w07e +JY= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:48 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 15/19] md: check for failure when adding pages in alloc_behind_master_bio Date: Thu, 30 Mar 2023 03:43:57 -0700 Message-Id: <07ae41b981f1b5f8de80a3f0a8ab2f34034077a6.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- drivers/md/raid1.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 68a9e2d9985b..bd7c339a84a1 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1147,7 +1147,8 @@ 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)) + goto free_pages; size -= len; i++; From patchwork Thu Mar 30 10:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193896 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEE62C77B6D for ; Thu, 30 Mar 2023 10:47:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231440AbjC3Kq7 (ORCPT ); Thu, 30 Mar 2023 06:46:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231302AbjC3Kpz (ORCPT ); Thu, 30 Mar 2023 06:45:55 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5F1B93D9; Thu, 30 Mar 2023 03:45:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173118; x=1711709118; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oL2U/g4EaJMTT3671h8rphk5MC+hx36IPn/aySLD9mI=; b=M2luVLf/rze41HLKfAYETeN9TVZTJdaqNTYEYRlRGY4WmlZT1jEg04Cy bqgE8YkhoM1+81oqOoDp6bcFvnY7Aa9nP8dCN7eqBsrKDvQUvHPtJ7qLX PdkHbfTodG7MByUj3uDClW9+2XY4C5d28ywKc2oP/wEkwIAFpKQxZEpTM mPB5F+lY38htXY+WP1kbSVj4pDnXTJmT2F/IoddAjwSX6p6hvvmCLXrt1 tpeBZHvGUlynrWNaddjqLnSsfTBmXqGF0ZHjc2s5XpD/1N0tNrJ1X6KuL tyGZK/1xCnAPT5XiZaUp4FmwJ9HtcF6MOwGA7he0E5w1tUdKB37nafDa/ Q==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317903" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:54 +0800 IronPort-SDR: i01bbHuqGAc4yQ+1ZaAJLEpeh98e591YVfnqqrZQuh0qxRF7uvw3XU+1kI1ufCpf1PKcZcozMy quqWlFZyKLUqkyvbQObK/Sp72aFit0qvxxIn3zj08gf4vihzNkZeuWcOrGzCMOvtcXO2jeTg+D aRLIJ/htAvPR44Qnjvlg4wTN80qF0WTiuFM/xVpJJesDVuWEym5ye14E+aSANPLgNOEVdMtUq+ kXBls+KZcALL/etuDU+EhqmxVut6P8H721yaTrO4hA5tRA1i4FgnDwkxYRaQRBVuQs75fTzGIi JEE= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:01:01 -0700 IronPort-SDR: CoMzsHiAS2JR6nHz7NkC2bnUoQ56O2VVvllRrO/O/vDND9erWG2x+0sd/n32CtrHJXq89I7Vpx 3yXADu4Qzn1egGoPoaR5LOqXgneY+WCGslMK0kk4RtBPu9UBwrphetuapusHacgSbZc/GjpP04 rOM2hwuQmwq0JHF9BBbZ161hAs47W3Bw7eBGyL1xrobBRYyZFBMncwXMAQ3J+2GPapCugFKR9F g47K64zulVURfvgH0krXU+jb73cw0ekyXDiawSnLCfzfBr1nZC/vguolrUE0Kyqh7/cxMzE5Dn xv4= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:51 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 16/19] md: raid1: use __bio_add_page for adding single page to bio Date: Thu, 30 Mar 2023 03:43:58 -0700 Message-Id: <4c9eaedd34f80d3477a5049f49610a8da8859744.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal Acked-by: Song Liu --- 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 bd7c339a84a1..c226d293992f 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2915,7 +2915,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 Thu Mar 30 10:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193895 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F26C5C77B6F for ; Thu, 30 Mar 2023 10:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231238AbjC3Kq5 (ORCPT ); Thu, 30 Mar 2023 06:46:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230418AbjC3Kp4 (ORCPT ); Thu, 30 Mar 2023 06:45:56 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D10589ECE; Thu, 30 Mar 2023 03:45:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173119; x=1711709119; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=x03Tj5t21oFBp5hacmwnIhr612M3UR5L9WbzmUXqvTI=; b=pn5rPW1skTrOnPTfQLMSopMVEt+UoGgEN6d55WvYLvfToFcwxNCgXtRI 3XjY9M5rNlpXtNiVE6HkzciLYkPCuya/HjguAh/Mu6FZuI4yCYvd7N2aJ Q6LGbeu/1DnxRVhKB1darIQbeqRMdQ4nVc9JFvWEsduNMki1+Fr5VCe9/ BaMSG6ZK3eKzyB3zRUtUeTkbP5d5HAXaQ6TSgBTdsoSWyaK+Cmx1zjZC6 cK+a3dYi4e+1VfKJ29W4Jhn9u5009VVY4PZ1b5AjTlHrOC1wtLdwAPHR+ aTqjk8+f5t35NwFYOCMFR32unLo5RzuDMpk56Flr49oXplYUxEj6GTKM8 w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317919" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:56 +0800 IronPort-SDR: esjwb1AF1lGJtq2Jpo1vK3ciIT2sdFcljrK8Mi1pV3lmka4o97Pi0SI6mMY2XqkhjLjk0nzsfj 9A//Nl7OnhKdVaRnFfJkXDc5+Y3VUos9wmo5uxCzP5SBCQHSrF9nqXfrVA+f+54lNRc1TywnH6 xirxY4vSiuZVSqgwIO3w5rctoYSbaHJZ5ZHjrgvomxuHL56qn/zYqYt+yScfiTH+7NLGnhCRaB mQOwrjymLuVfQeykwQSOFjIPbzpHQmfci+8eBKAF3C93GDVYskUnnX3If90r6NIonXBu+3UzHE JZg= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:01:04 -0700 IronPort-SDR: 8tspoTXpxzHmClJsQZ5bC1hIVYMWR7fxHmL7Ag12bGN2b1vX5dZznqIk1xwQtM6kCQBYt4ri9+ uDLHirIHJ+4DA1NFYYbUnI8BA/QPlErIYOwpzv98UE2BAm7hitWSquPo0TfsDDIyCATLOL07Nu HLS4fBI0QUHTKCNPkR12ymqUtn6Ain+2OW6y6kseY1SYoKAuFCRZt7zXjgTS1iH20DB1vpnG2p B++q/+YMWpsASXZesODVp5hf2KtcEe8sIoFQNuEb+V8X1xKBHnSJ33ZRqIMSCLLhRGlFncgf4R lH8= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:54 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 17/19] md: raid1: check if adding pages to resync bio fails Date: Thu, 30 Mar 2023 03:43:59 -0700 Message-Id: <8b8a3bb2db8c5183ef36c1810f2ac776ac526327.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- drivers/md/raid1-10.c | 7 ++++++- drivers/md/raid10.c | 12 ++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index e61f6cad4e08..c21b6c168751 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -105,7 +105,12 @@ static void md_bio_reset_resync_pages(struct bio *bio, struct resync_pages *rp, * 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 6c66357f92f5..5682dba52fd3 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -3808,7 +3808,11 @@ static sector_t raid10_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); + 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; @@ -4989,7 +4993,11 @@ static sector_t reshape_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); + if (WARN_ON(!bio_add_page(bio, page, len, 0))) { + bio->bi_status = BLK_STS_RESOURCE; + bio_endio(bio); + return sectors_done; /* XXX: is this correct? */ + } } sector_nr += len >> 9; nr_sectors += len >> 9; From patchwork Thu Mar 30 10:44:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193897 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2887CC761A6 for ; Thu, 30 Mar 2023 10:47:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231451AbjC3KrO (ORCPT ); Thu, 30 Mar 2023 06:47:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230181AbjC3Kp4 (ORCPT ); Thu, 30 Mar 2023 06:45:56 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A689743; Thu, 30 Mar 2023 03:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173120; x=1711709120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AKPcab2XYTxKDTsHjq6NQ76PfpLzQxBfOz0TQbvI9A4=; b=MtLdEF/GYh8cUwyc4E3mlADIrWSLlfm1NtUIEHe1jyqKCPZKc4PD8g4h TmZcoeb4XL3FbalyeOVAh5rszzRNaj8kcOpg3wdQpbsGOSxNkCq6Fmu8P 2y8jBN0SaANrNyTLCNpnM8mJUyXAQyW6fe8hmEJ5nOS4SEN1X1ch3kg2C DvoUaMxBFY+DxZfZXef8DqG2f7URAD2BrZsvw+frcz2ViHpVEd7eU9R7V 6ziyQI2TS45dLO7XcdpWE6HBba5lJ6smuAtCoHBLX5EbvO0p11vYBDFLi dYFwSWzN0fqItk4fVpKIKu/QZST5ILVFoyRHKgJPZo/Bg9d+rUJZJ/vqF w==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317931" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:44:59 +0800 IronPort-SDR: WbFcdkgzKvxi0CQ9Q6kfnM5ftMXts32o8oj+4I/4qA04abNLriLV3el9kR8+fYocXnjawsxKm2 n0/653KCOYn7RBjvTaxC9R12jQYeOPiTABskcYr2WjnG7kDBVMPMmykH00uX7mRG7f3MRnUiVX 3fBsnun74KCyDFPBl2ISxMiSKzl0JVy8jB95q6EsOgR2uG9srvIS9NSqVaA1UsA/v9uT1shzjF c9hYiabpVIquewe9z5TR2DbZSXRu5HoIzzGJ5+zOqbVFyyG7uFfvA6MXmrHM5ivYYJ71gGeGF/ BZs= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:01:07 -0700 IronPort-SDR: Uz7s+Dcx6yIQkvOUQB+fZBcewu2LBoSQ3pKR+yorfvauRCwyEfsemTaCli7NU9SOzvmIsB3Hts tNYBtX+nfuDEC5uXsXRcTKBMvdR7SGstEuCQUjhfSDF+BiYqMb/6WvHW+SrRgnWUnB48Q4E2C4 fbh8vMwc892YV531EYcZRUKNAzwNrgHgza3EAt8v4dtp8X3HEbGwrP9VyDAFzQUEaHs+TfI18c xIpJgsXVErH/79qMVG8Ygjlt4VP7eLqwzcPd+tJBQVyBPVtGsmWswAn0jdBYeDXDy1fyvy4CzS HRA= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:44:57 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 18/19] dm-crypt: check if adding pages to clone bio fails Date: Thu, 30 Mar 2023 03:44:00 -0700 Message-Id: <84973c41d58473dd50324853fb88a7fcff55745b.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org 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. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 3ba53dc3cc3f..19f7e087c6df 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 Thu Mar 30 10:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13193898 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC747C77B60 for ; Thu, 30 Mar 2023 10:47:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231462AbjC3KrP (ORCPT ); Thu, 30 Mar 2023 06:47:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbjC3Kp7 (ORCPT ); Thu, 30 Mar 2023 06:45:59 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F1CCC9EF5; Thu, 30 Mar 2023 03:45:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1680173121; x=1711709121; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9YnFTpWsIBbNef/OiYe0uKZ66yfnQqenOqdfFhTWuvw=; b=iGMu/L9fgOtfibbb1VDb+c5bVNJyPDUAIlLuCPl/SAuPEttkaJpYKSCW VEIoIlmbgtDpIBh0IejCgxxQY0knILwStNSiwoLXwlFFWtwzwds36sJkv bUaCyXaUOrdcoaTaHfOMkYAjGWPQzIeoSgMnzhx5vicbeEysGyhx1xdT5 YUaOq7f9MqkZJbzU5BDBo1DH8EDRqTAQHpp9MJ/MDVcSjQkv1SlR4gelU m/fxwrs/zWQweACbzMxZOnlqsTgsgzPYAdpnDdBtLSBgY1+z7tvkUJs5P E3og1lcio7n/1xq/AewEdPRvNkjNBZKqGpHWFHldu1W2U2ZIY8zdkydm5 A==; X-IronPort-AV: E=Sophos;i="5.98,303,1673884800"; d="scan'208";a="331317939" Received: from h199-255-45-14.hgst.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 30 Mar 2023 18:45:02 +0800 IronPort-SDR: Oj3XXvuBoG4EbDpmh92r68PyzslfXegh6DwzwZj4SRi1waK/UBUGnoEEyc/9qwgY4UqCrH8tm1 kxn9WTp8ndvKgRkRtHPJNqUnubk3ATXb9bcK6TgUVBNLr/OUEVq5K8vTvsKpIpn1IN80DpZA1J xNPa926zmR1wVfbGX8EZeFMx7nGXBdOosBUcC0PvUN2+mxdgHImS57At5QgxiApRYSiF4R3EcI 7s9cKHx55R1R/vmrAi9FHsJYeJVxddBfjY1GypsFHXCPd0T2s9EAARIaTqF3y3IDG/bs+bghQL W+g= Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 Mar 2023 03:01:10 -0700 IronPort-SDR: 9/iVByN1BTBiF+2N/dyRq0R7dQSPqShiTdspahbVYlwZj+qd277O1HWwqfoLFDxzoWSe+cmGNO qkqMCZzgrdZnDhpQxYdEe8150myn5LsK8KEx5pL72+ObD0hqMaaHSizvdtrMKOqlTNP+VQELhc NlTnbrlHYwL6lfM55WWo+X+nqbpVvrNh8MXJJfN+oROGcrGXbtZ95QXnOLEHZI8U/WSie1EYFD ciM8A+htMWi8T8Q2A6kN9QQtMNJHy+EVASUqPt+O4sCYrrpZ40AnMpPDuYxlZJyUb2MJgf0HsW yDM= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.72]) by uls-op-cesaip01.wdc.com with ESMTP; 30 Mar 2023 03:45:00 -0700 From: Johannes Thumshirn To: Jens Axboe Cc: Christoph Hellwig , Hannes Reinecke , Chaitanya Kulkarni , Damien Le Moal , Ming Lei , linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, dm-devel@redhat.com, Song Liu , linux-raid@vger.kernel.org, Mike Snitzer , Matthew Wilcox , Dave Kleikamp , jfs-discussion@lists.sourceforge.net, cluster-devel@redhat.com, Bob Peterson , Andreas Gruenbacher , David Sterba , linux-btrfs@vger.kernel.org, Johannes Thumshirn , Damien Le Moal Subject: [PATCH v2 19/19] block: mark bio_add_page as __must_check Date: Thu, 30 Mar 2023 03:44:01 -0700 Message-Id: <981a2b8809dedbd6dd756d7af1df4251944f42b0.1680172791.git.johannes.thumshirn@wdc.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Now that all users of bio_add_page check for the return value, mark bio_add_page as __must_check. Signed-off-by: Johannes Thumshirn Reviewed-by: Damien Le Moal --- 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 d766be7152e1..0f8a8d7a6384 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);