From patchwork Thu Apr 20 10:04: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: 13219553 X-Patchwork-Delegate: snitzer@redhat.com 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 us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 01C48C77B75 for ; Fri, 21 Apr 2023 06:48:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1682059691; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=kXpB421/CzufXNePUa2LWEgklC+TV4eWTh1Q6/O1j+U=; b=BsnDndxAXsCcJCAElNK63/Pba3i3yCJI5/jsDzgKt/gtoHRtO95nJDUHym4hlxCn9cZQ7v V2CfqBHdoV/EzAj6IlaFCIAq20qahpfOURsr0YXXQ6eAR97ZOZSYySRE4mzqUHY9Eyotea YrWF7sow702cqH7AyIEXzuvm7WDf4PU= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-444-uowynueyMraYqy3MsZWkjA-1; Fri, 21 Apr 2023 02:48:04 -0400 X-MC-Unique: uowynueyMraYqy3MsZWkjA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 14D7C884ED9; Fri, 21 Apr 2023 06:47:56 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id EF9562166B40; Fri, 21 Apr 2023 06:47:55 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 3AABD1949741; Fri, 21 Apr 2023 06:47:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2557019472C8 for ; Thu, 20 Apr 2023 10:06:34 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 3C4B62166B39; Thu, 20 Apr 2023 10:06:29 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 346522166B3F for ; Thu, 20 Apr 2023 10:06:11 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CEC86800B35 for ; Thu, 20 Apr 2023 10:06:11 +0000 (UTC) Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-481-8EtrsGKFP8yFNJT52Tdbnw-2; Thu, 20 Apr 2023 06:06:07 -0400 X-MC-Unique: 8EtrsGKFP8yFNJT52Tdbnw-2 Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-3f177cb2c6cso3447905e9.2; Thu, 20 Apr 2023 03:06:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681985166; x=1684577166; 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=D58hy5/Cr3/DLqz8bPLF+cijdU1EeyUsaB6+w7+K1A4=; b=N8+yCqdO5sz8AiPEk93dOZKkNPYB6aY7lFFD5gUardbRz5sZ8JocWhvPea9fFa4eQd PlMmLFJhLUye9/IGtzp/qW2XYLyA2gs1x78VapayMnTaicezKILFSOeVwHkjz5Ckd3hI ADaX3vIyM9+aAczMEDSDr5MkW1oo6f4t0NIqfoaNPBi79aCVRvtMcNaZu/Xy7REawRW8 Ln9bSVfstJSUW9C++95E1lssLyLSSugJeBb0u9M2NCPhVVgUDcHYr6IAWz1zVKsuU/t1 ++uELeJVsee0sx4uCfE11eKM3AD+UThpCqFKtTsspvuAiXmF/h+FxCIWuUgWtsHRZk17 dRpQ== X-Gm-Message-State: AAQBX9dMQyVPToq7696cJEyoujQkLoaVIitCvt7IdBEHdE1Cu8EvimXq wmagukhzR2NwfYQAUR9HBu0= X-Google-Smtp-Source: AKy350bXJClLxz7rmMe8gZjcJmijV8o1TvktEKHe1Qv5MkDKw9WPVystlZxB2+xk1NShvg63MQKQYA== X-Received: by 2002:adf:fec6:0:b0:2ef:1c8c:1113 with SMTP id q6-20020adffec6000000b002ef1c8c1113mr929778wrs.9.1681985165839; Thu, 20 Apr 2023 03:06:05 -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.06.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Apr 2023 03:06:05 -0700 (PDT) From: Johannes Thumshirn To: axboe@kernel.dk Date: Thu, 20 Apr 2023 12:04:52 +0200 Message-Id: <20230420100501.32981-14-jth@kernel.org> In-Reply-To: <20230420100501.32981-1-jth@kernel.org> References: <20230420100501.32981-1-jth@kernel.org> MIME-Version: 1.0 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mailman-Approved-At: Fri, 21 Apr 2023 06:47:49 +0000 Subject: [dm-devel] [PATCH v4 13/22] zram: use __bio_add_page for adding single page to bio X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: shaggy@kernel.org, jfs-discussion@lists.sourceforge.net, linux-mm@kvack.org, dm-devel@redhat.com, hch@lst.de, agruenba@redhat.com, Damien Le Moal , willy@infradead.org, cluster-devel@redhat.com, kch@nvidia.com, snitzer@kernel.org, ming.lei@redhat.com, linux-block@vger.kernel.org, rpeterso@redhat.com, dsterba@suse.com, linux-raid@vger.kernel.org, damien.lemoal@wdc.com, song@kernel.org, johannes.thumshirn@wdc.com, linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org From: Johannes Thumshirn 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 Reviewed-by: Sergey Senozhatsky --- 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