linux/fs/open.c:sys_open() & filename zero copy patch

Ingo Molnar (mingo@pc5829.hil.siemens.at)
Sun, 1 Dec 1996 12:30:06 +0100 (MET)


we currently do getname() to copy the pathname from user-space to
kernel-space. Is this necessary?

I'm now running a kernel with the following patch, that uses the
user-space pointer. [the patch is against vanilla 2.1.13]

the open("temptemp",rw) benchmark went down from 39 usecs to 30 usecs,
mainly due to the __get_free_page() & free() we are not doing now. [on a
100 MHz Neptun]

-- mingo

ps. there are some other places where we use getname() ...
ps2. is it really this easy? :)

--- linux/fs/.open.c.original Sun Dec 1 12:20:02 1996
+++ linux/fs/open.c Sun Dec 1 12:21:18 1996
@@ -573,19 +573,14 @@

asmlinkage int sys_open(const char * filename,int flags,int mode)
{
- char * tmp;
int fd, error;

fd = get_unused_fd();
if (fd < 0)
return fd;
- error = getname(filename, &tmp);
- if (!error) {
- error = do_open(tmp,flags,mode, fd);
- putname(tmp);
- if (!error)
- return fd;
- }
+ error = do_open(filename,flags,mode, fd);
+ if (!error)
+ return fd;
put_unused_fd(fd);
return error;
}