md/raid10: fix missing discard IO accounting
authorYu Kuai <yukuai3@huawei.com>
Tue, 25 Mar 2025 01:57:46 +0000 (09:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 25 Apr 2025 08:45:39 +0000 (10:45 +0200)
[ Upstream commit d05af90d6218e9c8f1c2026990c3f53c1b41bfb0 ]

md_account_bio() is not called from raid10_handle_discard(), now that we
handle bitmap inside md_account_bio(), also fix missing
bitmap_startwrite for discard.

Test whole disk discard for 20G raid10:

Before:
Device   d/s     dMB/s   drqm/s  %drqm d_await dareq-sz
md0    48.00     16.00     0.00   0.00    5.42   341.33

After:
Device   d/s     dMB/s   drqm/s  %drqm d_await dareq-sz
md0    68.00  20462.00     0.00   0.00    2.65 308133.65

Link: https://lore.kernel.org/linux-raid/20250325015746.3195035-1-yukuai1@huaweicloud.com
Fixes: 528bc2cf2fcc ("md/raid10: enable io accounting")
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Acked-by: Coly Li <colyli@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/raid10.c

index c300fd609ef08c3af861b3622651d8a40447bc67..36b6bf3f8b29fd060f9514ecd696325692c7d344 100644 (file)
@@ -1756,6 +1756,7 @@ retry_discard:
         * The discard bio returns only first r10bio finishes
         */
        if (first_copy) {
+               md_account_bio(mddev, &bio);
                r10_bio->master_bio = bio;
                set_bit(R10BIO_Discard, &r10_bio->state);
                first_copy = false;