mirror of
https://github.com/torvalds/linux.git
synced 2024-12-12 14:12:51 +00:00
md/raid5: Don't read ->active_stripes if it's not needed
The atomic_read() is not needed in many cases so only do the read after the first checks are done. Suggested-by: Christoph Hellwig <hch@infradead.org> Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Song Liu <song@kernel.org>
This commit is contained in:
parent
2f2d51efd8
commit
f9287c3e93
@ -789,15 +789,14 @@ struct stripe_request_ctx {
|
||||
*/
|
||||
static bool is_inactive_blocked(struct r5conf *conf, int hash)
|
||||
{
|
||||
int active = atomic_read(&conf->active_stripes);
|
||||
|
||||
if (list_empty(conf->inactive_list + hash))
|
||||
return false;
|
||||
|
||||
if (!test_bit(R5_INACTIVE_BLOCKED, &conf->cache_state))
|
||||
return true;
|
||||
|
||||
return active < (conf->max_nr_stripes * 3 / 4);
|
||||
return (atomic_read(&conf->active_stripes) <
|
||||
(conf->max_nr_stripes * 3 / 4));
|
||||
}
|
||||
|
||||
struct stripe_head *raid5_get_active_stripe(struct r5conf *conf,
|
||||
|
Loading…
Reference in New Issue
Block a user