Potentially. I've thought about it on and off, but it's painful to add the
entries to every single driver, and the win has never been very big.
Also note that many of the current NULL checks (not the ones for the fops
thing, but for other things) are superfluous: we check for NULL not
because we need to, but often because it's just an almost automatic thing
for me.
For example, there is sometimes code essentially like this (see
sys_lseek(), for example)
struct dentry * dentry;
struct inode * inode;
struct file * filp = fget(fd);
if (!filp)
return -EBADF;
dentry = filp->f_dentry;
if (!dentry)
return -EBADF;
inode = dentry->d_inode;
if (!inode)
return -BADF;
and the only check that needs to be done is really the filp one: if you
get a filp that is active, then the dentry and inode had better be there,
because it would be a major error (worthy of a kernel oops) if they
weren't, so checking for dentry/inode being non-NULL is unnecessary, but
often done simply because I and others have been anal about it.
Personally, I would suggest against changing all the file and inode
operations unless somebody can show cases where it makes a real-world
difference in performance..
Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html