lkml.org 
[lkml]   [1999]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectMinor optimizations in open.
I should say VERY minor optimizations, but two lines of dead code is dead
code, and a test done twice is not nice either.

If my patch is wrong, please educate me.

Éric Brunet

*** linux-2.3.11/fs/namei.c.orig Wed Jul 28 21:54:10 1999
--- linux-2.3.11/fs/namei.c Wed Jul 28 22:37:59 1999
***************
*** 685,691 ****
if (flag & O_CREAT) {
struct dentry *dir;

! if (dentry->d_inode) {
if (!(flag & O_EXCL))
goto nocreate;
error = -EEXIST;
--- 685,691 ----
if (flag & O_CREAT) {
struct dentry *dir;

! if ((inode = dentry->d_inode)) {
if (!(flag & O_EXCL))
goto nocreate;
error = -EEXIST;
***************
*** 728,739 ****
goto exit;
}

- nocreate:
error = -ENOENT;
inode = dentry->d_inode;
if (!inode)
goto exit;

error = -ELOOP;
if (S_ISLNK(inode->i_mode))
goto exit;
--- 728,739 ----
goto exit;
}

error = -ENOENT;
inode = dentry->d_inode;
if (!inode)
goto exit;

+ nocreate:
error = -ELOOP;
if (S_ISLNK(inode->i_mode))
goto exit;
***************
*** 747,752 ****
--- 747,754 ----
goto exit;

/*
+ * permission() has already tested that we are not trying to
+ * write to a regular file on a read-only filesystem.
* FIFO's, sockets and device files are special: they don't
* actually live on the filesystem itself, and as such you
* can write to them even if the filesystem is read-only.
***************
*** 759,769 ****
goto exit;

flag &= ~O_TRUNC;
- } else {
- error = -EROFS;
- if (IS_RDONLY(inode) && (flag & 2))
- goto exit;
}
/*
* An append-only file must be opened in append mode for writing.
*/
--- 761,768 ----
goto exit;

flag &= ~O_TRUNC;
}
+
/*
* An append-only file must be opened in append mode for writing.
*/

-
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.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:53    [W:0.049 / U:1.912 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site