aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/nfs_fs.h
diff options
context:
space:
mode:
authorChuck Lever <cel@citi.umich.edu>2005-08-18 14:24:11 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-18 15:53:56 -0400
commit412d582ec1dd59aab2353f8cb7e74f2c79cd20b9 (patch)
tree9088c5e29cbd4b33e907a7b5f9a950dd0dce36c1 /include/linux/nfs_fs.h
parent5529680981807b44abf3be30fb6d612ff04f68ff (diff)
[PATCH] NFS: use atomic bitops to manipulate flags in nfsi->flags
Introduce atomic bitops to manipulate the bits in the nfs_inode structure's "flags" field. Using bitops means we can use a generic wait_on_bit call instead of an ad hoc locking scheme in fs/nfs/inode.c, so we can remove the "nfs_i_wait" field from nfs_inode at the same time. The other new flags field will continue to use bitmask and logic AND and OR. This permits several flags to be set at the same time efficiently. The following patch adds a spin lock to protect these flags, and this spin lock will later cover other fields in the nfs_inode structure, amortizing the cost of using this type of serialization. Test plan: Millions of fsx ops on SMP clients. Signed-off-by: Chuck Lever <cel@netapp.com> Cc: Trond Myklebust <trond.myklebust@fys.uio.no> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/nfs_fs.h')
-rw-r--r--include/linux/nfs_fs.h19
1 files changed, 8 insertions, 11 deletions
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index 229a1755842a..deef9567788a 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -112,8 +112,8 @@ struct nfs_inode {
112 /* 112 /*
113 * Various flags 113 * Various flags
114 */ 114 */
115 unsigned int flags; 115 unsigned long flags; /* atomic bit ops */
116 unsigned long cache_validity; 116 unsigned long cache_validity; /* bit mask */
117 117
118 /* 118 /*
119 * read_cache_jiffies is when we started read-caching this inode, 119 * read_cache_jiffies is when we started read-caching this inode,
@@ -175,8 +175,6 @@ struct nfs_inode {
175 /* Open contexts for shared mmap writes */ 175 /* Open contexts for shared mmap writes */
176 struct list_head open_files; 176 struct list_head open_files;
177 177
178 wait_queue_head_t nfs_i_wait;
179
180#ifdef CONFIG_NFS_V4 178#ifdef CONFIG_NFS_V4
181 struct nfs4_cached_acl *nfs4_acl; 179 struct nfs4_cached_acl *nfs4_acl;
182 /* NFSv4 state */ 180 /* NFSv4 state */
@@ -199,11 +197,11 @@ struct nfs_inode {
199#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ 197#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
200 198
201/* 199/*
202 * Legal values of flags field 200 * Bit offsets in flags field
203 */ 201 */
204#define NFS_INO_REVALIDATING 0x0001 /* revalidating attrs */ 202#define NFS_INO_REVALIDATING (0) /* revalidating attrs */
205#define NFS_INO_ADVISE_RDPLUS 0x0002 /* advise readdirplus */ 203#define NFS_INO_ADVISE_RDPLUS (1) /* advise readdirplus */
206#define NFS_INO_STALE 0x0004 /* possible stale inode */ 204#define NFS_INO_STALE (2) /* possible stale inode */
207 205
208static inline struct nfs_inode *NFS_I(struct inode *inode) 206static inline struct nfs_inode *NFS_I(struct inode *inode)
209{ 207{
@@ -229,8 +227,7 @@ static inline struct nfs_inode *NFS_I(struct inode *inode)
229#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp) 227#define NFS_ATTRTIMEO_UPDATE(inode) (NFS_I(inode)->attrtimeo_timestamp)
230 228
231#define NFS_FLAGS(inode) (NFS_I(inode)->flags) 229#define NFS_FLAGS(inode) (NFS_I(inode)->flags)
232#define NFS_REVALIDATING(inode) (NFS_FLAGS(inode) & NFS_INO_REVALIDATING) 230#define NFS_STALE(inode) (test_bit(NFS_INO_STALE, &NFS_FLAGS(inode)))
233#define NFS_STALE(inode) (NFS_FLAGS(inode) & NFS_INO_STALE)
234 231
235#define NFS_FILEID(inode) (NFS_I(inode)->fileid) 232#define NFS_FILEID(inode) (NFS_I(inode)->fileid)
236 233
@@ -252,7 +249,7 @@ static inline int nfs_server_capable(struct inode *inode, int cap)
252 249
253static inline int NFS_USE_READDIRPLUS(struct inode *inode) 250static inline int NFS_USE_READDIRPLUS(struct inode *inode)
254{ 251{
255 return NFS_FLAGS(inode) & NFS_INO_ADVISE_RDPLUS; 252 return test_bit(NFS_INO_ADVISE_RDPLUS, &NFS_FLAGS(inode));
256} 253}
257 254
258/** 255/**