Download presentation
Presentation is loading. Please wait.
Published byBuddy Hines Modified over 9 years ago
1
Statistic Module Shuanglong Zhang 04/23/2013
2
Overview Device Mapper procfs bio control
3
Device Mapper A mechanism from linux 2.6 The base of LVM, RAID dm-linear dm-statistic
6
Can be infinite iteration Don't do this!
7
My implementation dm-statistic
8
procfs Used to "communicate" with user space /proc/statistic /proc/jiffies A drawback of procfs
9
Drawback Can not exceed one page size How to deal with large data seq_file
10
seq_file interface Deal with large data, work with procfs Abstract those data to a mount of items –(array, list, hash) Simplify the read operation
11
static struct seq_operations seq_ops = {.start = statistic_seq_start,.next = statistic_seq_next,.stop = statistic_seq_stop,.show = statistic_seq_show }; start->show->next->show->...->next->show->stop
12
static struct file_operations seq_fops = {.owner= THIS_MODULE,.open= statistic_open,.read= seq_read, //.write= seq_write,.llseek= seq_lseek,.release= seq_release, };
13
static int statistic_open(struct inode *inode, struct file *file) { return (seq_open(file, &seq_ops)); }
14
Control on bio Diffrent ways to do it –These kind of control can happen at any stage from a request begins to it ends. - VFS - FS - DM - BLOCK
15
In device mapper A bio comes in Map the bio to the dest –delay it if necessary(read, full) –until there is another room for a bio Go into block layer
16
Delay Create another list for write bio Track back to x bios or 1 second Wait till there is less then x bios in past second controled by a module parameter
17
User space tool dmsetup statistic
18
dmsetup dmsetup [linear/stripe/statistic] /dev/sda10 dmsetup remove /dev/mapper/statistic use sudo!
19
statistic Get the statistic info from /proc/statistic Two ways of querying –last x second –from x second to y second Total, Read, Write
20
Left Problems module parameter ioctl function(reset base_time) more info on bio
21
Demo
22
Q & A
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.