Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp2529088rdg; Mon, 14 Aug 2023 05:40:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxAOkjrUlxjQCBLbzycuBtzAMPqdgSAe4dsb/VNp5U0yO3DCpSGNZFQ5xuKH0BMu0MgczH X-Received: by 2002:a05:6a00:17a2:b0:687:20d6:faea with SMTP id s34-20020a056a0017a200b0068720d6faeamr9799804pfg.15.1692016856524; Mon, 14 Aug 2023 05:40:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692016856; cv=none; d=google.com; s=arc-20160816; b=Q45vtUFvxfS3MsdgaxB3PYhUw0FbHPCsuAkERBfJW2++geXOs8vzvRniIsqqdjk/Rt dryWKDzJpdwoxE/+jubYtZlc/WftBdAPq9U4Wv/cIm+Xc08m5HvTp4PTEaW3lxf0Z0oC PX7Ifsv3qgQyMgqUdYoYwqOXEfxXWI5TqzSvi63B0ajqBhn9tMk/iLX2tEUU48kfA5if Y85vakRGlo6myTcREVEXuYsHRTthuGe4VlXBsMDVlouXNys0LPLN9SejRZn+0x0Im0ng jKC6k77GWbybkYyts7fh06cZa3bhweR7TsveWCPPnrALuoKkj/q06x7EwjpgMqwlrXnd MHBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kgb1jw0bzFWkffgnm96Ld5vnVs7PAmnVM7ePjYfLhG0=; fh=R1tTuDpDJrPStbMgD7FsPvvypXhZmvNVAWdzCL1pAU8=; b=HP/mC1PBv44sH3aVWURDNe3hshHB8cfkUBdT7B9IivI/7RT0ZO6F62L2YSujSn18pE Y/HMtgBmbuLy+UUI5fIvzK0SfA1MuOXSMGMH5/d0+mdriVDC0l4eR08sHY+e/xZmEBZp 9NYvFuN3tYLNgpLnU5MYG8qJT+vx+575HfrgorDuqeoIDfRaa8QDtXyujHCjS3jOSMag Ui3ms6DBw9/01oW/T3U/tvDx73Clgqycvl6azGPUmkXJDzX6Vl85jlOtvtuFOmPpB/E2 diS2gBk2WvzssnuPiaN8smniWXmx1Tut7NXXfIFfCZkJPv2HFUEf2HKkyh9YnQdYoVH6 r1UQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MiJAu+Bf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bq13-20020a056a000e0d00b006872089fa3fsi7788004pfb.283.2023.08.14.05.40.44; Mon, 14 Aug 2023 05:40:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MiJAu+Bf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231757AbjHNMDq (ORCPT + 99 others); Mon, 14 Aug 2023 08:03:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbjHNMDO (ORCPT ); Mon, 14 Aug 2023 08:03:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9F3381984 for ; Mon, 14 Aug 2023 05:02:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692014478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=kgb1jw0bzFWkffgnm96Ld5vnVs7PAmnVM7ePjYfLhG0=; b=MiJAu+BfH1uo13cLYa95YwW8rl/EttRqhrNF3rQKVb75O603agUZ5bt1xOfkGRKm4Ktw6D b1NSrSoc5KiB0N0R+hpLW5vFAwBcWioesDmT/349GU5/DlL+BHxiZPe2e24jUTtU9H5Qim /Rwajk4jmr5xfJXbQWPze78J/1tOUGk= Received: from mimecast-mx02.redhat.com (66.187.233.73 [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-488-4dYH5Rj3P0qmCT4XJv9qrQ-1; Mon, 14 Aug 2023 08:01:17 -0400 X-MC-Unique: 4dYH5Rj3P0qmCT4XJv9qrQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E45A53802131; Mon, 14 Aug 2023 12:01:16 +0000 (UTC) Received: from o.redhat.com (unknown [10.39.192.18]) by smtp.corp.redhat.com (Postfix) with ESMTP id 387441121314; Mon, 14 Aug 2023 12:01:16 +0000 (UTC) From: heinzm@redhat.com To: linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org Cc: xni@redhat.com, ncroxon@redhat.com Subject: [PATCH v2] md raid1: allow writebehind to work on any leg device set WriteMostly Date: Mon, 14 Aug 2023 14:01:15 +0200 Message-ID: <2a9592bf3340f34bf588eec984b23ee219f3985e.1692013451.git.heinzm@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Heinz Mauelshagen This is version 2 replacing my previous patch series as requested by Song Liu. As the WriteMostly flag can be set on any component device of a RAID1 array, remove the constraint that it only works if set on the first one. Signed-off-by: Heinz Mauelshagen Tested-by: Xiao Ni --- drivers/md/raid1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index dd25832eb045..913cd46b786b 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1519,7 +1519,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, * allocate memory, or a reader on WriteMostly * is waiting for behind writes to flush */ if (bitmap && - test_bit(WriteMostly, &rdev->flags) && + write_behind && (atomic_read(&bitmap->behind_writes) < mddev->bitmap_info.max_write_behind) && !waitqueue_active(&bitmap->behind_wait)) { -- 2.41.0