fuse: getattr cleanup
The refreshed argument isn't used by any caller, get rid of it. Use a helper for just updating the inode (no need to fill in a kstat). Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
This commit is contained in:
parent
e1c0eecba1
commit
5b97eeacbd
|
@ -923,33 +923,29 @@ static int fuse_do_getattr(struct inode *inode, struct kstat *stat,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
int fuse_update_attributes(struct inode *inode, struct kstat *stat,
|
static int fuse_update_get_attr(struct inode *inode, struct file *file,
|
||||||
struct file *file, bool *refreshed)
|
struct kstat *stat)
|
||||||
{
|
{
|
||||||
struct fuse_inode *fi = get_fuse_inode(inode);
|
struct fuse_inode *fi = get_fuse_inode(inode);
|
||||||
int err;
|
int err = 0;
|
||||||
bool r;
|
|
||||||
|
|
||||||
if (time_before64(fi->i_time, get_jiffies_64())) {
|
if (time_before64(fi->i_time, get_jiffies_64())) {
|
||||||
r = true;
|
|
||||||
forget_all_cached_acls(inode);
|
forget_all_cached_acls(inode);
|
||||||
err = fuse_do_getattr(inode, stat, file);
|
err = fuse_do_getattr(inode, stat, file);
|
||||||
} else {
|
} else if (stat) {
|
||||||
r = false;
|
generic_fillattr(inode, stat);
|
||||||
err = 0;
|
stat->mode = fi->orig_i_mode;
|
||||||
if (stat) {
|
stat->ino = fi->orig_ino;
|
||||||
generic_fillattr(inode, stat);
|
|
||||||
stat->mode = fi->orig_i_mode;
|
|
||||||
stat->ino = fi->orig_ino;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (refreshed != NULL)
|
|
||||||
*refreshed = r;
|
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int fuse_update_attributes(struct inode *inode, struct file *file)
|
||||||
|
{
|
||||||
|
return fuse_update_get_attr(inode, file, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
|
int fuse_reverse_inval_entry(struct super_block *sb, u64 parent_nodeid,
|
||||||
u64 child_nodeid, struct qstr *name)
|
u64 child_nodeid, struct qstr *name)
|
||||||
{
|
{
|
||||||
|
@ -1786,7 +1782,7 @@ static int fuse_getattr(const struct path *path, struct kstat *stat,
|
||||||
if (!fuse_allow_current_process(fc))
|
if (!fuse_allow_current_process(fc))
|
||||||
return -EACCES;
|
return -EACCES;
|
||||||
|
|
||||||
return fuse_update_attributes(inode, stat, NULL, NULL);
|
return fuse_update_get_attr(inode, NULL, stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct inode_operations fuse_dir_inode_operations = {
|
static const struct inode_operations fuse_dir_inode_operations = {
|
||||||
|
|
|
@ -926,7 +926,7 @@ static ssize_t fuse_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
||||||
if (fc->auto_inval_data ||
|
if (fc->auto_inval_data ||
|
||||||
(iocb->ki_pos + iov_iter_count(to) > i_size_read(inode))) {
|
(iocb->ki_pos + iov_iter_count(to) > i_size_read(inode))) {
|
||||||
int err;
|
int err;
|
||||||
err = fuse_update_attributes(inode, NULL, iocb->ki_filp, NULL);
|
err = fuse_update_attributes(inode, iocb->ki_filp);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -1177,7 +1177,7 @@ static ssize_t fuse_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
|
||||||
|
|
||||||
if (get_fuse_conn(inode)->writeback_cache) {
|
if (get_fuse_conn(inode)->writeback_cache) {
|
||||||
/* Update size (EOF optimization) and mode (SUID clearing) */
|
/* Update size (EOF optimization) and mode (SUID clearing) */
|
||||||
err = fuse_update_attributes(mapping->host, NULL, file, NULL);
|
err = fuse_update_attributes(mapping->host, file);
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -2308,7 +2308,7 @@ static loff_t fuse_lseek(struct file *file, loff_t offset, int whence)
|
||||||
return vfs_setpos(file, outarg.offset, inode->i_sb->s_maxbytes);
|
return vfs_setpos(file, outarg.offset, inode->i_sb->s_maxbytes);
|
||||||
|
|
||||||
fallback:
|
fallback:
|
||||||
err = fuse_update_attributes(inode, NULL, file, NULL);
|
err = fuse_update_attributes(inode, file);
|
||||||
if (!err)
|
if (!err)
|
||||||
return generic_file_llseek(file, offset, whence);
|
return generic_file_llseek(file, offset, whence);
|
||||||
else
|
else
|
||||||
|
@ -2328,7 +2328,7 @@ static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence)
|
||||||
break;
|
break;
|
||||||
case SEEK_END:
|
case SEEK_END:
|
||||||
inode_lock(inode);
|
inode_lock(inode);
|
||||||
retval = fuse_update_attributes(inode, NULL, file, NULL);
|
retval = fuse_update_attributes(inode, file);
|
||||||
if (!retval)
|
if (!retval)
|
||||||
retval = generic_file_llseek(file, offset, whence);
|
retval = generic_file_llseek(file, offset, whence);
|
||||||
inode_unlock(inode);
|
inode_unlock(inode);
|
||||||
|
|
|
@ -904,8 +904,7 @@ u64 fuse_lock_owner_id(struct fuse_conn *fc, fl_owner_t id);
|
||||||
|
|
||||||
void fuse_update_ctime(struct inode *inode);
|
void fuse_update_ctime(struct inode *inode);
|
||||||
|
|
||||||
int fuse_update_attributes(struct inode *inode, struct kstat *stat,
|
int fuse_update_attributes(struct inode *inode, struct file *file);
|
||||||
struct file *file, bool *refreshed);
|
|
||||||
|
|
||||||
void fuse_flush_writepages(struct inode *inode);
|
void fuse_flush_writepages(struct inode *inode);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue