summaryrefslogtreecommitdiff
path: root/fs/fuse/file.c
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2018-11-09 13:33:17 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2019-02-13 13:15:13 +0100
commit4510d86fbbb36872224482bb21836d47cce8be8c (patch)
treed4340b770fd1f73d14c5391f407b50b00b946f2b /fs/fuse/file.c
parentebf84d0c7220c7c9b904c405e61175d2a50cfb39 (diff)
fuse: Convert fc->attr_version into atomic64_t
This patch makes fc->attr_version of atomic64_t type, so fc->lock won't be needed to read or modify it anymore. Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/file.c')
-rw-r--r--fs/fuse/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index cecd9b7e0b7f..d1becba30bf3 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -187,7 +187,7 @@ void fuse_finish_open(struct inode *inode, struct file *file)
struct fuse_inode *fi = get_fuse_inode(inode);
spin_lock(&fc->lock);
- fi->attr_version = ++fc->attr_version;
+ fi->attr_version = atomic64_inc_return(&fc->attr_version);
i_size_write(inode, 0);
spin_unlock(&fc->lock);
fuse_invalidate_attr(inode);
@@ -608,7 +608,7 @@ static void fuse_aio_complete(struct fuse_io_priv *io, int err, ssize_t pos)
struct fuse_inode *fi = get_fuse_inode(inode);
spin_lock(&fc->lock);
- fi->attr_version = ++fc->attr_version;
+ fi->attr_version = atomic64_inc_return(&fc->attr_version);
spin_unlock(&fc->lock);
}
@@ -687,7 +687,7 @@ static void fuse_read_update_size(struct inode *inode, loff_t size,
spin_lock(&fc->lock);
if (attr_ver == fi->attr_version && size < inode->i_size &&
!test_bit(FUSE_I_SIZE_UNSTABLE, &fi->state)) {
- fi->attr_version = ++fc->attr_version;
+ fi->attr_version = atomic64_inc_return(&fc->attr_version);
i_size_write(inode, size);
}
spin_unlock(&fc->lock);
@@ -1006,7 +1006,7 @@ bool fuse_write_update_size(struct inode *inode, loff_t pos)
bool ret = false;
spin_lock(&fc->lock);
- fi->attr_version = ++fc->attr_version;
+ fi->attr_version = atomic64_inc_return(&fc->attr_version);
if (pos > inode->i_size) {
i_size_write(inode, pos);
ret = true;