The patch below reduces the time while the kernel lock is held.
Regards,
Tigran.
--- linux/fs/read_write.c Fri Nov 5 17:57:30 1999
+++ work/fs/read_write.c Wed Dec 15 20:18:34 1999
@@ -39,11 +39,15 @@
static inline loff_t llseek(struct file *file, loff_t offset, int origin)
{
loff_t (*fn)(struct file *, loff_t, int);
+ loff_t retval;
fn = default_llseek;
if (file->f_op && file->f_op->llseek)
fn = file->f_op->llseek;
- return fn(file, offset, origin);
+ lock_kernel();
+ retval = fn(file, offset, origin);
+ unlock_kernel();
+ return retval;
}
asmlinkage off_t sys_lseek(unsigned int fd, off_t offset, unsigned int origin)
@@ -53,7 +57,6 @@
struct dentry * dentry;
struct inode * inode;
- lock_kernel();
retval = -EBADF;
file = fget(fd);
if (!file)
@@ -72,7 +75,6 @@
out_putf:
fput(file);
bad:
- unlock_kernel();
return retval;
}
@@ -87,7 +89,6 @@
struct inode * inode;
loff_t offset;
- lock_kernel();
retval = -EBADF;
file = fget(fd);
if (!file)
@@ -112,7 +113,6 @@
out_putf:
fput(file);
bad:
- unlock_kernel();
return retval;
}
#endif
@@ -312,8 +312,6 @@
struct file * file;
ssize_t (*read)(struct file *, char *, size_t, loff_t *);
- lock_kernel();
-
ret = -EBADF;
file = fget(fd);
if (!file)
@@ -333,7 +331,6 @@
out:
fput(file);
bad_file:
- unlock_kernel();
return ret;
}
@@ -344,8 +341,6 @@
struct file * file;
ssize_t (*write)(struct file *, const char *, size_t, loff_t *);
- lock_kernel();
-
ret = -EBADF;
file = fget(fd);
if (!file)
@@ -366,6 +361,5 @@
out:
fput(file);
bad_file:
- unlock_kernel();
return ret;
}
--- linux/fs/buffer.c Thu Dec 9 21:10:18 1999
+++ work/fs/buffer.c Wed Dec 15 20:19:51 1999
@@ -345,7 +345,6 @@
struct inode * inode;
int err;
- lock_kernel();
err = -EBADF;
file = fget(fd);
if (!file)
@@ -365,13 +364,14 @@
/* We need to protect against concurrent writers.. */
down(&inode->i_sem);
+ lock_kernel();
err = file->f_op->fsync(file, dentry);
+ unlock_kernel();
up(&inode->i_sem);
out_putf:
fput(file);
out:
- unlock_kernel();
return err;
}
-
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/