Skip to content

Commit 579b517

Browse files
committed
Merge branch 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-5.16/drivers
Pull MD updates from Song: "The only significant change here is a fix in back_log sysfs entry, by Guoqing Jiang." * 'md-next' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: raid5-ppl: use swap() to make code cleaner md/bitmap: don't set max_write_behind if there is no write mostly device
2 parents e2daec4 + 1e37799 commit 579b517

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

drivers/md/md-bitmap.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,11 +2469,30 @@ backlog_store(struct mddev *mddev, const char *buf, size_t len)
24692469
{
24702470
unsigned long backlog;
24712471
unsigned long old_mwb = mddev->bitmap_info.max_write_behind;
2472+
struct md_rdev *rdev;
2473+
bool has_write_mostly = false;
24722474
int rv = kstrtoul(buf, 10, &backlog);
24732475
if (rv)
24742476
return rv;
24752477
if (backlog > COUNTER_MAX)
24762478
return -EINVAL;
2479+
2480+
/*
2481+
* Without write mostly device, it doesn't make sense to set
2482+
* backlog for max_write_behind.
2483+
*/
2484+
rdev_for_each(rdev, mddev) {
2485+
if (test_bit(WriteMostly, &rdev->flags)) {
2486+
has_write_mostly = true;
2487+
break;
2488+
}
2489+
}
2490+
if (!has_write_mostly) {
2491+
pr_warn_ratelimited("%s: can't set backlog, no write mostly device available\n",
2492+
mdname(mddev));
2493+
return -EINVAL;
2494+
}
2495+
24772496
mddev->bitmap_info.max_write_behind = backlog;
24782497
if (!backlog && mddev->serial_info_pool) {
24792498
/* serial_info_pool is not needed if backlog is zero */

drivers/md/raid5-ppl.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,7 @@ static int ppl_load_distributed(struct ppl_log *log)
10811081
struct ppl_conf *ppl_conf = log->ppl_conf;
10821082
struct md_rdev *rdev = log->rdev;
10831083
struct mddev *mddev = rdev->mddev;
1084-
struct page *page, *page2, *tmp;
1084+
struct page *page, *page2;
10851085
struct ppl_header *pplhdr = NULL, *prev_pplhdr = NULL;
10861086
u32 crc, crc_stored;
10871087
u32 signature;
@@ -1156,9 +1156,7 @@ static int ppl_load_distributed(struct ppl_log *log)
11561156
prev_pplhdr_offset = pplhdr_offset;
11571157
prev_pplhdr = pplhdr;
11581158

1159-
tmp = page;
1160-
page = page2;
1161-
page2 = tmp;
1159+
swap(page, page2);
11621160

11631161
/* calculate next potential ppl offset */
11641162
for (i = 0; i < le32_to_cpu(pplhdr->entries_count); i++)

0 commit comments

Comments
 (0)