public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [Patch] make file times work in tmpfs
@ 2001-02-14 18:45 Christoph Rohland
  0 siblings, 0 replies; only message in thread
From: Christoph Rohland @ 2001-02-14 18:45 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel, Andreas J. Koenig

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);


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2001-02-14 18:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-14 18:45 [Patch] make file times work in tmpfs Christoph Rohland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox