Commit df8781b5 authored by Alexander Viro's avatar Alexander Viro Committed by David S. Miller

[PATCH] add touch_atime() helper

Preparation for per-mountpoint noatime, nodiratime and later -
per-mountpoint r/o.  Depends on file_accessed() patch, should go after
it.

New helper - touch_atime(mnt, dentry).  It's a wrapper for
update_atime() and that's where all future per-mountpoint checks will
go.
parent 5f9861a6
...@@ -412,7 +412,7 @@ static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd) ...@@ -412,7 +412,7 @@ static inline int do_follow_link(struct dentry *dentry, struct nameidata *nd)
goto loop; goto loop;
current->link_count++; current->link_count++;
current->total_link_count++; current->total_link_count++;
update_atime(dentry->d_inode); touch_atime(nd->mnt, dentry);
err = dentry->d_inode->i_op->follow_link(dentry, nd); err = dentry->d_inode->i_op->follow_link(dentry, nd);
current->link_count--; current->link_count--;
return err; return err;
...@@ -1368,7 +1368,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd) ...@@ -1368,7 +1368,7 @@ int open_namei(const char * pathname, int flag, int mode, struct nameidata *nd)
error = security_inode_follow_link(dentry, nd); error = security_inode_follow_link(dentry, nd);
if (error) if (error)
goto exit_dput; goto exit_dput;
update_atime(dentry->d_inode); touch_atime(nd->mnt, dentry);
error = dentry->d_inode->i_op->follow_link(dentry, nd); error = dentry->d_inode->i_op->follow_link(dentry, nd);
dput(dentry); dput(dentry);
if (error) if (error)
......
...@@ -1143,7 +1143,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp) ...@@ -1143,7 +1143,7 @@ nfsd_readlink(struct svc_rqst *rqstp, struct svc_fh *fhp, char *buf, int *lenp)
if (!inode->i_op || !inode->i_op->readlink) if (!inode->i_op || !inode->i_op->readlink)
goto out; goto out;
update_atime(inode); touch_atime(fhp->fh_export->ex_mnt, dentry);
/* N.B. Why does this call need a get_fs()?? /* N.B. Why does this call need a get_fs()??
* Remove the set_fs and watch the fireworks:-) --okir * Remove the set_fs and watch the fireworks:-) --okir
*/ */
......
...@@ -272,7 +272,7 @@ asmlinkage long sys_readlink(const char __user * path, char __user * buf, int bu ...@@ -272,7 +272,7 @@ asmlinkage long sys_readlink(const char __user * path, char __user * buf, int bu
if (inode->i_op && inode->i_op->readlink) { if (inode->i_op && inode->i_op->readlink) {
error = security_inode_readlink(nd.dentry); error = security_inode_readlink(nd.dentry);
if (!error) { if (!error) {
update_atime(inode); touch_atime(nd.mnt, nd.dentry);
error = inode->i_op->readlink(nd.dentry, buf, bufsiz); error = inode->i_op->readlink(nd.dentry, buf, bufsiz);
} }
} }
......
...@@ -914,9 +914,15 @@ static inline void mark_inode_dirty_sync(struct inode *inode) ...@@ -914,9 +914,15 @@ static inline void mark_inode_dirty_sync(struct inode *inode)
__mark_inode_dirty(inode, I_DIRTY_SYNC); __mark_inode_dirty(inode, I_DIRTY_SYNC);
} }
static inline void touch_atime(struct vfsmount *mnt, struct dentry *dentry)
{
/* per-mountpoint checks will go here */
update_atime(dentry->d_inode);
}
static inline void file_accessed(struct file *file) static inline void file_accessed(struct file *file)
{ {
update_atime(file->f_dentry->d_inode); touch_atime(file->f_vfsmnt, file->f_dentry);
} }
......
...@@ -691,7 +691,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len, ...@@ -691,7 +691,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len,
goto put_fail; goto put_fail;
if (u->sk_type == type) if (u->sk_type == type)
update_atime(nd.dentry->d_inode); touch_atime(nd.mnt, nd.dentry);
path_release(&nd); path_release(&nd);
...@@ -707,7 +707,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len, ...@@ -707,7 +707,7 @@ static struct sock *unix_find_other(struct sockaddr_un *sunname, int len,
struct dentry *dentry; struct dentry *dentry;
dentry = unix_sk(u)->dentry; dentry = unix_sk(u)->dentry;
if (dentry) if (dentry)
update_atime(dentry->d_inode); touch_atime(unix_sk(u)->mnt, dentry);
} else } else
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment