summaryrefslogtreecommitdiffstats
path: root/fs/fuse/inode.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2021-10-22 17:03:03 +0200
committerMiklos Szeredi <mszeredi@redhat.com>2021-10-28 09:45:32 +0200
commitc15016b7ae1caf77f80ae87a71745368ef651ba6 (patch)
treeff685aea1feecd1846e292d59cb66e9559a5bedf /fs/fuse/inode.c
parentfuse: cleanup code conditional on fc->writeback_cache (diff)
downloadlinux-c15016b7ae1caf77f80ae87a71745368ef651ba6.tar.xz
linux-c15016b7ae1caf77f80ae87a71745368ef651ba6.zip
fuse: simplify local variables holding writeback cache state
There are two instances of "bool is_wb = fc->writeback_cache" where the actual use mostly involves checking "is_wb && S_ISREG(inode->i_mode)". Clean up these cases by storing the second condition in the local variable. Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse/inode.c')
-rw-r--r--fs/fuse/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 2f999d38c9b4..db33f2050f74 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -223,7 +223,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
{
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
- bool is_wb = fc->writeback_cache;
+ bool is_wb = fc->writeback_cache && S_ISREG(inode->i_mode);
loff_t oldsize;
struct timespec64 old_mtime;
@@ -243,7 +243,7 @@ void fuse_change_attributes(struct inode *inode, struct fuse_attr *attr,
* extend local i_size without keeping userspace server in sync. So,
* attr->size coming from server can be stale. We cannot trust it.
*/
- if (!is_wb || !S_ISREG(inode->i_mode))
+ if (!is_wb)
i_size_write(inode, attr->size);
spin_unlock(&fi->lock);