diff options
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index d537d29e9b7b..1b8c33907242 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -14,7 +14,7 @@ | |||
14 | #include <linux/vmalloc.h> | 14 | #include <linux/vmalloc.h> |
15 | #include <linux/pagemap.h> | 15 | #include <linux/pagemap.h> |
16 | #include <linux/namei.h> | 16 | #include <linux/namei.h> |
17 | #include <linux/shm.h> | 17 | #include <linux/shmem_fs.h> |
18 | #include <linux/blkdev.h> | 18 | #include <linux/blkdev.h> |
19 | #include <linux/random.h> | 19 | #include <linux/random.h> |
20 | #include <linux/writeback.h> | 20 | #include <linux/writeback.h> |
@@ -1681,19 +1681,14 @@ out: | |||
1681 | } | 1681 | } |
1682 | 1682 | ||
1683 | #ifdef CONFIG_PROC_FS | 1683 | #ifdef CONFIG_PROC_FS |
1684 | struct proc_swaps { | ||
1685 | struct seq_file seq; | ||
1686 | int event; | ||
1687 | }; | ||
1688 | |||
1689 | static unsigned swaps_poll(struct file *file, poll_table *wait) | 1684 | static unsigned swaps_poll(struct file *file, poll_table *wait) |
1690 | { | 1685 | { |
1691 | struct proc_swaps *s = file->private_data; | 1686 | struct seq_file *seq = file->private_data; |
1692 | 1687 | ||
1693 | poll_wait(file, &proc_poll_wait, wait); | 1688 | poll_wait(file, &proc_poll_wait, wait); |
1694 | 1689 | ||
1695 | if (s->event != atomic_read(&proc_poll_event)) { | 1690 | if (seq->poll_event != atomic_read(&proc_poll_event)) { |
1696 | s->event = atomic_read(&proc_poll_event); | 1691 | seq->poll_event = atomic_read(&proc_poll_event); |
1697 | return POLLIN | POLLRDNORM | POLLERR | POLLPRI; | 1692 | return POLLIN | POLLRDNORM | POLLERR | POLLPRI; |
1698 | } | 1693 | } |
1699 | 1694 | ||
@@ -1783,24 +1778,16 @@ static const struct seq_operations swaps_op = { | |||
1783 | 1778 | ||
1784 | static int swaps_open(struct inode *inode, struct file *file) | 1779 | static int swaps_open(struct inode *inode, struct file *file) |
1785 | { | 1780 | { |
1786 | struct proc_swaps *s; | 1781 | struct seq_file *seq; |
1787 | int ret; | 1782 | int ret; |
1788 | 1783 | ||
1789 | s = kmalloc(sizeof(struct proc_swaps), GFP_KERNEL); | ||
1790 | if (!s) | ||
1791 | return -ENOMEM; | ||
1792 | |||
1793 | file->private_data = s; | ||
1794 | |||
1795 | ret = seq_open(file, &swaps_op); | 1784 | ret = seq_open(file, &swaps_op); |
1796 | if (ret) { | 1785 | if (ret) |
1797 | kfree(s); | ||
1798 | return ret; | 1786 | return ret; |
1799 | } | ||
1800 | 1787 | ||
1801 | s->seq.private = s; | 1788 | seq = file->private_data; |
1802 | s->event = atomic_read(&proc_poll_event); | 1789 | seq->poll_event = atomic_read(&proc_poll_event); |
1803 | return ret; | 1790 | return 0; |
1804 | } | 1791 | } |
1805 | 1792 | ||
1806 | static const struct file_operations proc_swaps_operations = { | 1793 | static const struct file_operations proc_swaps_operations = { |