[Pvfs2-cvs] commit by harms in pvfs2/src/kernel/linux-2.6: file.c inode.c pvfs2-kernel.h pvfs2-utils.c

CVS commit program cvs at parl.clemson.edu
Wed Feb 27 18:36:18 EST 2008


Update of /projects/cvsroot/pvfs2/src/kernel/linux-2.6
In directory parlweb1:/tmp/cvs-serv20133/src/kernel/linux-2.6

Modified Files:
      Tag: pvfs-2-7-branch
	file.c inode.c pvfs2-kernel.h pvfs2-utils.c 
Log Message:
Merge the following commits from HEAD to 2-7-branch.
  MAIN:harms:20080226162915
  MAIN:slang:20080124220721
  MAIN:slang:20080208000114


Index: file.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/file.c,v
diff -p -u -r1.141.2.2 -r1.141.2.3
--- file.c	10 Dec 2007 17:20:35 -0000	1.141.2.2
+++ file.c	27 Feb 2008 23:36:17 -0000	1.141.2.3
@@ -97,7 +97,7 @@ int pvfs2_file_open(
             ret = pvfs2_inode_getattr(inode, PVFS_ATTR_SYS_SIZE);
             if (ret == 0)
             {
-                file->f_pos = i_size_read(inode);
+                file->f_pos = pvfs2_i_size_read(inode);
                 gossip_debug(GOSSIP_FILE_DEBUG, "f_pos = %ld\n", (unsigned long)file->f_pos);
             }
             else
@@ -840,7 +840,7 @@ static int locate_file_pages(struct rw_o
         gossip_lerr("invalid options\n");
         return -EINVAL;
     }
-    isize = i_size_read(rw->inode);
+    isize = pvfs2_i_size_read(rw->inode);
     rw->copy_dest_type = COPY_DEST_PAGES;
     /* start with an empty page list */
     INIT_LIST_HEAD(&rw->dest.pages.page_list);
@@ -1137,7 +1137,7 @@ static ssize_t wait_for_cached_io(struct
         return -EOPNOTSUPP;
     }
     offset = *(rw.off.io.offset);
-    isize = i_size_read(rw.inode);
+    isize = pvfs2_i_size_read(rw.inode);
     /* If our file offset was greater than file size, we should return 0 */
     if (offset >= isize) {
         return 0;
@@ -1241,9 +1241,9 @@ static ssize_t do_readv_writev(struct rw
             gossip_err("%s: Invalid file pointer\n", rw->fnstr);
             goto out;
         }
-        if (file->f_pos > i_size_read(inode))
+        if (file->f_pos > pvfs2_i_size_read(inode))
         {
-            i_size_write(inode, file->f_pos);
+            pvfs2_i_size_write(inode, file->f_pos);
         }
         /* perform generic linux kernel tests for sanity of write 
          * arguments 
@@ -3106,7 +3106,7 @@ static void do_bypass_page_cache_read(st
     begin_index = *ppos >> PAGE_CACHE_SHIFT; 
     offset = *ppos & ~PAGE_CACHE_MASK;
 
-    isize = i_size_read(inode);
+    isize = pvfs2_i_size_read(inode);
     if (!isize)
     {
         return;
@@ -3231,6 +3231,11 @@ static ssize_t pvfs2_sendfile(struct fil
 
 #endif
 
+int pvfs2_lock(struct file *f, int flags, struct file_lock *lock)
+{
+    return -ENOSYS;
+}
+
 /** PVFS2 implementation of VFS file operations */
 struct file_operations pvfs2_file_operations =
 {
@@ -3253,6 +3258,7 @@ struct file_operations pvfs2_file_operat
     /* for >= 2.6.19 */
     .aio_read = pvfs2_file_aio_read_iovec,
     .aio_write = pvfs2_file_aio_write_iovec,
+    .lock = pvfs2_lock,
 #else
     .readv = pvfs2_file_readv,
     .writev = pvfs2_file_writev,
@@ -3275,6 +3281,7 @@ struct file_operations pvfs2_file_operat
 #ifdef HAVE_WRITEX_FILE_OPERATIONS
     .writex = pvfs2_file_writex,
 #endif
+    .lock = pvfs2_lock,
 #endif
 };
 

Index: inode.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/inode.c,v
diff -p -u -r1.79 -r1.79.4.1
--- inode.c	20 Mar 2007 18:32:31 -0000	1.79
+++ inode.c	27 Feb 2008 23:36:18 -0000	1.79.4.1
@@ -160,7 +160,7 @@ struct address_space_operations pvfs2_ad
  */
 void pvfs2_truncate(struct inode *inode)
 {
-    loff_t orig_size = i_size_read(inode);
+    loff_t orig_size = pvfs2_i_size_read(inode);
 
     if (IS_APPEND(inode) || IS_IMMUTABLE(inode))
         return;
@@ -171,7 +171,7 @@ void pvfs2_truncate(struct inode *inode)
      * although the mtime updates are propagated lazily!
      */
     if (pvfs2_truncate_inode(inode, inode->i_size) == 0
-            && (orig_size != i_size_read(inode)))
+            && (orig_size != pvfs2_i_size_read(inode)))
     {
         pvfs2_inode_t *pvfs2_inode = PVFS2_I(inode);
         SetMtimeFlag(pvfs2_inode);

Index: pvfs2-kernel.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-kernel.h,v
diff -p -u -r1.145 -r1.145.2.1
--- pvfs2-kernel.h	5 Nov 2007 21:07:53 -0000	1.145
+++ pvfs2-kernel.h	27 Feb 2008 23:36:18 -0000	1.145.2.1
@@ -1248,35 +1248,32 @@ static inline int dcache_dir_close(struc
 }
 #endif /* PVFS2_LINUX_KERNEL_2_4_MINOR_VER */
 
-/* some 2.4 kernels backport a lot of stuff from 2.6, so we have to
- * feature-test instead of relying on kernel versions */
-#ifndef HAVE_I_SIZE_READ
-static inline loff_t i_size_read(struct inode *inode)
-{
-    return inode->i_size;
-}
-#endif
+#endif /* PVFS2_LINUX_KERNEL_2_4 */
 
-#ifndef HAVE_I_SIZE_WRITE
-static inline void i_size_write(struct inode *inode, loff_t i_size)
+static inline void pvfs2_i_size_write(struct inode *inode, loff_t i_size)
 {
+#ifndef HAVE_I_SIZE_WRITE
     inode->i_size = i_size;
-}
+#else
+    #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
+    mutex_lock(&inode->i_mutex);
+    #endif
+    i_size_write(inode, i_size);
+    #if BITS_PER_LONG==32 && defined(CONFIG_SMP)
+    mutex_unlock(&inode->i_mutex);
+    #endif
 #endif
+    return;
+}
 
-#ifndef HAVE_KZALLOC
-static void *kzalloc(size_t size, gfp_t mask)
+static inline loff_t pvfs2_i_size_read(struct inode *inode)
 {
-    void *ptr;
-    ptr = kmalloc(size, mask);
-    if (ptr) {
-        memset(ptr, 0, size);
-    }
-    return ptr;
-}
+#ifndef HAVE_I_SIZE_READ
+    return inode->i_size;
+#else
+    return i_size_read(inode);
 #endif
-
-#endif /* PVFS2_LINUX_KERNEL_2_4 */
+}
 
 static inline unsigned int diff(struct timeval *end, struct timeval *begin)
 {

Index: pvfs2-utils.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/kernel/linux-2.6/pvfs2-utils.c,v
diff -p -u -r1.149 -r1.149.2.1
--- pvfs2-utils.c	19 Aug 2007 18:20:28 -0000	1.149
+++ pvfs2-utils.c	27 Feb 2008 23:36:18 -0000	1.149.2.1
@@ -306,7 +306,7 @@ int copy_attributes_to_inode(
                             "attribute type %x\n", attrs->objtype);
         }
         gossip_debug(GOSSIP_UTILS_DEBUG, "pvfs2: copy_attributes_to_inode: setting i_mode to %o, i_size to %lu\n",
-                inode->i_mode, (unsigned long)i_size_read(inode));
+                inode->i_mode, (unsigned long)pvfs2_i_size_read(inode));
     }
     return ret;
 }
@@ -1773,7 +1773,7 @@ static int do_encode_opaque_handle(char 
     h.atime  = pvfs2_convert_time_field(&inode->i_atime);
     h.mtime  = pvfs2_convert_time_field(&inode->i_mtime);
     h.ctime  = pvfs2_convert_time_field(&inode->i_ctime);
-    h.size   = i_size_read(inode);
+    h.size   = pvfs2_i_size_read(inode);
     h.mask   |= PVFS_ATTR_SYS_SIZE;
     h.objtype = PVFS_TYPE_METAFILE;
     /* Serialize into the buffer */



More information about the Pvfs2-cvs mailing list