[patch] fs: remove local variable copy of f_pos to enable thread-safe updates

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Matti Linnanvuori <mattilinnanvuori@xxxxxxxxx>

Remove local variable copy of f_pos to enable thread-safe updates in
implementation functions of system calls read, readv, write and writev.

Signed-off-by: Matti Linnanvuori <mattilinnanvuori@xxxxxxxxx>

---

--- linux-next/fs/fs-read_write.c    2008-05-02 11:54:04.715996700 +0300
+++ linux-2.6/fs/fs-read_write.c    2008-05-02 11:57:17.011641000 +0300
@@ -348,16 +348,6 @@ ssize_t vfs_write(struct file *file, con
 
 EXPORT_SYMBOL(vfs_write);
 
-static inline loff_t file_pos_read(struct file *file)
-{
-    return file->f_pos;
-}
-
-static inline void file_pos_write(struct file *file, loff_t pos)
-{
-    file->f_pos = pos;
-}
-
 asmlinkage ssize_t sys_read(unsigned int fd, char __user * buf, size_t count)
 {
     struct file *file;
@@ -366,10 +356,8 @@ asmlinkage ssize_t sys_read(unsigned int
 
     file = fget_light(fd, &fput_needed);
     if (file) {
-        loff_t pos = file_pos_read(file);
         trace_mark(fs_read, "fd %u count %zu", fd, count);
-        ret = vfs_read(file, buf, count, &pos);
-        file_pos_write(file, pos);
+        ret = vfs_read(file, buf, count, &file->f_pos);
         fput_light(file, fput_needed);
     }
 
@@ -384,10 +372,8 @@ asmlinkage ssize_t sys_write(unsigned in
 
     file = fget_light(fd, &fput_needed);
     if (file) {
-        loff_t pos = file_pos_read(file);
         trace_mark(fs_write, "fd %u count %zu", fd, count);
-        ret = vfs_write(file, buf, count, &pos);
-        file_pos_write(file, pos);
+        ret = vfs_write(file, buf, count, &file->f_pos);
         fput_light(file, fput_needed);
     }
 
@@ -679,10 +665,8 @@ sys_readv(unsigned long fd, const struct
 
     file = fget_light(fd, &fput_needed);
     if (file) {
-        loff_t pos = file_pos_read(file);
         trace_mark(fs_readv, "fd %lu vlen %lu", fd, vlen);
-        ret = vfs_readv(file, vec, vlen, &pos);
-        file_pos_write(file, pos);
+        ret = vfs_readv(file, vec, vlen, &file->f_pos);
         fput_light(file, fput_needed);
     }
 
@@ -701,10 +685,8 @@ sys_writev(unsigned long fd, const struc
 
     file = fget_light(fd, &fput_needed);
     if (file) {
-        loff_t pos = file_pos_read(file);
         trace_mark(fs_writev, "fd %lu vlen %lu", fd, vlen);
-        ret = vfs_writev(file, vec, vlen, &pos);
-        file_pos_write(file, pos);
+        ret = vfs_writev(file, vec, vlen, &file->f_pos);
         fput_light(file, fput_needed);
     }


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux