mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 22:26:55 +00:00
md/bitmap: don't set max_write_behind if there is no write mostly device
We shouldn't set it since write behind IO should only happen to write mostly device. Signed-off-by: Guoqing Jiang <guoqing.jiang@linux.dev> Signed-off-by: Song Liu <songliubraving@fb.com>
This commit is contained in:
parent
e2daec488c
commit
8c13ab115b
1 changed files with 19 additions and 0 deletions
|
@ -2469,11 +2469,30 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len)
|
||||||
{
|
{
|
||||||
unsigned long backlog;
|
unsigned long backlog;
|
||||||
unsigned long old_mwb = mddev->bitmap_info.max_write_behind;
|
unsigned long old_mwb = mddev->bitmap_info.max_write_behind;
|
||||||
|
struct md_rdev *rdev;
|
||||||
|
bool has_write_mostly = false;
|
||||||
int rv = kstrtoul(buf, 10, &backlog);
|
int rv = kstrtoul(buf, 10, &backlog);
|
||||||
if (rv)
|
if (rv)
|
||||||
return rv;
|
return rv;
|
||||||
if (backlog > COUNTER_MAX)
|
if (backlog > COUNTER_MAX)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Without write mostly device, it doesn't make sense to set
|
||||||
|
* backlog for max_write_behind.
|
||||||
|
*/
|
||||||
|
rdev_for_each(rdev, mddev) {
|
||||||
|
if (test_bit(WriteMostly, &rdev->flags)) {
|
||||||
|
has_write_mostly = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!has_write_mostly) {
|
||||||
|
pr_warn_ratelimited("%s: can't set backlog, no write mostly device available\n",
|
||||||
|
mdname(mddev));
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
mddev->bitmap_info.max_write_behind = backlog;
|
mddev->bitmap_info.max_write_behind = backlog;
|
||||||
if (!backlog && mddev->serial_info_pool) {
|
if (!backlog && mddev->serial_info_pool) {
|
||||||
/* serial_info_pool is not needed if backlog is zero */
|
/* serial_info_pool is not needed if backlog is zero */
|
||||||
|
|
Loading…
Reference in a new issue