From patchwork Thu Apr 20 10:04:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13218300 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 6381EC77B7E for ; Thu, 20 Apr 2023 10:05:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E7CB5900005; Thu, 20 Apr 2023 06:05:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E2D19900002; Thu, 20 Apr 2023 06:05:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CA612900005; Thu, 20 Apr 2023 06:05:54 -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 B6903900002 for ; Thu, 20 Apr 2023 06:05:54 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6AA8E1C5F93 for ; Thu, 20 Apr 2023 10:05:54 +0000 (UTC) X-FDA: 80701338228.06.E58EFF2 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by imf05.hostedemail.com (Postfix) with ESMTP id 99B3A100015 for ; Thu, 20 Apr 2023 10:05:52 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf05.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1681985152; 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; bh=s93ifE1gU+0FrrRIOdnaALh6w14X2Hkv+dazvnzybyI=; b=OiDKDF3xni2vXLpgvCSj0BE5WFfHqkAYtD0PzHcSZXhFXuYX0HuGgk8vBUt8iZirk5Cm0B ickVp+FC930blvfnRDlK028KemifMPY2+BTHFXoLOBGPUjmylPl3311fQtD22nJtEkSE3L EEWdk6Z56Rl3sAaiUVyC80CHauf0s6E= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=kernel.org (policy=none); spf=pass (imf05.hostedemail.com: domain of morbidrsa@gmail.com designates 209.85.221.50 as permitted sender) smtp.mailfrom=morbidrsa@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1681985152; a=rsa-sha256; cv=none; b=hRm/f7u4a/PIjHRJ393soGizgx3BYgU03Vvu+XLxJoCiVdEYGilYR+y2nMo2C0WJaee7VR LDmo2itzjiceL+q/NsD5bgFDpd1EZIcT1soh5alGcXIbPlfO65hyn0ss04n/iAeQbh0OER 7YZ2ng/+GFtRHPbiBU2UUNkgPwGlyuE= Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-2fe3fb8e2f7so289692f8f.0 for ; Thu, 20 Apr 2023 03:05:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985151; x=1684577151; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=s93ifE1gU+0FrrRIOdnaALh6w14X2Hkv+dazvnzybyI=; b=AtrrCFEa0rO8IowTzDww8HyMbWXmag6FHlcAad5+KDAiNC0UH1bGrjpn7C7AGreYpG WfT8zP1wMPYvgUFlglUM9hhGw/UtpF/nQQetsFbGbdlWdyjixQu4JN1i/DFf5QNpsXWJ ZuoIP63iAdZLBGdRBzTa8+x91fwOsIRrWQ1j5ygcxeuewUcCgEJmcbiZ08prwRxn07lE fVggXjp6kqh7wyYGzNId57a5kmV/TdCAGegohicbKy7Y/zaRQxznigHAsoGGQJpF5m4A tZiDq3lphycNaQzdQhk6/H6q5VxBpynnceMwEzjNZe5OqTQAy1yDseJeOf8OCVET5sXC cirw== X-Gm-Message-State: AAQBX9fMoyCqxBLFcQHwKje9PXQZ8r/pJNsY88gW0eeLLDcCyxKqHl0y msS51BjQs4wx1g3oQ2LDtaw= X-Google-Smtp-Source: AKy350ZJizpAlK8UcdkIuYKpQ5Y/PZoh+EKKcTgVEjvN6d0zqGLWnY/auHncEOXRAbbDYcB+iyhuyg== X-Received: by 2002:a5d:6149:0:b0:2fb:9dbb:3407 with SMTP id y9-20020a5d6149000000b002fb9dbb3407mr833176wrt.51.1681985151089; Thu, 20 Apr 2023 03:05:51 -0700 (PDT) Received: from localhost.localdomain (aftr-62-216-205-208.dynamic.mnet-online.de. [62.216.205.208]) by smtp.googlemail.com with ESMTPSA id l11-20020a5d674b000000b0030276f42f08sm201410wrw.88.2023.04.20.03.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:05:50 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Cc: johannes.thumshirn@wdc.com, agruenba@redhat.com, cluster-devel@redhat.com, damien.lemoal@wdc.com, dm-devel@redhat.com, dsterba@suse.com, hare@suse.de, hch@lst.de, jfs-discussion@lists.sourceforge.net, kch@nvidia.com, linux-block@vger.kernel.org, linux-btrfs@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, Damien Le Moal Subject: [PATCH v4 01/22] swap: use __bio_add_page to add page to bio Date: Thu, 20 Apr 2023 12:04:40 +0200 Message-Id: <20230420100501.32981-2-jth@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 99B3A100015 X-Stat-Signature: 7gu94x4k6ueu3ht1hq8z6dmena6tucq3 X-HE-Tag: 1681985152-271936 X-HE-Meta: U2FsdGVkX19FSPZvaVJfRJPz7wCs8zjDMGfMjRBkigjUASpYKHorqlLS5ykaf9qBICaCUTl+enUDkN2ZZelbHZUSNalXKHI9Zv5tsZ1vtLKlAZRR9aHiH+wTGCEslJ8hRHHH0sEujSAs/gyF45jHQnkFYI6CLAv4u85w95dlD82RGS4AKcyFRwZd9/jwtcQ/1BctFtvXZlWnKtv7fg0MwMmeguMcEQkMF7Ig9c6MtVH0DtLaoYy43HdvWcwSbO2gYssLl/o1We/+aIZYYIyha82hqlIyAfN5Ny0d3auFYCwmV7RaTNQHh2DFt+XMKGNftfDk0WXqztH6U7gWTbWhrSx0302wiIHBp4HvAuJoQD2Kn1t7yWGyvNzOR5arwao1ubEoS6EoPl5q4A6t3sxeJ8qejCNHTO1i/n3x6NHCm+XlZ6EThQt8+voIionBo3OH2hlrMBo9p3sYVW27EAGQB/uUyIolkt5DwxNbSEVKCteQjbcGQMMDoSzowOLQJRMmF5cNRsY/8rnMRWSh5Y6GEfD/Fcc9Ti48/nVwwaD0azcUv/wjYoSq678uup3HlL0inYwtwpD1gzZtYM5dMfu9JvdKb82TMAPVMKM86yfJG5E+4Gsas2bKrk/wUSnoVeRj69V/1Qa0WMsX/4R8GvhmRJYYs8A0NrGMsfY3i+TMBF2eWOaoOb++L/HBTFpucLGAUxyNNFrX9HuzsvppZG4s5OFSE4hI3QhI3SRlJbKn10cBE4XHzwL8uFAtMnh0kn/MzFcoJwd+sJqB8/KMBrMBhBrxRJx1jQCGmkjISXZzPREhc9ijb4soXpqBElVS9GSU1Q2QJizv6m+HTI0LCn46z0YzK0MBaXVBKkwGVWvNqrrZxsaH7LgvHoP6BvR2GIPNjc+r+1HYswrFRRNQvMtX2oUtiPE2qnYarr2u2/WOcPU7G1Et5W9xskRc6kf33Ct8Eqz6J4rJijD96QCqdOz BFmBRxBb EE5Qxbt8BOEfI+5BRk/+WAqQ8rB/co57WLK4zp/cDR2O6A341h7Cu0BNBe1ZKvkuDIEjtkuJlmUMODE1KA72JE8ypJGKBaQilUyTlI1lFc72opZounvl5u1A5EmDPemas9HlddMGZ8dXRZtr6qCn9cMHw6VzSuB5SvUgejYrh1Qi+K61ztIxIXLtsXod1NUYqqVyL3GgUGv2yjzYLXcygIqbL2fbgkboNCtU9WgzkgREmPc/LwSHyKgixsubtEEByWa1KiHiaok53vPENV0Gd0GCvl0/yPiQsC+QW0Q1JKWiut6GLhFeL3VMVU3UpK1ldX0hha9IjNAGI5JEYq/q8bRi9n+Z02v/fvU9Nx3ist2xujWU1kLhhplxxS3r6/YBMAdujZhZ4xBGdQyLy7Af0QDV6X8s87QUqiY+dLLx0ugamCSwhX/XMc8t6jVQE299U0HyXHWvu2LMEu1Hl6CcBsk4yu5w8womMGDL113cQw/+x2wvM99sIALwyDxModybRjznUG65RMeZH1t+z4rqB8JrX7usPGxN0ZOa77XkX1qU0GZv5wrR28CSaQrzb1tD+oAeq2y7i8iVL1Ntg3IGitqH5MqdI2PiFZ5I24tk4kcVhpTuBTLU2VoY3AqMd4uLwYYWBM/wyqgl37iiLE/1taBBSmZK4S5RxYn0DBf9+bZmcKzNYFnT5MpB20+X0HtlebWrd/8J04zzpKM7rrf7/xhc3Z5t/GZNBCKLOingBXyw9IrDVszSNNuFC+buI//+U3UKB 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: From: Johannes Thumshirn 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); }