On 2021/05/26 4:50, Mikulas Patocka wrote: > The functions set_bit and clear_bit are atomic. We don't need atomicity > when making flags for dm-kcopyd. So, change them to direct manipulation of > the flags. > > Signed-off-by: Mikulas Patocka <mpatocka@xxxxxxxxxx> > > Index: linux-2.6/drivers/md/dm-kcopyd.c > =================================================================== > --- linux-2.6.orig/drivers/md/dm-kcopyd.c > +++ linux-2.6/drivers/md/dm-kcopyd.c > @@ -812,7 +812,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_cli > if (!test_bit(DM_KCOPYD_WRITE_SEQ, &job->flags)) { > for (i = 0; i < job->num_dests; i++) { > if (bdev_zoned_model(dests[i].bdev) == BLK_ZONED_HM) { > - set_bit(DM_KCOPYD_WRITE_SEQ, &job->flags); > + job->flags |= 1UL << DM_KCOPYD_WRITE_SEQ; How about using the BIT() macro ? job->flags |= BIT(DM_KCOPYD_WRITE_SEQ); But I know some do not like that macro :) > break; > } > } > @@ -823,7 +823,7 @@ void dm_kcopyd_copy(struct dm_kcopyd_cli > */ > if (test_bit(DM_KCOPYD_WRITE_SEQ, &job->flags) && > test_bit(DM_KCOPYD_IGNORE_ERROR, &job->flags)) > - clear_bit(DM_KCOPYD_IGNORE_ERROR, &job->flags); > + job->flags &= ~(1UL << DM_KCOPYD_IGNORE_ERROR); > > if (from) { > job->source = *from; > Index: linux-2.6/drivers/md/dm-raid1.c > =================================================================== > --- linux-2.6.orig/drivers/md/dm-raid1.c > +++ linux-2.6/drivers/md/dm-raid1.c > @@ -364,7 +364,7 @@ static void recover(struct mirror_set *m > > /* hand to kcopyd */ > if (!errors_handled(ms)) > - set_bit(DM_KCOPYD_IGNORE_ERROR, &flags); > + flags |= 1UL << DM_KCOPYD_IGNORE_ERROR; > > dm_kcopyd_copy(ms->kcopyd_client, &from, ms->nr_mirrors - 1, to, > flags, recovery_complete, reg); > Index: linux-2.6/drivers/md/dm-zoned-reclaim.c > =================================================================== > --- linux-2.6.orig/drivers/md/dm-zoned-reclaim.c > +++ linux-2.6/drivers/md/dm-zoned-reclaim.c > @@ -134,7 +134,7 @@ static int dmz_reclaim_copy(struct dmz_r > dst_zone_block = dmz_start_block(zmd, dst_zone); > > if (dmz_is_seq(dst_zone)) > - set_bit(DM_KCOPYD_WRITE_SEQ, &flags); > + flags |= 1UL << DM_KCOPYD_WRITE_SEQ; > > while (block < end_block) { > if (src_zone->dev->flags & DMZ_BDEV_DYING) > > -- > dm-devel mailing list > dm-devel@xxxxxxxxxx > https://listman.redhat.com/mailman/listinfo/dm-devel Either way, looks fine to me. Reviewed-by: Damien Le Moal <damien.lemoal@xxxxxxx> -- Damien Le Moal Western Digital Research -- dm-devel mailing list dm-devel@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/dm-devel