Skip to content

Commit ad3fc79

Browse files
GuoqingJiang-Linuxliu-song-6
authored andcommitted
md: revert io stats accounting
The commit 41d2d84 ("md: improve io stats accounting") could cause double fault problem per the report [1], and also it is not correct to change ->bi_end_io if md don't own it, so let's revert it. And io stats accounting will be replemented in later commits. [1]. https://lore.kernel.org/linux-raid/[email protected]/T/#t Fixes: 41d2d84 ("md: improve io stats accounting") Signed-off-by: Guoqing Jiang <[email protected]> Signed-off-by: Song Liu <[email protected]>
1 parent d07f3b0 commit ad3fc79

File tree

2 files changed

+0
-46
lines changed

2 files changed

+0
-46
lines changed

drivers/md/md.c

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -441,30 +441,6 @@ void md_handle_request(struct mddev *mddev, struct bio *bio)
441441
}
442442
EXPORT_SYMBOL(md_handle_request);
443443

444-
struct md_io {
445-
struct mddev *mddev;
446-
bio_end_io_t *orig_bi_end_io;
447-
void *orig_bi_private;
448-
struct block_device *orig_bi_bdev;
449-
unsigned long start_time;
450-
};
451-
452-
static void md_end_io(struct bio *bio)
453-
{
454-
struct md_io *md_io = bio->bi_private;
455-
struct mddev *mddev = md_io->mddev;
456-
457-
bio_end_io_acct_remapped(bio, md_io->start_time, md_io->orig_bi_bdev);
458-
459-
bio->bi_end_io = md_io->orig_bi_end_io;
460-
bio->bi_private = md_io->orig_bi_private;
461-
462-
mempool_free(md_io, &mddev->md_io_pool);
463-
464-
if (bio->bi_end_io)
465-
bio->bi_end_io(bio);
466-
}
467-
468444
static blk_qc_t md_submit_bio(struct bio *bio)
469445
{
470446
const int rw = bio_data_dir(bio);
@@ -489,21 +465,6 @@ static blk_qc_t md_submit_bio(struct bio *bio)
489465
return BLK_QC_T_NONE;
490466
}
491467

492-
if (bio->bi_end_io != md_end_io) {
493-
struct md_io *md_io;
494-
495-
md_io = mempool_alloc(&mddev->md_io_pool, GFP_NOIO);
496-
md_io->mddev = mddev;
497-
md_io->orig_bi_end_io = bio->bi_end_io;
498-
md_io->orig_bi_private = bio->bi_private;
499-
md_io->orig_bi_bdev = bio->bi_bdev;
500-
501-
bio->bi_end_io = md_end_io;
502-
bio->bi_private = md_io;
503-
504-
md_io->start_time = bio_start_io_acct(bio);
505-
}
506-
507468
/* bio could be mergeable after passing to underlayer */
508469
bio->bi_opf &= ~REQ_NOMERGE;
509470

@@ -5608,7 +5569,6 @@ static void md_free(struct kobject *ko)
56085569

56095570
bioset_exit(&mddev->bio_set);
56105571
bioset_exit(&mddev->sync_set);
5611-
mempool_exit(&mddev->md_io_pool);
56125572
kfree(mddev);
56135573
}
56145574

@@ -5705,11 +5665,6 @@ static int md_alloc(dev_t dev, char *name)
57055665
*/
57065666
mddev->hold_active = UNTIL_STOP;
57075667

5708-
error = mempool_init_kmalloc_pool(&mddev->md_io_pool, BIO_POOL_SIZE,
5709-
sizeof(struct md_io));
5710-
if (error)
5711-
goto abort;
5712-
57135668
error = -ENOMEM;
57145669
mddev->queue = blk_alloc_queue(NUMA_NO_NODE);
57155670
if (!mddev->queue)

drivers/md/md.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ struct mddev {
487487
struct bio_set sync_set; /* for sync operations like
488488
* metadata and bitmap writes
489489
*/
490-
mempool_t md_io_pool;
491490

492491
/* Generic flush handling.
493492
* The last to finish preflush schedules a worker to submit

0 commit comments

Comments
 (0)