aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2008-07-11 19:27:31 -0400
committerTheodore Ts'o <tytso@mit.edu>2008-07-11 19:27:31 -0400
commit91d99827791fdd5f9424458ad5ae870f89dbcadf (patch)
treee31e40f37fc4173c67f6a4e1fad8f0cc69be2759 /fs/ext4
parent07d45f126712fea3a9f44068bf65e0a26a162286 (diff)
ext4: switch to seq_files
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Cc: Mingming Cao <cmm@us.ibm.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'fs/ext4')
-rw-r--r--fs/ext4/mballoc.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index bdb9f299157a..6280ad3829d4 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2583,25 +2583,24 @@ ext4_mb_free_committed_blocks(struct super_block *sb)
2583 2583
2584 2584
2585 2585
2586#define MB_PROC_VALUE_READ(name) \ 2586#define MB_PROC_FOPS(name) \
2587static int ext4_mb_read_##name(char *page, char **start, \ 2587static int ext4_mb_##name##_proc_show(struct seq_file *m, void *v) \
2588 off_t off, int count, int *eof, void *data) \
2589{ \ 2588{ \
2590 struct ext4_sb_info *sbi = data; \ 2589 struct ext4_sb_info *sbi = m->private; \
2591 int len; \ 2590 \
2592 *eof = 1; \ 2591 seq_printf(m, "%ld\n", sbi->s_mb_##name); \
2593 if (off != 0) \ 2592 return 0; \
2594 return 0; \ 2593} \
2595 len = sprintf(page, "%ld\n", sbi->s_mb_##name); \ 2594 \
2596 *start = page; \ 2595static int ext4_mb_##name##_proc_open(struct inode *inode, struct file *file)\
2597 return len; \ 2596{ \
2598} 2597 return single_open(file, ext4_mb_##name##_proc_show, PDE(inode)->data);\
2599 2598} \
2600#define MB_PROC_VALUE_WRITE(name) \ 2599 \
2601static int ext4_mb_write_##name(struct file *file, \ 2600static ssize_t ext4_mb_##name##_proc_write(struct file *file, \
2602 const char __user *buf, unsigned long cnt, void *data) \ 2601 const char __user *buf, size_t cnt, loff_t *ppos) \
2603{ \ 2602{ \
2604 struct ext4_sb_info *sbi = data; \ 2603 struct ext4_sb_info *sbi = PDE(file->f_path.dentry->d_inode)->data;\
2605 char str[32]; \ 2604 char str[32]; \
2606 long value; \ 2605 long value; \
2607 if (cnt >= sizeof(str)) \ 2606 if (cnt >= sizeof(str)) \
@@ -2613,31 +2612,32 @@ static int ext4_mb_write_##name(struct file *file, \
2613 return -ERANGE; \ 2612 return -ERANGE; \
2614 sbi->s_mb_##name = value; \ 2613 sbi->s_mb_##name = value; \
2615 return cnt; \ 2614 return cnt; \
2616} 2615} \
2616 \
2617static const struct file_operations ext4_mb_##name##_proc_fops = { \
2618 .owner = THIS_MODULE, \
2619 .open = ext4_mb_##name##_proc_open, \
2620 .read = seq_read, \
2621 .llseek = seq_lseek, \
2622 .release = single_release, \
2623 .write = ext4_mb_##name##_proc_write, \
2624};
2617 2625
2618MB_PROC_VALUE_READ(stats); 2626MB_PROC_FOPS(stats);
2619MB_PROC_VALUE_WRITE(stats); 2627MB_PROC_FOPS(max_to_scan);
2620MB_PROC_VALUE_READ(max_to_scan); 2628MB_PROC_FOPS(min_to_scan);
2621MB_PROC_VALUE_WRITE(max_to_scan); 2629MB_PROC_FOPS(order2_reqs);
2622MB_PROC_VALUE_READ(min_to_scan); 2630MB_PROC_FOPS(stream_request);
2623MB_PROC_VALUE_WRITE(min_to_scan); 2631MB_PROC_FOPS(group_prealloc);
2624MB_PROC_VALUE_READ(order2_reqs);
2625MB_PROC_VALUE_WRITE(order2_reqs);
2626MB_PROC_VALUE_READ(stream_request);
2627MB_PROC_VALUE_WRITE(stream_request);
2628MB_PROC_VALUE_READ(group_prealloc);
2629MB_PROC_VALUE_WRITE(group_prealloc);
2630 2632
2631#define MB_PROC_HANDLER(name, var) \ 2633#define MB_PROC_HANDLER(name, var) \
2632do { \ 2634do { \
2633 proc = create_proc_entry(name, mode, sbi->s_mb_proc); \ 2635 proc = proc_create_data(name, mode, sbi->s_mb_proc, \
2636 &ext4_mb_##var##_proc_fops, sbi); \
2634 if (proc == NULL) { \ 2637 if (proc == NULL) { \
2635 printk(KERN_ERR "EXT4-fs: can't to create %s\n", name); \ 2638 printk(KERN_ERR "EXT4-fs: can't to create %s\n", name); \
2636 goto err_out; \ 2639 goto err_out; \
2637 } \ 2640 } \
2638 proc->data = sbi; \
2639 proc->read_proc = ext4_mb_read_##var ; \
2640 proc->write_proc = ext4_mb_write_##var; \
2641} while (0) 2641} while (0)
2642 2642
2643static int ext4_mb_init_per_dev_proc(struct super_block *sb) 2643static int ext4_mb_init_per_dev_proc(struct super_block *sb)