Commit c8300953 authored by Jens Axboe's avatar Jens Axboe

Merge tag 'md-6.8-20240109' of...

Merge tag 'md-6.8-20240109' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.8/block

Pull MD fixes from Song:

"1. Sparse warning since v6.0, by Bart;
 2. /proc/mdstat regression since v6.7, by Yu Kuai."

* tag 'md-6.8-20240109' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md:
  md/raid1: Use blk_opf_t for read and write operations
  md: Fix md_seq_ops() regressions
parents 53889bca 7dab2455
...@@ -8135,6 +8135,19 @@ static void status_unused(struct seq_file *seq) ...@@ -8135,6 +8135,19 @@ static void status_unused(struct seq_file *seq)
seq_printf(seq, "\n"); seq_printf(seq, "\n");
} }
static void status_personalities(struct seq_file *seq)
{
struct md_personality *pers;
seq_puts(seq, "Personalities : ");
spin_lock(&pers_lock);
list_for_each_entry(pers, &pers_list, list)
seq_printf(seq, "[%s] ", pers->name);
spin_unlock(&pers_lock);
seq_puts(seq, "\n");
}
static int status_resync(struct seq_file *seq, struct mddev *mddev) static int status_resync(struct seq_file *seq, struct mddev *mddev)
{ {
sector_t max_sectors, resync, res; sector_t max_sectors, resync, res;
...@@ -8276,20 +8289,10 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev) ...@@ -8276,20 +8289,10 @@ static int status_resync(struct seq_file *seq, struct mddev *mddev)
static void *md_seq_start(struct seq_file *seq, loff_t *pos) static void *md_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(&all_mddevs_lock) __acquires(&all_mddevs_lock)
{ {
struct md_personality *pers;
seq_puts(seq, "Personalities : ");
spin_lock(&pers_lock);
list_for_each_entry(pers, &pers_list, list)
seq_printf(seq, "[%s] ", pers->name);
spin_unlock(&pers_lock);
seq_puts(seq, "\n");
seq->poll_event = atomic_read(&md_event_count); seq->poll_event = atomic_read(&md_event_count);
spin_lock(&all_mddevs_lock); spin_lock(&all_mddevs_lock);
return seq_list_start(&all_mddevs, *pos); return seq_list_start_head(&all_mddevs, *pos);
} }
static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
...@@ -8300,16 +8303,23 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -8300,16 +8303,23 @@ static void *md_seq_next(struct seq_file *seq, void *v, loff_t *pos)
static void md_seq_stop(struct seq_file *seq, void *v) static void md_seq_stop(struct seq_file *seq, void *v)
__releases(&all_mddevs_lock) __releases(&all_mddevs_lock)
{ {
status_unused(seq);
spin_unlock(&all_mddevs_lock); spin_unlock(&all_mddevs_lock);
} }
static int md_seq_show(struct seq_file *seq, void *v) static int md_seq_show(struct seq_file *seq, void *v)
{ {
struct mddev *mddev = list_entry(v, struct mddev, all_mddevs); struct mddev *mddev;
sector_t sectors; sector_t sectors;
struct md_rdev *rdev; struct md_rdev *rdev;
if (v == &all_mddevs) {
status_personalities(seq);
if (list_empty(&all_mddevs))
status_unused(seq);
return 0;
}
mddev = list_entry(v, struct mddev, all_mddevs);
if (!mddev_get(mddev)) if (!mddev_get(mddev))
return 0; return 0;
...@@ -8385,6 +8395,10 @@ static int md_seq_show(struct seq_file *seq, void *v) ...@@ -8385,6 +8395,10 @@ static int md_seq_show(struct seq_file *seq, void *v)
} }
spin_unlock(&mddev->lock); spin_unlock(&mddev->lock);
spin_lock(&all_mddevs_lock); spin_lock(&all_mddevs_lock);
if (mddev == list_last_entry(&all_mddevs, struct mddev, all_mddevs))
status_unused(seq);
if (atomic_dec_and_test(&mddev->active)) if (atomic_dec_and_test(&mddev->active))
__mddev_put(mddev); __mddev_put(mddev);
......
...@@ -1968,12 +1968,12 @@ static void end_sync_write(struct bio *bio) ...@@ -1968,12 +1968,12 @@ static void end_sync_write(struct bio *bio)
} }
static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector, static int r1_sync_page_io(struct md_rdev *rdev, sector_t sector,
int sectors, struct page *page, int rw) int sectors, struct page *page, blk_opf_t rw)
{ {
if (sync_page_io(rdev, sector, sectors << 9, page, rw, false)) if (sync_page_io(rdev, sector, sectors << 9, page, rw, false))
/* success */ /* success */
return 1; return 1;
if (rw == WRITE) { if (rw == REQ_OP_WRITE) {
set_bit(WriteErrorSeen, &rdev->flags); set_bit(WriteErrorSeen, &rdev->flags);
if (!test_and_set_bit(WantReplacement, if (!test_and_set_bit(WantReplacement,
&rdev->flags)) &rdev->flags))
...@@ -2090,7 +2090,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) ...@@ -2090,7 +2090,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
rdev = conf->mirrors[d].rdev; rdev = conf->mirrors[d].rdev;
if (r1_sync_page_io(rdev, sect, s, if (r1_sync_page_io(rdev, sect, s,
pages[idx], pages[idx],
WRITE) == 0) { REQ_OP_WRITE) == 0) {
r1_bio->bios[d]->bi_end_io = NULL; r1_bio->bios[d]->bi_end_io = NULL;
rdev_dec_pending(rdev, mddev); rdev_dec_pending(rdev, mddev);
} }
...@@ -2105,7 +2105,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio) ...@@ -2105,7 +2105,7 @@ static int fix_sync_read_error(struct r1bio *r1_bio)
rdev = conf->mirrors[d].rdev; rdev = conf->mirrors[d].rdev;
if (r1_sync_page_io(rdev, sect, s, if (r1_sync_page_io(rdev, sect, s,
pages[idx], pages[idx],
READ) != 0) REQ_OP_READ) != 0)
atomic_add(s, &rdev->corrected_errors); atomic_add(s, &rdev->corrected_errors);
} }
sectors -= s; sectors -= s;
...@@ -2321,7 +2321,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio) ...@@ -2321,7 +2321,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio)
!test_bit(Faulty, &rdev->flags)) { !test_bit(Faulty, &rdev->flags)) {
atomic_inc(&rdev->nr_pending); atomic_inc(&rdev->nr_pending);
r1_sync_page_io(rdev, sect, s, r1_sync_page_io(rdev, sect, s,
conf->tmppage, WRITE); conf->tmppage, REQ_OP_WRITE);
rdev_dec_pending(rdev, mddev); rdev_dec_pending(rdev, mddev);
} }
} }
...@@ -2335,7 +2335,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio) ...@@ -2335,7 +2335,7 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio)
!test_bit(Faulty, &rdev->flags)) { !test_bit(Faulty, &rdev->flags)) {
atomic_inc(&rdev->nr_pending); atomic_inc(&rdev->nr_pending);
if (r1_sync_page_io(rdev, sect, s, if (r1_sync_page_io(rdev, sect, s,
conf->tmppage, READ)) { conf->tmppage, REQ_OP_READ)) {
atomic_add(s, &rdev->corrected_errors); atomic_add(s, &rdev->corrected_errors);
pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %pg)\n", pr_info("md/raid1:%s: read error corrected (%d sectors at %llu on %pg)\n",
mdname(mddev), s, mdname(mddev), s,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment