From patchwork Tue May 30 15:49:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13260558 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 05190C7EE32 for ; Tue, 30 May 2023 15:50:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9440D90000F; Tue, 30 May 2023 11:50:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8F5E6900005; Tue, 30 May 2023 11:50:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BC4690000F; Tue, 30 May 2023 11:50:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 6C7E9900005 for ; Tue, 30 May 2023 11:50:09 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 264F31A025A for ; Tue, 30 May 2023 15:50:09 +0000 (UTC) X-FDA: 80847357738.05.95E9E27 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by imf13.hostedemail.com (Postfix) with ESMTP id E29D42001B for ; Tue, 30 May 2023 15:50:05 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=ebFMpGy8; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf13.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685461806; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=VFstOFR9dzYVb1+kw7n2RDQsCPpdALjz5MVzELWluVI=; b=LwYStEpM1qFT1FxW4eeO85aXAfa/R9RwQ+vclOxUub3uYEkSoCtVz/wREFwoegl+Xv69zq sL/vy+qjfzm/cLrlOhnp161+oa6RPCx7XHeHxIHhsU8Uvv9ar0BJsVNQwpqgxwMHwf/ckE Um/sttHXQeDsWRllRIQ872/8Wck9whM= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=wdc.com header.s=dkim.wdc.com header.b=ebFMpGy8; dmarc=pass (policy=quarantine) header.from=wdc.com; spf=pass (imf13.hostedemail.com: domain of "prvs=507b913ec=johannes.thumshirn@wdc.com" designates 68.232.143.124 as permitted sender) smtp.mailfrom="prvs=507b913ec=johannes.thumshirn@wdc.com" ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685461806; a=rsa-sha256; cv=none; b=EWiz9HVI1L3SEVoFgOhTdEkM5zBwqcSwh5xKtDvOuMAOwivOlGt+1R+XBwi40KZ5NcJmhW sVP1g1aANwao4qdLLqh7adJ+tRzRX0FLOja0fnBbfhJ3DOe9XAMcxX19oEnKJPRTm1IfkB 030sNRpS0EWCMfPBHto7Vjgxb46kcWM= DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1685461805; x=1716997805; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=eFPese9aJpJiKXeG5e/nRQTUpeUtTBckLQcuuv9Sgrs=; b=ebFMpGy8UhO28I/xmPysd8JUeDXKU5jIy9o+2MnLy09+pttt8s+ZPXq0 maksThxU8JoRS7wty8hOZam6sZjZSOanzdVacpJHLia57/SW7bXkJSqDo QjFm1a9H6siM6az66txRfWhDN91/+igU8DRLcMnVDQlcSHUNCrdGsh004 VenZojkIR68oqeEeMm5puoRoWbm6IyrS+Qtkktp6iuDJd4qtFQuRHQJYV aGwf82hTUv5JLkGTPHJpnBZkaYIFqK0Sa1cAT8B9tPZOzAl/KtWdK4MRu CK9APldtmYOsWYmMOFG8gAcGT/3NK0Q69nqeC7Vcefv9FyYJRgSpj48HD w==; X-IronPort-AV: E=Sophos;i="6.00,204,1681142400"; d="scan'208";a="336465984" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 30 May 2023 23:50:04 +0800 IronPort-SDR: b6PXpwBSJTQ51aD1mjVdXt5X4aJB9Qv8veJBY8SKoalvk/tk0mtHr+gajWhAJ+Qe6Jh6tlTCvU 3dqt1Mm3nskqa/Bii3+lGXA72fwzFwmRgO6VbziUvccrltDXBOHVLWXphkUSZmSkKYI5XbnGC2 2ERyO6onZv6rGZXnLpWr/eRyZ+n/oedJv0V3jLI64uGgG60Mxj6Moxd1W7Yppxym9VYGq1pgiN mRFnwJFl5S7hO1H3FW7ia4BMrgENy1sj1VY8N36d1NOfaxO8UODq1SWcMv/DDgoOLtPp7Ofbcx 8/Q= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 30 May 2023 07:59:16 -0700 IronPort-SDR: uoO7OAb8Rbai8cKgJymQK7W4XKI+NlAnG6HDCi8QqM7mtI6E9SBztbMSPVAHHXkyD5wS0TiagB zwsZz4Lc/J2aZzF+Mlm2SSoQODj2TQmcJ97GwYMdyo0esUPwJRVyQz9paaoxA4nohmqRdWmmxO S250ZL7bmPo0YQ7S943KQRNaXs/Lw2JPLCCx68yUQpjAN3ERvara5+yzICrxbaCvHvUKuOeFn5 WQ2BgTAjgwj+oUkxmFhmgnUej8e/Wo6551HAGEv9hdjrJsbcc4zdEck0heYyMZJ0oinBH2yZjQ tl0= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 30 May 2023 08:50: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 , Mikulas Patocka , gouhao@uniontech.com, Johannes Thumshirn , Damien Le Moal , Sergey Senozhatsky Subject: [PATCH v6 11/20] zram: use __bio_add_page for adding single page to bio Date: Tue, 30 May 2023 08:49:14 -0700 Message-Id: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: E29D42001B X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: ragt1sciqi6raga1zqbe3t69fr1cqm6d X-HE-Tag: 1685461805-427426 X-HE-Meta: U2FsdGVkX1/Ut4lEt4NCUUvNOd9KdNn7l28jPO8IRf6URjoW/+eCVQFFcl0Iw5ZmyP8oGgfchhQfiZdZ1bKYHr5Gi3mj3VKW/BrvIKj0E4F51UeKcdaCQQDrIO+KT5TyX5ocs48yu4We50jGRbe8htt6ldQDID22d7hqUJLeEyRF3856RDAv2Pgh4dyKuGN6vv8tI7mobxbY9l9LtSHWcJzHBWtRwH14jdAUDZg2iWhJIPnFcTxU/pH25y1Pe+b+khP8+4ddnzAin2nXzyN32bJFZSFkmZo/VI5ojcg7vENb7H3BpYVNtBhJasQWbRj9sF65M6bUoeLtDDCgtzlchEp+hljslzNTNbil+NpDchx/UuEiY/9hRTlsY0sB4w7AZ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bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The zram writeback code uses bio_add_page() to add a page to a newly created bio. bio_add_page() can fail, but the return value is never checked. Use __bio_add_page() as adding a single page to a newly created bio is guaranteed to succeed. This brings us a step closer to marking bio_add_page() as __must_check. Reviewed-by: Damien Le Moal Reviewed-by: Sergey Senozhatsky Signed-off-by: Johannes Thumshirn Reviewed-by: Christoph Hellwig --- 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 f6d90f1ba5cf..b86691d2133e 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -700,7 +700,7 @@ static ssize_t writeback_store(struct device *dev, bio_init(&bio, zram->bdev, &bio_vec, 1, REQ_OP_WRITE | REQ_SYNC); bio.bi_iter.bi_sector = blk_idx * (PAGE_SIZE >> 9); - bio_add_page(&bio, page, PAGE_SIZE, 0); + __bio_add_page(&bio, page, PAGE_SIZE, 0); /* * XXX: A single page IO would be inefficient for write