diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index d97a62534798..8e221a20f5d9 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -6616,16 +6616,11 @@ static void md_seq_stop(struct seq_file *seq, void *v) | |||
6616 | mddev_put(mddev); | 6616 | mddev_put(mddev); |
6617 | } | 6617 | } |
6618 | 6618 | ||
6619 | struct mdstat_info { | ||
6620 | int event; | ||
6621 | }; | ||
6622 | |||
6623 | static int md_seq_show(struct seq_file *seq, void *v) | 6619 | static int md_seq_show(struct seq_file *seq, void *v) |
6624 | { | 6620 | { |
6625 | mddev_t *mddev = v; | 6621 | mddev_t *mddev = v; |
6626 | sector_t sectors; | 6622 | sector_t sectors; |
6627 | mdk_rdev_t *rdev; | 6623 | mdk_rdev_t *rdev; |
6628 | struct mdstat_info *mi = seq->private; | ||
6629 | struct bitmap *bitmap; | 6624 | struct bitmap *bitmap; |
6630 | 6625 | ||
6631 | if (v == (void*)1) { | 6626 | if (v == (void*)1) { |
@@ -6637,7 +6632,7 @@ static int md_seq_show(struct seq_file *seq, void *v) | |||
6637 | 6632 | ||
6638 | spin_unlock(&pers_lock); | 6633 | spin_unlock(&pers_lock); |
6639 | seq_printf(seq, "\n"); | 6634 | seq_printf(seq, "\n"); |
6640 | mi->event = atomic_read(&md_event_count); | 6635 | seq->poll_event = atomic_read(&md_event_count); |
6641 | return 0; | 6636 | return 0; |
6642 | } | 6637 | } |
6643 | if (v == (void*)2) { | 6638 | if (v == (void*)2) { |
@@ -6749,26 +6744,21 @@ static const struct seq_operations md_seq_ops = { | |||
6749 | 6744 | ||
6750 | static int md_seq_open(struct inode *inode, struct file *file) | 6745 | static int md_seq_open(struct inode *inode, struct file *file) |
6751 | { | 6746 | { |
6747 | struct seq_file *seq; | ||
6752 | int error; | 6748 | int error; |
6753 | struct mdstat_info *mi = kmalloc(sizeof(*mi), GFP_KERNEL); | ||
6754 | if (mi == NULL) | ||
6755 | return -ENOMEM; | ||
6756 | 6749 | ||
6757 | error = seq_open(file, &md_seq_ops); | 6750 | error = seq_open(file, &md_seq_ops); |
6758 | if (error) | 6751 | if (error) |
6759 | kfree(mi); | 6752 | return error; |
6760 | else { | 6753 | |
6761 | struct seq_file *p = file->private_data; | 6754 | seq = file->private_data; |
6762 | p->private = mi; | 6755 | seq->poll_event = atomic_read(&md_event_count); |
6763 | mi->event = atomic_read(&md_event_count); | ||
6764 | } | ||
6765 | return error; | 6756 | return error; |
6766 | } | 6757 | } |
6767 | 6758 | ||
6768 | static unsigned int mdstat_poll(struct file *filp, poll_table *wait) | 6759 | static unsigned int mdstat_poll(struct file *filp, poll_table *wait) |
6769 | { | 6760 | { |
6770 | struct seq_file *m = filp->private_data; | 6761 | struct seq_file *seq = filp->private_data; |
6771 | struct mdstat_info *mi = m->private; | ||
6772 | int mask; | 6762 | int mask; |
6773 | 6763 | ||
6774 | poll_wait(filp, &md_event_waiters, wait); | 6764 | poll_wait(filp, &md_event_waiters, wait); |
@@ -6776,7 +6766,7 @@ static unsigned int mdstat_poll(struct file *filp, poll_table *wait) | |||
6776 | /* always allow read */ | 6766 | /* always allow read */ |
6777 | mask = POLLIN | POLLRDNORM; | 6767 | mask = POLLIN | POLLRDNORM; |
6778 | 6768 | ||
6779 | if (mi->event != atomic_read(&md_event_count)) | 6769 | if (seq->poll_event != atomic_read(&md_event_count)) |
6780 | mask |= POLLERR | POLLPRI; | 6770 | mask |= POLLERR | POLLPRI; |
6781 | return mask; | 6771 | return mask; |
6782 | } | 6772 | } |