mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
autofs4: use helper functions for expiring list
Define some simple helper functions for adding and deleting entries on the expiring dentry list. Signed-off-by: Ian Kent <raven@themaw.net> Cc: Sage Weil <sage@newdream.net> Cc: Al Viro <viro@ZenIV.linux.org.uk> Cc: Andreas Dilger <adilger@sun.com> Cc: Christoph Hellwig <hch@infradead.org> Cc: Yehuda Saheh <yehuda@newdream.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
4f8427d190
commit
c4cd70b3e3
2 changed files with 29 additions and 12 deletions
|
@ -266,5 +266,31 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void autofs4_add_expiring(struct dentry *dentry)
|
||||||
|
{
|
||||||
|
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
|
||||||
|
struct autofs_info *ino = autofs4_dentry_ino(dentry);
|
||||||
|
if (ino) {
|
||||||
|
spin_lock(&sbi->lookup_lock);
|
||||||
|
if (list_empty(&ino->expiring))
|
||||||
|
list_add(&ino->expiring, &sbi->expiring_list);
|
||||||
|
spin_unlock(&sbi->lookup_lock);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void autofs4_del_expiring(struct dentry *dentry)
|
||||||
|
{
|
||||||
|
struct autofs_sb_info *sbi = autofs4_sbi(dentry->d_sb);
|
||||||
|
struct autofs_info *ino = autofs4_dentry_ino(dentry);
|
||||||
|
if (ino) {
|
||||||
|
spin_lock(&sbi->lookup_lock);
|
||||||
|
if (!list_empty(&ino->expiring))
|
||||||
|
list_del_init(&ino->expiring);
|
||||||
|
spin_unlock(&sbi->lookup_lock);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
void autofs4_dentry_release(struct dentry *);
|
void autofs4_dentry_release(struct dentry *);
|
||||||
extern void autofs4_kill_sb(struct super_block *);
|
extern void autofs4_kill_sb(struct super_block *);
|
||||||
|
|
|
@ -563,10 +563,7 @@ static struct dentry *autofs4_lookup(struct inode *dir, struct dentry *dentry, s
|
||||||
*/
|
*/
|
||||||
ino = autofs4_dentry_ino(expiring);
|
ino = autofs4_dentry_ino(expiring);
|
||||||
autofs4_expire_wait(expiring);
|
autofs4_expire_wait(expiring);
|
||||||
spin_lock(&sbi->lookup_lock);
|
autofs4_del_expiring(expiring);
|
||||||
if (!list_empty(&ino->expiring))
|
|
||||||
list_del_init(&ino->expiring);
|
|
||||||
spin_unlock(&sbi->lookup_lock);
|
|
||||||
dput(expiring);
|
dput(expiring);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,10 +729,7 @@ static int autofs4_dir_unlink(struct inode *dir, struct dentry *dentry)
|
||||||
dir->i_mtime = CURRENT_TIME;
|
dir->i_mtime = CURRENT_TIME;
|
||||||
|
|
||||||
spin_lock(&dcache_lock);
|
spin_lock(&dcache_lock);
|
||||||
spin_lock(&sbi->lookup_lock);
|
autofs4_add_expiring(dentry);
|
||||||
if (list_empty(&ino->expiring))
|
|
||||||
list_add(&ino->expiring, &sbi->expiring_list);
|
|
||||||
spin_unlock(&sbi->lookup_lock);
|
|
||||||
spin_lock(&dentry->d_lock);
|
spin_lock(&dentry->d_lock);
|
||||||
__d_drop(dentry);
|
__d_drop(dentry);
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
|
@ -761,10 +755,7 @@ static int autofs4_dir_rmdir(struct inode *dir, struct dentry *dentry)
|
||||||
spin_unlock(&dcache_lock);
|
spin_unlock(&dcache_lock);
|
||||||
return -ENOTEMPTY;
|
return -ENOTEMPTY;
|
||||||
}
|
}
|
||||||
spin_lock(&sbi->lookup_lock);
|
autofs4_add_expiring(dentry);
|
||||||
if (list_empty(&ino->expiring))
|
|
||||||
list_add(&ino->expiring, &sbi->expiring_list);
|
|
||||||
spin_unlock(&sbi->lookup_lock);
|
|
||||||
spin_lock(&dentry->d_lock);
|
spin_lock(&dentry->d_lock);
|
||||||
__d_drop(dentry);
|
__d_drop(dentry);
|
||||||
spin_unlock(&dentry->d_lock);
|
spin_unlock(&dentry->d_lock);
|
||||||
|
|
Loading…
Reference in a new issue