Message ID | 20230529131106.2123367-5-yukuai1@huaweicloud.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp1506849vqr; Mon, 29 May 2023 06:17:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5afGZJ1oNokqRXq76sZXR5tK0LlZp6TDlX09wTKX+wt/ZYuTm59QVgoMqAqBtbvlSddPw6 X-Received: by 2002:a17:90b:806:b0:256:1fd3:b593 with SMTP id bk6-20020a17090b080600b002561fd3b593mr10377094pjb.38.1685366250998; Mon, 29 May 2023 06:17:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685366250; cv=none; d=google.com; s=arc-20160816; b=Xz58ErwFMWIcSW71XEffUg9s4z5CiAApuCypjIW2Kp3tfK42ESDvEhjg60XUm97vy5 WRQ9laPd1/iU9gpbGfandrJ8/TlWpvs1g1j2uBLPQxhDU0O/Yvr7jywCheIFDOHmYTUW fHjJxZn0bolALRrqiZ8Bzhve8vga5+r5Si5cwHuqORrZzXIfG5O16oNhqVP5BPP1oHla aRlTnWCX1/+eVlLvkl0h9p8G+AUub2TfJ4lgroyDgJLMfQbGEcc40xh+CP5mdJz7EVc2 K5y3r8TcC5EhAuqtl6Ey6gD8iAyX646eirFrMIIdEM8XNFOXlcG1l5ZojwKRTxSa+1kd UqNg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DuXgK8HfTyg0Nrw66pwMDifS1e1Ihx7OJctNFYks9FE=; b=Vr7WOeOjCLhK5vcaeVIlBiNoW6b3jT3zYuJaEvvBQ7m9hmJzHJfz5QUwbJThA7EXwd dDgfiebOz9qaROtnYmmKtizFlQNme5hRJDNaqkz20+I78AyWGRmgkE5YtSnEXRHzjIqV jTFYPiq62rfsw5r+EVkSx/ubSd3m5ULGU03msMKY86isg3YnDALxJw5W6zyEuo+/IX/P zKIk7RsTSEtDArbc8sGu8cw5Hk4N7DspDNxaYDOPXj3uJtJ70CpRjfYh4Nc3ImbX6YIz XwEEuuIRNZCmFUJ3WUjH4Yoh2Gjm6UgXLIF56TSmIWU34M3ZNUI8N7MvXet1MvoW3Xvq 66pw== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o27-20020a63921b000000b00534919b4ca2si8720120pgd.151.2023.05.29.06.17.18; Mon, 29 May 2023 06:17:30 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbjE2NPa (ORCPT <rfc822;callmefire3@gmail.com> + 99 others); Mon, 29 May 2023 09:15:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbjE2NPL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 29 May 2023 09:15:11 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF201AD; Mon, 29 May 2023 06:14:50 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4QVGGF55Sgz4f3y3M; Mon, 29 May 2023 21:14:45 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP4 (Coremail) with SMTP id gCh0CgAHcLNDpXRknNjnKQ--.28139S8; Mon, 29 May 2023 21:14:46 +0800 (CST) From: Yu Kuai <yukuai1@huaweicloud.com> To: song@kernel.org, neilb@suse.de, akpm@osdl.org Cc: xni@redhat.com, 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 v3 4/7] md/raid1-10: submit write io directly if bitmap is not enabled Date: Mon, 29 May 2023 21:11:03 +0800 Message-Id: <20230529131106.2123367-5-yukuai1@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230529131106.2123367-1-yukuai1@huaweicloud.com> References: <20230529131106.2123367-1-yukuai1@huaweicloud.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgAHcLNDpXRknNjnKQ--.28139S8 X-Coremail-Antispam: 1UD129KBjvJXoWxuF18KFWfuryrKF4xGFW7Arb_yoW5AFWrpa yDGa4Ykr15JFW3X3ZxAa4DAFyFywn7tr9rKryfC395uFy3XFsxGFWrGay5twn7CrnxGFsx Xr15KryDCr1UXrJanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUPF14x267AKxVWrJVCq3wAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_JF0E3s1l82xGYI kIc2x26xkF7I0E14v26ryj6s0DM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2 z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Cr1j6r xdM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0D M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2 IY04v7MxAIw28IcxkI7VAKI48JMxC20s026xCaFVCjc4AY6r1j6r4UMI8I3I0E5I8CrVAF wI0_Jr0_Jr4lx2IqxVCjr7xvwVAFwI0_JrI_JrWlx4CE17CEb7AF67AKxVWUtVW8ZwCIc4 0Y0x0EwIxGrwCI42IY6xIIjxv20xvE14v26r1I6r4UMIIF0xvE2Ix0cI8IcVCY1x0267AK xVWxJVW8Jr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F 4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjfUOBTY UUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, MAY_BE_FORGED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1767234601882872512?= X-GMAIL-MSGID: =?utf-8?q?1767234601882872512?= |
Series |
limit the number of plugged bio
|
|
Commit Message
Yu Kuai
May 29, 2023, 1:11 p.m. UTC
From: Yu Kuai <yukuai3@huawei.com> Commit 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") add bitmap support, and it changed that write io is submitted through daemon thread because bitmap need to be updated before write io. And later, plug is used to fix performance regression because all the write io will go to demon thread, which means io can't be issued concurrently. However, if bitmap is not enabled, the write io should not go to daemon thread in the first place, and plug is not needed as well. Fixes: 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") Signed-off-by: Yu Kuai <yukuai3@huawei.com> --- drivers/md/md-bitmap.c | 4 +--- drivers/md/md-bitmap.h | 7 +++++++ drivers/md/raid1-10.c | 13 +++++++++++-- 3 files changed, 19 insertions(+), 5 deletions(-)
Comments
On Mon, May 29, 2023 at 9:14 PM Yu Kuai <yukuai1@huaweicloud.com> wrote: > > From: Yu Kuai <yukuai3@huawei.com> > > Commit 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") > add bitmap support, and it changed that write io is submitted through > daemon thread because bitmap need to be updated before write io. And > later, plug is used to fix performance regression because all the write io > will go to demon thread, which means io can't be issued concurrently. > > However, if bitmap is not enabled, the write io should not go to daemon > thread in the first place, and plug is not needed as well. > > Fixes: 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") > Signed-off-by: Yu Kuai <yukuai3@huawei.com> > --- > drivers/md/md-bitmap.c | 4 +--- > drivers/md/md-bitmap.h | 7 +++++++ > drivers/md/raid1-10.c | 13 +++++++++++-- > 3 files changed, 19 insertions(+), 5 deletions(-) > > diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c > index ad5a3456cd8a..3ee590cf12a7 100644 > --- a/drivers/md/md-bitmap.c > +++ b/drivers/md/md-bitmap.c > @@ -1016,7 +1016,6 @@ static int md_bitmap_file_test_bit(struct bitmap *bitmap, sector_t block) > return set; > } > > - > /* this gets called when the md device is ready to unplug its underlying > * (slave) device queues -- before we let any writes go down, we need to > * sync the dirty pages of the bitmap file to disk */ > @@ -1026,8 +1025,7 @@ void md_bitmap_unplug(struct bitmap *bitmap) > int dirty, need_write; > int writing = 0; > > - if (!bitmap || !bitmap->storage.filemap || > - test_bit(BITMAP_STALE, &bitmap->flags)) > + if (!md_bitmap_enabled(bitmap)) > return; > > /* look at each page to see if there are any set bits that need to be > diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h > index cfd7395de8fd..3a4750952b3a 100644 > --- a/drivers/md/md-bitmap.h > +++ b/drivers/md/md-bitmap.h > @@ -273,6 +273,13 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot, > sector_t *lo, sector_t *hi, bool clear_bits); > void md_bitmap_free(struct bitmap *bitmap); > void md_bitmap_wait_behind_writes(struct mddev *mddev); > + > +static inline bool md_bitmap_enabled(struct bitmap *bitmap) > +{ > + return bitmap && bitmap->storage.filemap && > + !test_bit(BITMAP_STALE, &bitmap->flags); > +} > + > #endif > > #endif > diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c > index 506299bd55cb..73cc3cb9154d 100644 > --- a/drivers/md/raid1-10.c > +++ b/drivers/md/raid1-10.c > @@ -131,9 +131,18 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio, > blk_plug_cb_fn unplug) > { > struct raid1_plug_cb *plug = NULL; > - struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev, > - sizeof(*plug)); > + struct blk_plug_cb *cb; > + > + /* > + * If bitmap is not enabled, it's safe to submit the io directly, and > + * this can get optimal performance. > + */ > + if (!md_bitmap_enabled(mddev->bitmap)) { > + raid1_submit_write(bio); > + return true; > + } Can we check this out of raid1_add_bio_to_plug and call raid1_submit_write directly in make_request function? Regards Xiao > > + cb = blk_check_plugged(unplug, mddev, sizeof(*plug)); > if (!cb) > return false; > > -- > 2.39.2 >
Hi, 在 2023/05/31 15:26, Xiao Ni 写道: > On Mon, May 29, 2023 at 9:14 PM Yu Kuai <yukuai1@huaweicloud.com> wrote: >> >> From: Yu Kuai <yukuai3@huawei.com> >> >> Commit 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") >> add bitmap support, and it changed that write io is submitted through >> daemon thread because bitmap need to be updated before write io. And >> later, plug is used to fix performance regression because all the write io >> will go to demon thread, which means io can't be issued concurrently. >> >> However, if bitmap is not enabled, the write io should not go to daemon >> thread in the first place, and plug is not needed as well. >> >> Fixes: 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") >> Signed-off-by: Yu Kuai <yukuai3@huawei.com> >> --- >> drivers/md/md-bitmap.c | 4 +--- >> drivers/md/md-bitmap.h | 7 +++++++ >> drivers/md/raid1-10.c | 13 +++++++++++-- >> 3 files changed, 19 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c >> index ad5a3456cd8a..3ee590cf12a7 100644 >> --- a/drivers/md/md-bitmap.c >> +++ b/drivers/md/md-bitmap.c >> @@ -1016,7 +1016,6 @@ static int md_bitmap_file_test_bit(struct bitmap *bitmap, sector_t block) >> return set; >> } >> >> - >> /* this gets called when the md device is ready to unplug its underlying >> * (slave) device queues -- before we let any writes go down, we need to >> * sync the dirty pages of the bitmap file to disk */ >> @@ -1026,8 +1025,7 @@ void md_bitmap_unplug(struct bitmap *bitmap) >> int dirty, need_write; >> int writing = 0; >> >> - if (!bitmap || !bitmap->storage.filemap || >> - test_bit(BITMAP_STALE, &bitmap->flags)) >> + if (!md_bitmap_enabled(bitmap)) >> return; >> >> /* look at each page to see if there are any set bits that need to be >> diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h >> index cfd7395de8fd..3a4750952b3a 100644 >> --- a/drivers/md/md-bitmap.h >> +++ b/drivers/md/md-bitmap.h >> @@ -273,6 +273,13 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot, >> sector_t *lo, sector_t *hi, bool clear_bits); >> void md_bitmap_free(struct bitmap *bitmap); >> void md_bitmap_wait_behind_writes(struct mddev *mddev); >> + >> +static inline bool md_bitmap_enabled(struct bitmap *bitmap) >> +{ >> + return bitmap && bitmap->storage.filemap && >> + !test_bit(BITMAP_STALE, &bitmap->flags); >> +} >> + >> #endif >> >> #endif >> diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c >> index 506299bd55cb..73cc3cb9154d 100644 >> --- a/drivers/md/raid1-10.c >> +++ b/drivers/md/raid1-10.c >> @@ -131,9 +131,18 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio, >> blk_plug_cb_fn unplug) >> { >> struct raid1_plug_cb *plug = NULL; >> - struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev, >> - sizeof(*plug)); >> + struct blk_plug_cb *cb; >> + >> + /* >> + * If bitmap is not enabled, it's safe to submit the io directly, and >> + * this can get optimal performance. >> + */ >> + if (!md_bitmap_enabled(mddev->bitmap)) { >> + raid1_submit_write(bio); >> + return true; >> + } > > Can we check this out of raid1_add_bio_to_plug and call > raid1_submit_write directly in make_request function? Of course we can, I'm trying to avoid redundant code here... Thanks, Kuai > > Regards > Xiao >> >> + cb = blk_check_plugged(unplug, mddev, sizeof(*plug)); >> if (!cb) >> return false; >> >> -- >> 2.39.2 >> > > . >
On Wed, May 31, 2023 at 4:25 PM Yu Kuai <yukuai1@huaweicloud.com> wrote: > > Hi, > > 在 2023/05/31 15:26, Xiao Ni 写道: > > On Mon, May 29, 2023 at 9:14 PM Yu Kuai <yukuai1@huaweicloud.com> wrote: > >> > >> From: Yu Kuai <yukuai3@huawei.com> > >> > >> Commit 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") > >> add bitmap support, and it changed that write io is submitted through > >> daemon thread because bitmap need to be updated before write io. And > >> later, plug is used to fix performance regression because all the write io > >> will go to demon thread, which means io can't be issued concurrently. > >> > >> However, if bitmap is not enabled, the write io should not go to daemon > >> thread in the first place, and plug is not needed as well. > >> > >> Fixes: 6cce3b23f6f8 ("[PATCH] md: write intent bitmap support for raid10") > >> Signed-off-by: Yu Kuai <yukuai3@huawei.com> > >> --- > >> drivers/md/md-bitmap.c | 4 +--- > >> drivers/md/md-bitmap.h | 7 +++++++ > >> drivers/md/raid1-10.c | 13 +++++++++++-- > >> 3 files changed, 19 insertions(+), 5 deletions(-) > >> > >> diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c > >> index ad5a3456cd8a..3ee590cf12a7 100644 > >> --- a/drivers/md/md-bitmap.c > >> +++ b/drivers/md/md-bitmap.c > >> @@ -1016,7 +1016,6 @@ static int md_bitmap_file_test_bit(struct bitmap *bitmap, sector_t block) > >> return set; > >> } > >> > >> - > >> /* this gets called when the md device is ready to unplug its underlying > >> * (slave) device queues -- before we let any writes go down, we need to > >> * sync the dirty pages of the bitmap file to disk */ > >> @@ -1026,8 +1025,7 @@ void md_bitmap_unplug(struct bitmap *bitmap) > >> int dirty, need_write; > >> int writing = 0; > >> > >> - if (!bitmap || !bitmap->storage.filemap || > >> - test_bit(BITMAP_STALE, &bitmap->flags)) > >> + if (!md_bitmap_enabled(bitmap)) > >> return; > >> > >> /* look at each page to see if there are any set bits that need to be > >> diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h > >> index cfd7395de8fd..3a4750952b3a 100644 > >> --- a/drivers/md/md-bitmap.h > >> +++ b/drivers/md/md-bitmap.h > >> @@ -273,6 +273,13 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot, > >> sector_t *lo, sector_t *hi, bool clear_bits); > >> void md_bitmap_free(struct bitmap *bitmap); > >> void md_bitmap_wait_behind_writes(struct mddev *mddev); > >> + > >> +static inline bool md_bitmap_enabled(struct bitmap *bitmap) > >> +{ > >> + return bitmap && bitmap->storage.filemap && > >> + !test_bit(BITMAP_STALE, &bitmap->flags); > >> +} > >> + > >> #endif > >> > >> #endif > >> diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c > >> index 506299bd55cb..73cc3cb9154d 100644 > >> --- a/drivers/md/raid1-10.c > >> +++ b/drivers/md/raid1-10.c > >> @@ -131,9 +131,18 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio, > >> blk_plug_cb_fn unplug) > >> { > >> struct raid1_plug_cb *plug = NULL; > >> - struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev, > >> - sizeof(*plug)); > >> + struct blk_plug_cb *cb; > >> + > >> + /* > >> + * If bitmap is not enabled, it's safe to submit the io directly, and > >> + * this can get optimal performance. > >> + */ > >> + if (!md_bitmap_enabled(mddev->bitmap)) { > >> + raid1_submit_write(bio); > >> + return true; > >> + } > > > > Can we check this out of raid1_add_bio_to_plug and call > > raid1_submit_write directly in make_request function? > > Of course we can, I'm trying to avoid redundant code here... I know. But it doesn't fit the name of the function. Regards Xiao > > Thanks, > Kuai > > > > Regards > > Xiao > >> > >> + cb = blk_check_plugged(unplug, mddev, sizeof(*plug)); > >> if (!cb) > >> return false; > >> > >> -- > >> 2.39.2 > >> > > > > . > > >
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index ad5a3456cd8a..3ee590cf12a7 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -1016,7 +1016,6 @@ static int md_bitmap_file_test_bit(struct bitmap *bitmap, sector_t block) return set; } - /* this gets called when the md device is ready to unplug its underlying * (slave) device queues -- before we let any writes go down, we need to * sync the dirty pages of the bitmap file to disk */ @@ -1026,8 +1025,7 @@ void md_bitmap_unplug(struct bitmap *bitmap) int dirty, need_write; int writing = 0; - if (!bitmap || !bitmap->storage.filemap || - test_bit(BITMAP_STALE, &bitmap->flags)) + if (!md_bitmap_enabled(bitmap)) return; /* look at each page to see if there are any set bits that need to be diff --git a/drivers/md/md-bitmap.h b/drivers/md/md-bitmap.h index cfd7395de8fd..3a4750952b3a 100644 --- a/drivers/md/md-bitmap.h +++ b/drivers/md/md-bitmap.h @@ -273,6 +273,13 @@ int md_bitmap_copy_from_slot(struct mddev *mddev, int slot, sector_t *lo, sector_t *hi, bool clear_bits); void md_bitmap_free(struct bitmap *bitmap); void md_bitmap_wait_behind_writes(struct mddev *mddev); + +static inline bool md_bitmap_enabled(struct bitmap *bitmap) +{ + return bitmap && bitmap->storage.filemap && + !test_bit(BITMAP_STALE, &bitmap->flags); +} + #endif #endif diff --git a/drivers/md/raid1-10.c b/drivers/md/raid1-10.c index 506299bd55cb..73cc3cb9154d 100644 --- a/drivers/md/raid1-10.c +++ b/drivers/md/raid1-10.c @@ -131,9 +131,18 @@ static inline bool raid1_add_bio_to_plug(struct mddev *mddev, struct bio *bio, blk_plug_cb_fn unplug) { struct raid1_plug_cb *plug = NULL; - struct blk_plug_cb *cb = blk_check_plugged(unplug, mddev, - sizeof(*plug)); + struct blk_plug_cb *cb; + + /* + * If bitmap is not enabled, it's safe to submit the io directly, and + * this can get optimal performance. + */ + if (!md_bitmap_enabled(mddev->bitmap)) { + raid1_submit_write(bio); + return true; + } + cb = blk_check_plugged(unplug, mddev, sizeof(*plug)); if (!cb) return false;