aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs/inode.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-28 15:21:40 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-10-28 15:21:40 -0400
commitae05f269400533cbb32bfba131ab528d78dffd16 (patch)
treeff18dae710bf73c32b77953222b994a36afbe8e8 /fs/nfs/inode.c
parent2a9e1cfa23fb62da37739af81127dab5af095d99 (diff)
NFS: Convert nfs_attr_generation_counter into an atomic_long
The most important property we need from nfs_attr_generation_counter is monotonicity, which is not guaranteed by the current system of smp memory barriers. We should convert it to an atomic_long_t, and drop the memory barriers. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r--fs/nfs/inode.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index dc52793ff8f..d22eb383e1c 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -908,21 +908,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt
return nfs_size_to_loff_t(fattr->size) > i_size_read(inode);
}
-static unsigned long nfs_attr_generation_counter;
+static atomic_long_t nfs_attr_generation_counter;
static unsigned long nfs_read_attr_generation_counter(void)
{
- smp_rmb();
- return nfs_attr_generation_counter;
+ return atomic_long_read(&nfs_attr_generation_counter);
}
unsigned long nfs_inc_attr_generation_counter(void)
{
- unsigned long ret;
- smp_rmb();
- ret = ++nfs_attr_generation_counter;
- smp_wmb();
- return ret;
+ return atomic_long_inc_return(&nfs_attr_generation_counter);
}
void nfs_fattr_init(struct nfs_fattr *fattr)