vfs_readdir optimizations
PATCH 1/1 vfs_readdir optimizations
-Remove unuseful gotos-ENOENT case on DEADDIR
PS : mm5 doesn't appear on kernel.org main page.
Regards,
Fabian
fs/readdir.c +9 -14
@@ -21,21 +21,16 @@ {struct inode *inode = file->f_dentry->d_inode;int res = -ENOTDIR ; -if (!file->f_op || !file->f_op->readdir) - goto out; - - res =security_file_permission (file,MAY_READ ); -if (res) - goto out; - -down (&inode->i_sem); - res = -ENOENT ; -if (!IS_DEADDIR (inode)) { - res = file->f_op->readdir (file, buf, filler); -file_accessed (file); +if (file->f_op && file->f_op->readdir){ +if (!(res =security_file_permission (file,MAY_READ ))){ +down (&inode->i_sem); +if (!IS_DEADDIR (inode)) { + res = file->f_op->readdir (file, buf, filler); +file_accessed (file); + }else res = -ENOENT ; +up (&inode->i_sem); + } } -up (&inode->i_sem); -out:return res; }
Review
Quoted 2 lines · * Fabian Frederick ([email protected]) wrote:
(quoted diff) +0
-2-Remove unuseful gotos -ENOENT case on DEADDIR
Couple things. It's useful to generate some numbers to show an optimization is worthwhile. And code readability/maintainability is important to maintain correctness. You may look at the assembly and find that there is no real optimization with the changes you've proposed.
thanks,
-chris
Signature · 1 line
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net