scalability of ext2
DESCRIPTION
SCALABILITY OF EXT2. Yancan Huang, Guoliang Jin May 13, 2008. Motivation. Graph for create. Motivation. Graph for open. Motivation. Same method, different graphs: Code for create: asmlinkage long sys_creat(const char __user * pathname, int mode) { return sys_open(pathname, - PowerPoint PPT PresentationTRANSCRIPT
SCALABILITY OF EXT2
Yancan Huang, Guoliang Jin
May 13, 2008
MOTIVATION Graph for create
MOTIVATION Graph for open
MOTIVATION
Same method, different graphs: Code for create:asmlinkage long sys_creat(const char __user * pathname,
int mode){
return sys_open(pathname, O_CREAT | O_WRONLY | O_TRUNC,
mode);}
Code for open:sys_open(pathname, O_RDWR);
Why? Create: where does the time go?
OVERVIEW
Motivation What is scalability of file system Experiment environment
Setup Techniques Benchmark
Create: where does the time go The file create process What does ext2_lookup do What dose ext2_create do The file open process
Conclusion & Future work
WHAT IS SCALABILITY OF FILE SYSTEM
Large File Systems
Large, Sparse Files
Large, Contiguous Files
Large Directories
Large Numbers of Files
EXPERIMENT ENVIRONMENT
Setup: UML Mount our own ext2 file system called ext2k With 1GB empty virtual disk
Measuring techniques gettimeofday long long c; __asm__ __volatile__ (“rdtsc” : “=A” (c));
Output techniques printk write to log on host
Benchmark Sequential create and open on a 1GB disk
OVERVIEW
Motivation What is scalability of file system Experiment environment
Setup Techniques Benchmark
Create: where does the time go The file create process What does ext2_lookup do What dose ext2_create do The file open process
Conclusion & Future work
CREATE: WHERE DOES THE TIME GO
asmlinkage long sys_creat(const char __user * pathname, int mode)
{return sys_open(pathname,
O_CREAT | O_WRONLY | O_TRUNC, mode);
}
THE FILE CREATE PROCESS
The process of sys_opensys_open { // fs/open.c
do_sys_open { // fs/open.cgetnameget_unused_fd_flagsdo_filp_open { // fs/open.c
open_namei // fs/namei.cinameidata_to_filp
}fsnotify_openfd_installputname
}prevent_tail_call
}
THE FILE CREATE PROCESS When open_namei meets file create
open_namei {……path_lookup_createlookup_hashopen_namei_create if (! error)
return 0;……
}
45%54%
THE FILE CREATE PROCESS The process of lookup_hash
lookup_hash {permission__lookup_hash {cached_lookup // always fail for create
struct dentry *new = d_allocdentry = inode->i_op->lookup if (!dentry) // always true for
createdentry = new
return dentry
}
}
THE FILE CREATE PROCESS The process of open_namei_create
open_namei_create {vfs_create {
may_createsecurity_inode_createdir->i_op->create // dir is an
inodefsnotify_create
}may_open
}
WE ARE NOW IN EXT2
Thanks to inode->i_op->lookup Thanks to inode->i_op->create
Going to ext2_lookup Going to ext2_create
WHAT DOES EXT2_LOOKUP DO
The process of ext2_lookupext2_lookup {
ext2_inode_by_name {ext2_find_entry {
……
}}igetd_splice_alias
}
WHAT DOES EXT2_FIND_ENTRY DO
The process of ext2_find_entryext2_find_entry {
do {ext2_get_pageext2_last_byte
while () {ext2_matchext2_next_entry
}} while ()
}
NOW WHERE WE ARE When open_namei meets file create
open_namei {……path_lookup_createlookup_hashopen_namei_create if (! error)
return 0;……
}
WHAT DOES EXT2_CREATE DO The process of ext2_create
ext2_create {ext2_new_inodemark_inode_dirtyext2_add_nondir {
ext2_add_linkd_instantiate
}
}
WHAT DOES EXT2_ADD_LINK DO The process of ext2_add_link
ext2_add_link {for () {
ext2_get_pageext2_last_bytewhile () {
ext2_matchext2_rec_len_from_disk
}} __ext2_write_beginext2_commit_chunk
}
HOW OFTEN THESE WHILE LOOP EXECUTED
REVISIT THE CREATE GRAPH
THE FILE OPEN PROCESS
The process of sys_opensys_open { // fs/open.c
do_sys_open { // fs/open.cgetnameget_unused_fd_flagsdo_filp_open { // fs/open.c
open_namei // fs/namei.cinameidata_to_filp
}fsnotify_openfd_installputname
}prevent_tail_call
}
THE FILE OPEN PROCESS When open_namei meets file open
open_namei {……if (!(flag & O_CREAT)) {
error = path_lookup_open(dfd, pathname, lookup_flags(flag), nd, flag);
if (error)return error;
goto ok;} ……
}
THE FILE OPEN PROCESS The process of path_lookup_open
path_lookup_open {__path_lookup_intent_open {
get_empty_filpdo_path_lookup {
path_walk {
link_path_walk {……
}}
}}
}
THE FILE OPEN PROCESS The process of link_path_walk
link_path_walk {__link_path_open // in the dcacheif (fail) { // force real lookup
requestsdgetmntgrt__link_path_open
}
}
REVISIT THE OPEN GRAPH
OVERVIEW Motivation What is scalability of file system Experiment environment
Setup Techniques Benchmark
Create: where does the time go The file create process What does ext2_lookup do What dose ext2_create do The file open process
Conclusion & Future work
CONCLUSION
In create, ext2_lookup makes sure there won’t be two files with the same name, and ext2_add_link performs a similar routine again
The dentry structure of ext2 is linear Using B-tree to manage this in memory structure
would show better performance
Another scalability issue in ext2 is that its inode number is determined when the disk is formatted
FUTURE WORK
Try to use B-tree to manage the dentry structure and test the performance But the B-tree itself is complex
Try more workload
QUESTIONS?