From e84d65e9a9f65dac1d6ec54b1851074be47285a8 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 27 Feb 2012 18:08:46 +0100 Subject: fs: dentry use seqlock Replace the open coded seqlock with a real seqlock, so RT can handle it. Signed-off-by: Thomas Gleixner Cc: stable-rt@vger.kernel.org --- include/linux/dcache.h | 15 +++++++-------- include/linux/fs.h | 4 ++-- include/linux/fsnotify_backend.h | 6 +++--- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'include/linux') diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4eb8c80c04c6..b0802ba6e101 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h @@ -116,7 +116,7 @@ full_name_hash(const unsigned char *name, unsigned int len) struct dentry { /* RCU lookup touched fields */ unsigned int d_flags; /* protected by d_lock */ - seqcount_t d_seq; /* per dentry seqlock */ + seqlock_t d_lock; /* per dentry seqlock */ struct hlist_bl_node d_hash; /* lookup hash list */ struct dentry *d_parent; /* parent directory */ struct qstr d_name; @@ -126,7 +126,6 @@ struct dentry { /* Ref lookup also touches following */ unsigned int d_count; /* protected by d_lock */ - spinlock_t d_lock; /* per dentry lock */ const struct dentry_operations *d_op; struct super_block *d_sb; /* The root of the dentry tree */ unsigned long d_time; /* used by d_revalidate */ @@ -323,8 +322,8 @@ static inline int __d_rcu_to_refcount(struct dentry *dentry, unsigned seq) { int ret = 0; - assert_spin_locked(&dentry->d_lock); - if (!read_seqcount_retry(&dentry->d_seq, seq)) { + assert_seq_spin_locked(&dentry->d_lock); + if (!read_seqretry(&dentry->d_lock, seq)) { ret = 1; dentry->d_count++; } @@ -367,9 +366,9 @@ static inline struct dentry *dget_dlock(struct dentry *dentry) static inline struct dentry *dget(struct dentry *dentry) { if (dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dget_dlock(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } return dentry; } @@ -400,9 +399,9 @@ static inline int cant_mount(struct dentry *dentry) static inline void dont_mount(struct dentry *dentry) { - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); dentry->d_flags |= DCACHE_CANT_MOUNT; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } extern void dput(struct dentry *); diff --git a/include/linux/fs.h b/include/linux/fs.h index 10b228818b10..99fb59ceba3b 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2603,9 +2603,9 @@ static inline ino_t parent_ino(struct dentry *dentry) * Don't strictly need d_lock here? If the parent ino could change * then surely we'd have a deeper race in the caller? */ - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); res = dentry->d_parent->d_inode->i_ino; - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); return res; } diff --git a/include/linux/fsnotify_backend.h b/include/linux/fsnotify_backend.h index 91d0e0a34ef3..67cff5bfb0d8 100644 --- a/include/linux/fsnotify_backend.h +++ b/include/linux/fsnotify_backend.h @@ -329,7 +329,7 @@ static inline void __fsnotify_update_dcache_flags(struct dentry *dentry) { struct dentry *parent; - assert_spin_locked(&dentry->d_lock); + assert_seq_spin_locked(&dentry->d_lock); /* * Serialisation of setting PARENT_WATCHED on the dentries is provided @@ -353,9 +353,9 @@ static inline void __fsnotify_d_instantiate(struct dentry *dentry, struct inode if (!inode) return; - spin_lock(&dentry->d_lock); + seq_spin_lock(&dentry->d_lock); __fsnotify_update_dcache_flags(dentry); - spin_unlock(&dentry->d_lock); + seq_spin_unlock(&dentry->d_lock); } /* called from fsnotify listeners, such as fanotify or dnotify */ -- cgit v1.2.3