Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1051687lqb; Sat, 25 May 2024 04:03:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXOwPla0U7guh9SE1NNfYXgEUa4NwTqhODdE1x8rYa93PeVLveJVz/S0YnRnZZxYPtdHDwQlCRameOMnO8RFSlvJmIwIWG8Lj+D/88uPQ== X-Google-Smtp-Source: AGHT+IE8dtJ1I7OQt6dw5tRp617QDh2W+5A6mFMZZz6yUpIWk/v/SCmns9pDaJ1F7phuYaLRf1qt X-Received: by 2002:a17:90b:604:b0:2b6:c650:fb54 with SMTP id 98e67ed59e1d1-2bf5f50a0cdmr4123022a91.49.1716635010365; Sat, 25 May 2024 04:03:30 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716635010; cv=pass; d=google.com; s=arc-20160816; b=iMkJ7xkH/jFGEit3WSR8wOzi4oqOUqAr3lSVp13ezHQDBiUWEyhBd3FecL/WAnBvL9 612zrUdloLQhlCU3DlIoHDBQ+n/ym+5KWLQN7fVR4K0SJPO63Klgw14sE5m7sk6Nxtme IlgcVa0IeJhGAFzV+I85RwyL+BN7h/axubZ6umRaB+a5yaUjyc4dFNL6T01i8iWr8k8F gh+FPxy8aHBoJi/aYoGkTUxocSw0fF6OCV/LZQr71woLHmzTZZssdXPs5U+oBi8WR7pY joqWQtYdSPvbkspGbfpq0Z4EhU2L1Fcaias9Qlqo8XCluKTphicOuFctwY9VowOg2Y9X czXA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=cafROArktJjgx04OGq0CkiwWOTVfvovsJ2iPAfZ9HoA=; fh=28EuWr4MhzDXZAVQkxEi6gcJnTSM0St+/jNROXmfNys=; b=pmFd4kh6xqVwiIYt5apgofJXAE1v/tUOr7SEoy8DjvPdMI78uga3klZsgt9OmhBjip ZMeCHuuhocwuX0mVk/U4iRPL4GNVqt8R8wt5R1rRZT5leah6N/wHDqftm3yXUvFasei/ vgp8jtLmBfKh74xv8eHg92aVEYoiF9JACE3fLys2wAOM4i1Zrhu0axK4NsC9tqA7i6W4 IYvNla78YueY38OtBfvBJxg+ZE0vq4Ovzd+aXE8E2HGs9nbln5vaoLVwZSZGPrw9Aa0c cZLiyyMhokJS97Eqm8t8DsT3rpFWn8MpC6Z4XK/AHblEn0yySZc3uiB5qhGLWP6Y75jb Gx7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-189343-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189343-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bf5fe864a2si2836330a91.170.2024.05.25.04.03.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 04:03:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189343-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-189343-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189343-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DE888281C50 for ; Sat, 25 May 2024 11:03:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 25F433A1A2; Sat, 25 May 2024 11:03:22 +0000 (UTC) Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2CB121A2C04; Sat, 25 May 2024 11:03:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716635001; cv=none; b=HKON+DUF2epgF7IU2zCi98idg+eEPxJ9RlLU4sam745C2L8twmjq3hmtXfBOO8IzEwpV6Xet2LOX3C2yh7HpL3VhONU0PqrVAy7/WtgW1RjPHsFRv6002PhwR6xFdO7lqsEPhUjoLRo7VcZFOPG02wlKYdabA+gJ59m7rAW62+w= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716635001; c=relaxed/simple; bh=mou4fAjdh+yOsoWo0L90brn3S71ynw18k0dsVf4gNws=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fQg6z+vDLdEJupxL0s2ifRpddH1vXhe7TKQQauqQEvn1ngMUDAG9NohiRvKlRrz5sshm5FXEGEEuymXyAIXsxAVC5FTnnhhE4vBax1SFmQFmhOe0nKt2P4sq7cn9/JdJ53G51Qyca9Zv4IKZPfmYez3K/3v7Blklfpq5glr0FLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VmfCF5Dvwz4f3mJB; Sat, 25 May 2024 19:03:05 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 598861A01A7; Sat, 25 May 2024 19:03:16 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBnOBFzxVFmwOyJNg--.6823S4; Sat, 25 May 2024 19:03:16 +0800 (CST) From: linan666@huaweicloud.com To: song@kernel.org Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linan666@huaweicloud.com, yukuai3@huawei.com, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com Subject: [PATCH] md: make md_flush_request() more readable Date: Sun, 26 May 2024 02:56:22 +0800 Message-Id: <20240525185622.3896616-1-linan666@huaweicloud.com> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgBnOBFzxVFmwOyJNg--.6823S4 X-Coremail-Antispam: 1UD129KBjvdXoWrKFy5Zr4UKryUCFWktw1DZFb_yoWDKrbEga ykZ34fGr42g34fKr1Uuw43A34Fya1Duw4DWF9Ig343Zry5A3y8KF95Wws8Zw18JFWxWr98 K3yjqrWa9rn3KjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbf8FF20E14v26r4j6ryUM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6rWj6s0DM7CIcVAFz4kK6r1j6r18M280x2IEY4vEnII2IxkI6r1a6r45M28lY4IEw2IIxx k0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK 6xIIjxv20xvEc7CjxVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7 xvwVC2z280aVCY1x0267AKxVW0oVCq3wAac4AC62xK8xCEY4vEwIxC4wAS0I0E0xvYzxvE 52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0I7IYx2IY67AKxVWUGV WUXwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r4UM4x0Y48IcxkI7VAK I48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwAKzVCY07xG64k0F24l42xK82IYc2Ij64vIr4 1l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK 67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI 8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAv wI8IcIk0rVW3JVWrJr1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267 AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7sRRrWrDUUUUU== X-CM-SenderInfo: polqt0awwwqx5xdzvxpfor3voofrz/ From: Li Nan Setting bio to NULL and checking 'if(!bio)' is redundant and looks strange, just consolidate them into one condition. There are no functional changes. Signed-off-by: Li Nan --- drivers/md/md.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index aff9118ff697..509e5638cea1 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -654,15 +654,12 @@ bool md_flush_request(struct mddev *mddev, struct bio *bio) WARN_ON(percpu_ref_is_zero(&mddev->active_io)); percpu_ref_get(&mddev->active_io); mddev->flush_bio = bio; - bio = NULL; - } - spin_unlock_irq(&mddev->lock); - - if (!bio) { + spin_unlock_irq(&mddev->lock); INIT_WORK(&mddev->flush_work, submit_flushes); queue_work(md_wq, &mddev->flush_work); } else { /* flush was performed for some other bio while we waited. */ + spin_unlock_irq(&mddev->lock); if (bio->bi_iter.bi_size == 0) /* an empty barrier - all done */ bio_endio(bio); -- 2.39.2