mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 04:34:03 +02:00
dm: use clear_and_wake_up_bit() in device mapper
The helper was introduced in 'commit 8236b0ae31 ("bdi: wake up
concurrent wb_shutdown() callers.")' as a generic way of doing the same
sequence of operations:
clear_bit_unlock();
smp_mb__after_atomic();
wake_up_bit();
The helper was first implemented to avoid bugs caused by forgetting to
call `wake_up_bit()` after `clear_bit_unlock()`. Replace the open-coded
sequence with the helper to avoid duplicate code and reduce code paths
to maintain.
Suggested-by: code@agatha.dev
Link: https://kernelnewbies.org/Beginner%20Cleanup%20and%20Refactor%20Tasks%20by%20Agatha%20Isabelle%20Moreira#task_001
Link: https://kernelnewbies.org/Beginner%20Cleanup%20and%20Refactor%20Tasks%20by%20Agatha%20Isabelle%20Moreira#task_002
Signed-off-by: Jiangong.Han <jiangong.han@windriver.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
This commit is contained in:
parent
0729a9b4ee
commit
c92d632f86
|
|
@ -911,9 +911,7 @@ static int init_hash_tables(struct dm_snapshot *s)
|
|||
|
||||
static void merge_shutdown(struct dm_snapshot *s)
|
||||
{
|
||||
clear_bit_unlock(RUNNING_MERGE, &s->state_bits);
|
||||
smp_mb__after_atomic();
|
||||
wake_up_bit(&s->state_bits, RUNNING_MERGE);
|
||||
clear_and_wake_up_bit(RUNNING_MERGE, &s->state_bits);
|
||||
}
|
||||
|
||||
static struct bio *__release_queued_bios_after_merge(struct dm_snapshot *s)
|
||||
|
|
|
|||
|
|
@ -519,9 +519,7 @@ static void dmz_mblock_bio_end_io(struct bio *bio)
|
|||
else
|
||||
flag = DMZ_META_READING;
|
||||
|
||||
clear_bit_unlock(flag, &mblk->state);
|
||||
smp_mb__after_atomic();
|
||||
wake_up_bit(&mblk->state, flag);
|
||||
clear_and_wake_up_bit(flag, &mblk->state);
|
||||
|
||||
bio_put(bio);
|
||||
}
|
||||
|
|
@ -1910,9 +1908,7 @@ void dmz_unlock_zone_reclaim(struct dm_zone *zone)
|
|||
WARN_ON(dmz_is_active(zone));
|
||||
WARN_ON(!dmz_in_reclaim(zone));
|
||||
|
||||
clear_bit_unlock(DMZ_RECLAIM, &zone->flags);
|
||||
smp_mb__after_atomic();
|
||||
wake_up_bit(&zone->flags, DMZ_RECLAIM);
|
||||
clear_and_wake_up_bit(DMZ_RECLAIM, &zone->flags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -106,9 +106,7 @@ static void dmz_reclaim_kcopy_end(int read_err, unsigned long write_err,
|
|||
else
|
||||
zrc->kc_err = 0;
|
||||
|
||||
clear_bit_unlock(DMZ_RECLAIM_KCOPY, &zrc->flags);
|
||||
smp_mb__after_atomic();
|
||||
wake_up_bit(&zrc->flags, DMZ_RECLAIM_KCOPY);
|
||||
clear_and_wake_up_bit(DMZ_RECLAIM_KCOPY, &zrc->flags);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user