On Mon, Aug 24, 2020 at 10:43 PM Xiao Ni <xni@xxxxxxxxxx> wrote: > [...] > --- > drivers/md/raid10.c | 254 +++++++++++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 253 insertions(+), 1 deletion(-) > [...] > + > +static void raid10_end_discard_request(struct bio *bio) > +{ > + struct r10bio *r10_bio = bio->bi_private; > + struct r10conf *conf = r10_bio->mddev->private; > + struct md_rdev *rdev = NULL; > + int dev; > + int slot, repl; > + > + /* > + * We don't care the return value of discard bio > + */ > + if (!test_bit(R10BIO_Uptodate, &r10_bio->state)) > + set_bit(R10BIO_Uptodate, &r10_bio->state); We don't need the test_bit(), just do set_bit(). > + > + dev = find_bio_disk(conf, r10_bio, bio, &slot, &repl); > + if (repl) > + rdev = conf->mirrors[dev].replacement; > + if (!rdev) { > + /* raid10_remove_disk uses smp_mb to make sure rdev is set to > + * replacement before setting replacement to NULL. It can read > + * rdev first without barrier protect even replacment is NULL > + */ > + smp_rmb(); > + repl = 0; repl is no longer used, right? > + rdev = conf->mirrors[dev].rdev; [...] > + > + if (conf->reshape_progress != MaxSector && > + ((bio->bi_iter.bi_sector >= conf->reshape_progress) != > + conf->mddev->reshape_backwards)) > + geo = &conf->prev; Do we need to set R10BIO_Previous here? Also, please run some tests with reshape in progress. Thanks, Song