From patchwork Thu Aug 3 13:27:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu Kuai X-Patchwork-Id: 13340007 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 078DBEB64DD for ; Thu, 3 Aug 2023 13:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235631AbjHCNcQ (ORCPT ); Thu, 3 Aug 2023 09:32:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235319AbjHCNcA (ORCPT ); Thu, 3 Aug 2023 09:32:00 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3445A2D69; Thu, 3 Aug 2023 06:30:53 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RGqVH20Tmz4f400M; Thu, 3 Aug 2023 21:30:47 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgCnD7MGrMtkNVvlPQ--.7517S4; Thu, 03 Aug 2023 21:30:47 +0800 (CST) From: Yu Kuai To: song@kernel.org, xni@redhat.com Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yukuai3@huawei.com, yukuai1@huaweicloud.com, yi.zhang@huawei.com, yangerkun@huawei.com Subject: [PATCH -next 0/7] md: initialize 'active_io' while allocating Date: Thu, 3 Aug 2023 21:27:44 +0800 Message-Id: <20230803132751.2741652-1-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CM-T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-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-raid@vger.kernel.org From: Yu Kuai This is the 4th patchset to do some preparatory work to synchronize io with array reconfiguration. 1) The first patchset refactor 'active_io', make sure that mddev_suspend() will wait for io to be done. [1] 2) The second patchset remove 'quiesce' callback from mddev_suspend(), so that mddev_suspend() doesn't rely on 'quiesce' callback is registered, and can be used for all personalites; [2] 3) Make array reconfiguration independent from daemon thread, and synchronize it with io will be much easier because io may rely on daemon thread to be done. 4) This patchset move initialization of 'active_io' from md_run() to md_alloc(), so that mddev_suspend() won't rely on holding 'reconfig_mutex' to check if 'mddev->pers' is set, and it can be called at any time after mddev is allocated.(Done by patch 1, and other patches are cleanup) Yu Kuai (7): md: initialize 'active_io' while allocating mddev md: initialize 'writes_pending' while allocating mddev md: don't rely on 'mddev->pers' to be set in mddev_suspend() md-bitmap: remove the checking of 'pers->quiesce' from location_store() md-bitmap: suspend array earlier in location_store() md: don't check 'mddev->pers' from suspend_hi_store() md: don't check 'mddev->pers' and 'pers->quiesce' from suspend_lo_store() [1] https://lore.kernel.org/all/20230621165110.1498313-1-yukuai1@huaweicloud.com/ [2] https://lore.kernel.org/all/20230628012931.88911-2-yukuai1@huaweicloud.com/ drivers/md/dm-raid.c | 7 ++- drivers/md/md-bitmap.c | 47 +++++++++---------- drivers/md/md.c | 100 ++++++++++++++++++++--------------------- drivers/md/md.h | 4 +- drivers/md/raid1.c | 3 +- drivers/md/raid10.c | 3 -- drivers/md/raid5.c | 3 -- 7 files changed, 78 insertions(+), 89 deletions(-)