提交 9cf6f4b3 编写于 作者: C Christoph Hellwig 提交者: Linus Torvalds

[PATCH] switch autofs4 to touch_atime()

After my lookup_hash patch ->d_revalidate always gets a valid struct nameidata
passed (unless you use lookup_one_len which autofs4 doesn't), so we can switch
it from update_atime to touch_atime.  This is a bit of an academic excercise
because autofs has a 1:1 vfsmount superblock relation, but I want to get rid
of update_atime so filesystems authors can't easily screw up per-mountpoint
noatime support.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Cc: Ian Kent <raven@themaw.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 870f4817
...@@ -86,7 +86,7 @@ static int autofs4_root_readdir(struct file *file, void *dirent, ...@@ -86,7 +86,7 @@ static int autofs4_root_readdir(struct file *file, void *dirent,
/* Update usage from here to top of tree, so that scan of /* Update usage from here to top of tree, so that scan of
top-level directories will give a useful result */ top-level directories will give a useful result */
static void autofs4_update_usage(struct dentry *dentry) static void autofs4_update_usage(struct vfsmount *mnt, struct dentry *dentry)
{ {
struct dentry *top = dentry->d_sb->s_root; struct dentry *top = dentry->d_sb->s_root;
...@@ -95,7 +95,7 @@ static void autofs4_update_usage(struct dentry *dentry) ...@@ -95,7 +95,7 @@ static void autofs4_update_usage(struct dentry *dentry)
struct autofs_info *ino = autofs4_dentry_ino(dentry); struct autofs_info *ino = autofs4_dentry_ino(dentry);
if (ino) { if (ino) {
update_atime(dentry->d_inode); touch_atime(mnt, dentry);
ino->last_used = jiffies; ino->last_used = jiffies;
} }
} }
...@@ -289,10 +289,10 @@ static int autofs4_dir_readdir(struct file *file, void *dirent, filldir_t filldi ...@@ -289,10 +289,10 @@ static int autofs4_dir_readdir(struct file *file, void *dirent, filldir_t filldi
return autofs4_dcache_readdir(file, dirent, filldir); return autofs4_dcache_readdir(file, dirent, filldir);
} }
static int try_to_fill_dentry(struct dentry *dentry, static int try_to_fill_dentry(struct vfsmount *mnt, struct dentry *dentry, int flags)
struct super_block *sb,
struct autofs_sb_info *sbi, int flags)
{ {
struct super_block *sb = mnt->mnt_sb;
struct autofs_sb_info *sbi = autofs4_sbi(sb);
struct autofs_info *de_info = autofs4_dentry_ino(dentry); struct autofs_info *de_info = autofs4_dentry_ino(dentry);
int status = 0; int status = 0;
...@@ -367,7 +367,7 @@ static int try_to_fill_dentry(struct dentry *dentry, ...@@ -367,7 +367,7 @@ static int try_to_fill_dentry(struct dentry *dentry,
/* We don't update the usages for the autofs daemon itself, this /* We don't update the usages for the autofs daemon itself, this
is necessary for recursive autofs mounts */ is necessary for recursive autofs mounts */
if (!autofs4_oz_mode(sbi)) if (!autofs4_oz_mode(sbi))
autofs4_update_usage(dentry); autofs4_update_usage(mnt, dentry);
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; dentry->d_flags &= ~DCACHE_AUTOFS_PENDING;
...@@ -392,7 +392,7 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd) ...@@ -392,7 +392,7 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
/* Pending dentry */ /* Pending dentry */
if (autofs4_ispending(dentry)) { if (autofs4_ispending(dentry)) {
if (!oz_mode) if (!oz_mode)
status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); status = try_to_fill_dentry(nd->mnt, dentry, flags);
return status; return status;
} }
...@@ -409,14 +409,14 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd) ...@@ -409,14 +409,14 @@ static int autofs4_revalidate(struct dentry * dentry, struct nameidata *nd)
dentry, dentry->d_name.len, dentry->d_name.name); dentry, dentry->d_name.len, dentry->d_name.name);
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
if (!oz_mode) if (!oz_mode)
status = try_to_fill_dentry(dentry, dir->i_sb, sbi, flags); status = try_to_fill_dentry(nd->mnt, dentry, flags);
return status; return status;
} }
spin_unlock(&dcache_lock); spin_unlock(&dcache_lock);
/* Update the usage list */ /* Update the usage list */
if (!oz_mode) if (!oz_mode)
autofs4_update_usage(dentry); autofs4_update_usage(nd->mnt, dentry);
return 1; return 1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册