]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid5: make sure stripe_size as power of two
authorYufen Yu <yuyufen@huawei.com>
Thu, 20 Aug 2020 13:22:05 +0000 (09:22 -0400)
committerSong Liu <songliubraving@fb.com>
Fri, 28 Aug 2020 05:41:03 +0000 (22:41 -0700)
commit924e1090c5887083553d364143989f9dd594df0e
treea89dd520a4a67f44838f946d7419228da345a44d
parent1f18f7f48c003a2d09a1fe5b4469ffa16e7e8307
md/raid5: make sure stripe_size as power of two

Commit 1e76902576fd ("md/raid5: support config stripe_size by sysfs
entry") make stripe_size as a configurable value. It just requires
stripe_size as multiple of 4KB.

In fact, we should make sure stripe_size as power of two. Otherwise,
stripe_shift which is the result of ilog2 can not represent the real
stripe_size. Then, stripe_hash() and stripe_hash_locks_hash() may
get unexpected value.

Fixes: 1e76902576fd ("md/raid5: support config stripe_size by sysfs entry")
Signed-off-by: Yufen Yu <yuyufen@huawei.com>
Signed-off-by: Song Liu <songliubraving@fb.com>
drivers/md/raid5.c