diff options
author | Xiao Ni <xni@redhat.com> | 2020-08-25 13:42:59 +0800 |
---|---|---|
committer | Song Liu <songliubraving@fb.com> | 2020-09-24 16:44:45 -0700 |
commit | 2628089b74d5a64bd0bcb5d247a18f78d7b6f4d0 (patch) | |
tree | 47ba9f41e75f0dfaa6fda2a52e37d491b54b00a8 /drivers/md/raid0.c | |
parent | e287308b8388590ad70e8e88d1cc70a4643bacd7 (diff) |
md: add md_submit_discard_bio() for submitting discard bio
Move these logic from raid0.c to md.c, so that we can also use it in
raid10.c.
Reviewed-by: Coly Li <colyli@suse.de>
Reviewed-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: Xiao Ni <xni@redhat.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
Diffstat (limited to 'drivers/md/raid0.c')
-rw-r--r-- | drivers/md/raid0.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index aa2d72791768..e2de0cced707 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -494,7 +494,6 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) for (disk = 0; disk < zone->nb_dev; disk++) { sector_t dev_start, dev_end; - struct bio *discard_bio = NULL; struct md_rdev *rdev; if (disk < start_disk_index) @@ -517,18 +516,9 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio) rdev = conf->devlist[(zone - conf->strip_zone) * conf->strip_zone[0].nb_dev + disk]; - if (__blkdev_issue_discard(rdev->bdev, + md_submit_discard_bio(mddev, rdev, bio, dev_start + zone->dev_start + rdev->data_offset, - dev_end - dev_start, GFP_NOIO, 0, &discard_bio) || - !discard_bio) - continue; - bio_chain(discard_bio, bio); - bio_clone_blkg_association(discard_bio, bio); - if (mddev->gendisk) - trace_block_bio_remap(bdev_get_queue(rdev->bdev), - discard_bio, disk_devt(mddev->gendisk), - bio->bi_iter.bi_sector); - submit_bio_noacct(discard_bio); + dev_end - dev_start); } bio_endio(bio); } |