From patchwork Wed May 31 11:50:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Thumshirn X-Patchwork-Id: 13262071 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 A237DC7EE32 for ; Wed, 31 May 2023 11:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235896AbjEaLwr (ORCPT ); Wed, 31 May 2023 07:52:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50132 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235833AbjEaLwi (ORCPT ); Wed, 31 May 2023 07:52:38 -0400 Received: from esa2.hgst.iphmx.com (esa2.hgst.iphmx.com [68.232.143.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 066BA123; Wed, 31 May 2023 04:51: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=1685533895; x=1717069895; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KEvuqAniWi8kHi4qA/R0NoUerrluHuejNoQFU/cmxk4=; b=J24jctzumPMiGWgXGhq6qW91L/82wi4j6TBenPuVdo/NqsHlwpEvsp1q rI0g/9o5KIix3nTKi9gAD5UKp59hpJ5CPp4JhihDXCx9iroXWYYqrdNJp STp4FjQ5oK+9FnQLfDZEcIdBsiHmr6c132kcZxKri9OBOs67eu5C2gWKd o0dqmvNsVqtSfeXlIVQtIR55MFub7gxgqwNK54lkpmbbT0IvSG/W85BK/ P1vij3b7Xk1eT003XvT1G/lpUY/GYB2wUC26hXDWqCL6TebQnWMqw0IY5 bUlL5BKjuICnKB02DiwcrU8qfexG17L5/n1N8ZsP4rmispbmT1wP+ZU76 A==; X-IronPort-AV: E=Sophos;i="6.00,207,1681142400"; d="scan'208";a="336547950" Received: from uls-op-cesaip01.wdc.com (HELO uls-op-cesaep01.wdc.com) ([199.255.45.14]) by ob1.hgst.iphmx.com with ESMTP; 31 May 2023 19:51:25 +0800 IronPort-SDR: AcJ/ngkHAWRsELSQuq7k8Rfxuk2f+J8s4x6gRpQLcwQm+k8gJxRdqgwY1Hspbx4slyFaNE0f66 hb3eDfe3O3mDaxQPZ0u56O6s1AFViVWdKHZ/m8wbq9FCONf8HglLlrflgn3xjBKyTZhDgfCNB6 7LwAxU3+UbgVjoeBBtN7sqKs+lplUkkMsm5Pa6iTtuOQ2gy1NItC0s/Kl/cPDum1asq0wcHMTJ lqrgG1HeIRY78AuesoZmdru4a6igANxk6bZC2BwjrqZkIrGrEUXPjEvOtDZQEy1uQ66fdCmYq9 niU= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep01.wdc.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 31 May 2023 04:06:18 -0700 IronPort-SDR: kmu31oBFaHnnNAJGr+xhYJn5TvPy7FWZ+3bDl/POq5dEGZ6Ww4ILjSxttl5EfKXZDUQcRli+rZ moVYwDDX+fxlfeNlv+Wrfhx9qjjhuINsRqJ7wDqXzpUIu1qfANLUrv5fZXWn+bq6nOyCp9mL+A jd+tV7p/CL7GZwMnIHFGfEi2kh03FzkyIpZKhbWLGSyU/rpV7IQd8BnuVNyYVVF4Clnms4udrr 8axxTzuHHRxPpkFC7dekm4y71BAXSfErGtkIM3AXOE0UhIxp+Ce8ckzsRvifEaDe/YrKNROIOM ZV0= WDCIronportException: Internal Received: from unknown (HELO redsun91.ssa.fujisawa.hgst.com) ([10.149.66.6]) by uls-op-cesaip02.wdc.com with ESMTP; 31 May 2023 04:51:23 -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 , gouha7@uniontech.com, Johannes Thumshirn , Damien Le Moal , Sergey Senozhatsky Subject: [PATCH v7 11/20] zram: use __bio_add_page for adding single page to bio Date: Wed, 31 May 2023 04:50:34 -0700 Message-Id: X-Mailer: git-send-email 2.40.1 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. Reviewed-by: Damien Le Moal Reviewed-by: Sergey Senozhatsky Reviewed-by: Christoph Hellwig Signed-off-by: Johannes Thumshirn --- drivers/block/zram/zram_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index 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