* [PATCH 2.6.5-mm4] vfs_readdir optimizations
@ 2004-04-14 19:47 Fabian Frederick
2004-04-14 20:15 ` Chris Wright
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2004-04-14 19:47 UTC (permalink / raw)
To: lkml
[-- Attachment #1: Type: text/plain, Size: 115 bytes --]
-Remove unuseful gotos
-ENOENT case on DEADDIR
PS : mm5 doesn't appear on kernel.org main page.
Regards,
Fabian
[-- Attachment #2: readdir1.diff --]
[-- Type: text/x-patch, Size: 874 bytes --]
diff -Naur orig/fs/readdir.c edited/fs/readdir.c
--- orig/fs/readdir.c 2004-04-04 05:37:06.000000000 +0200
+++ edited/fs/readdir.c 2004-04-12 17:25:36.000000000 +0200
@@ -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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 2.6.5-mm4] vfs_readdir optimizations
2004-04-14 19:47 [PATCH 2.6.5-mm4] vfs_readdir optimizations Fabian Frederick
@ 2004-04-14 20:15 ` Chris Wright
0 siblings, 0 replies; 2+ messages in thread
From: Chris Wright @ 2004-04-14 20:15 UTC (permalink / raw)
To: Fabian Frederick; +Cc: lkml
* Fabian Frederick (Fabian.Frederick@skynet.be) wrote:
> -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
--
Linux Security Modules http://lsm.immunix.org http://lsm.bkbits.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-04-14 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-04-14 19:47 [PATCH 2.6.5-mm4] vfs_readdir optimizations Fabian Frederick
2004-04-14 20:15 ` Chris Wright
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®