Commit ae05f269 authored by Trond Myklebust's avatar Trond Myklebust

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: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 2a9e1cfa
...@@ -908,21 +908,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt ...@@ -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); 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) static unsigned long nfs_read_attr_generation_counter(void)
{ {
smp_rmb(); return atomic_long_read(&nfs_attr_generation_counter);
return nfs_attr_generation_counter;
} }
unsigned long nfs_inc_attr_generation_counter(void) unsigned long nfs_inc_attr_generation_counter(void)
{ {
unsigned long ret; return atomic_long_inc_return(&nfs_attr_generation_counter);
smp_rmb();
ret = ++nfs_attr_generation_counter;
smp_wmb();
return ret;
} }
void nfs_fattr_init(struct nfs_fattr *fattr) void nfs_fattr_init(struct nfs_fattr *fattr)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment