aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.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/dir.c
parentfuse: cleanup code conditional on fc->writeback_cache (diff)
downloadlinux-dev-c15016b7ae1caf77f80ae87a71745368ef651ba6.tar.xz
linux-dev-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/dir.c')
-rw-r--r--fs/fuse/dir.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 8315ca75d657..607ff7d2fd4d 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1561,10 +1561,10 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
struct fuse_setattr_in inarg;
struct fuse_attr_out outarg;
bool is_truncate = false;
- bool is_wb = fc->writeback_cache;
+ bool is_wb = fc->writeback_cache && S_ISREG(inode->i_mode);
loff_t oldsize;
int err;
- bool trust_local_cmtime = is_wb && S_ISREG(inode->i_mode);
+ bool trust_local_cmtime = is_wb;
bool fault_blocked = false;
if (!fc->default_permissions)
@@ -1608,7 +1608,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
}
/* Flush dirty data/metadata before non-truncate SETATTR */
- if (is_wb && S_ISREG(inode->i_mode) &&
+ if (is_wb &&
attr->ia_valid &
(ATTR_MODE | ATTR_UID | ATTR_GID | ATTR_MTIME_SET |
ATTR_TIMES_SET)) {
@@ -1679,7 +1679,7 @@ int fuse_do_setattr(struct dentry *dentry, struct iattr *attr,
attr_timeout(&outarg));
oldsize = inode->i_size;
/* see the comment in fuse_change_attributes() */
- if (!is_wb || is_truncate || !S_ISREG(inode->i_mode))
+ if (!is_wb || is_truncate)
i_size_write(inode, outarg.attr.size);
if (is_truncate) {