[Patch] make file times work in tmpfs

From: Christoph Rohland (cr@sap.com)
Date: Wed Feb 14 2001 - 13:45:07 EST


Hi Alan,

here is a patch that makes the different file timestamps work on
tmpfs.

Greetings
                Christoph

--- mac10/mm/shmem.c.orig Wed Feb 14 14:39:46 2001
+++ mac10/mm/shmem.c Wed Feb 14 15:30:09 2001
@@ -160,6 +160,7 @@
         swp_entry_t **base, **ptr, **last;
         struct shmem_inode_info * info = &inode->u.shmem_i;
 
+ inode->i_ctime = inode->i_mtime = CURRENT_TIME;
         spin_lock (&info->lock);
         index = (inode->i_size + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT;
         if (index > info->max_index)
@@ -734,6 +735,7 @@
         struct inode * inode = shmem_get_inode(dir->i_sb, mode, dev);
         int error = -ENOSPC;
 
+ dir->i_ctime = dir->i_mtime = CURRENT_TIME;
         if (inode) {
                 d_instantiate(dentry, inode);
                 dget(dentry); /* Extra count - pin the dentry in core */
@@ -767,6 +769,7 @@
         if (S_ISDIR(inode->i_mode))
                 return -EPERM;
 
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
         inode->i_nlink++;
         atomic_inc(&inode->i_count); /* New dentry reference */
         dget(dentry); /* Extra pinning count for the created dentry */
@@ -809,7 +812,9 @@
 
 static int shmem_unlink(struct inode * dir, struct dentry *dentry)
 {
- dentry->d_inode->i_nlink--;
+ struct inode *inode = dentry->d_inode;
+ inode->i_ctime = dir->i_ctime = dir->i_mtime = CURRENT_TIME;
+ inode->i_nlink--;
         dput(dentry); /* Undo the count from "create" - this does all the work */
         return 0;
 }
@@ -836,10 +841,12 @@
         if (shmem_empty(new_dentry)) {
                 struct inode *inode = new_dentry->d_inode;
                 if (inode) {
+ inode->i_ctime = CURRENT_TIME;
                         inode->i_nlink--;
                         dput(new_dentry);
                 }
                 error = 0;
+ old_dentry->d_inode->i_ctime = old_dir->i_ctime = old_dir->i_mtime = CURRENT_TIME;
         }
         return error;
 }
@@ -873,6 +880,7 @@
         UnlockPage(page);
         page_cache_release(page);
         up(&inode->i_sem);
+ dir->i_ctime = dir->i_mtime = CURRENT_TIME;
         return 0;
 fail:
         up(&inode->i_sem);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Feb 15 2001 - 21:00:25 EST