From 27ae449ba26eb6c1cd217fa28339841c55bc79e1 Mon Sep 17 00:00:00 2001
From: Miklos Szeredi <mszeredi@redhat.com>
Date: Fri, 22 Oct 2021 17:03:02 +0200
Subject: [PATCH] fuse: rename fuse_write_update_size()

This function already updates the attr_version in fuse_inode, regardless of
whether the size was changed or not.

Rename the helper to fuse_write_update_attr() to reflect the more generic
nature.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
---
 fs/fuse/dax.c    |  2 +-
 fs/fuse/dev.c    |  2 +-
 fs/fuse/file.c   | 12 ++++++------
 fs/fuse/fuse_i.h |  2 +-
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fs/fuse/dax.c b/fs/fuse/dax.c
index 89bf96f4fb101..a73bae6497b05 100644
--- a/fs/fuse/dax.c
+++ b/fs/fuse/dax.c
@@ -736,7 +736,7 @@ static ssize_t fuse_dax_direct_write(struct kiocb *iocb, struct iov_iter *from)
 		return ret;
 
 	fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
-	fuse_write_update_size(inode, iocb->ki_pos);
+	fuse_write_update_attr(inode, iocb->ki_pos);
 	return ret;
 }
 
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 491c092d427bf..75ae30d568eaf 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1591,7 +1591,7 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size,
 	end = outarg.offset + outarg.size;
 	if (end > file_size) {
 		file_size = end;
-		fuse_write_update_size(inode, file_size);
+		fuse_write_update_attr(inode, file_size);
 	}
 
 	num = outarg.size;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index c09ab835821a2..b5f37b8df0e05 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1066,7 +1066,7 @@ static ssize_t fuse_send_write(struct fuse_io_args *ia, loff_t pos,
 	return err ?: ia->write.out.size;
 }
 
-bool fuse_write_update_size(struct inode *inode, loff_t pos)
+bool fuse_write_update_attr(struct inode *inode, loff_t pos)
 {
 	struct fuse_conn *fc = get_fuse_conn(inode);
 	struct fuse_inode *fi = get_fuse_inode(inode);
@@ -1263,7 +1263,7 @@ static ssize_t fuse_perform_write(struct kiocb *iocb,
 	} while (!err && iov_iter_count(ii));
 
 	if (res > 0)
-		fuse_write_update_size(inode, pos);
+		fuse_write_update_attr(inode, pos);
 
 	clear_bit(FUSE_I_SIZE_UNSTABLE, &fi->state);
 	fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
@@ -1558,7 +1558,7 @@ static ssize_t fuse_direct_write_iter(struct kiocb *iocb, struct iov_iter *from)
 	}
 	fuse_invalidate_attr_mask(inode, FUSE_STATX_MODSIZE);
 	if (res > 0)
-		fuse_write_update_size(inode, iocb->ki_pos);
+		fuse_write_update_attr(inode, iocb->ki_pos);
 	inode_unlock(inode);
 
 	return res;
@@ -2901,7 +2901,7 @@ fuse_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
 
 	if (iov_iter_rw(iter) == WRITE) {
 		if (ret > 0)
-			fuse_write_update_size(inode, pos);
+			fuse_write_update_attr(inode, pos);
 		else if (ret < 0 && offset + count > i_size)
 			fuse_do_truncate(file);
 	}
@@ -2990,7 +2990,7 @@ static long fuse_file_fallocate(struct file *file, int mode, loff_t offset,
 
 	/* we could have extended the file */
 	if (!(mode & FALLOC_FL_KEEP_SIZE)) {
-		bool changed = fuse_write_update_size(inode, offset + length);
+		bool changed = fuse_write_update_attr(inode, offset + length);
 
 		if (changed && fm->fc->writeback_cache)
 			file_update_time(file);
@@ -3108,7 +3108,7 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,
 				   ALIGN(pos_out + outarg.size, PAGE_SIZE) - 1);
 
 	if (fc->writeback_cache) {
-		fuse_write_update_size(inode_out, pos_out + outarg.size);
+		fuse_write_update_attr(inode_out, pos_out + outarg.size);
 		file_update_time(file_out);
 	}
 
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index 4f2f658fe5f16..7f5847a48b4ba 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1217,7 +1217,7 @@ long fuse_ioctl_common(struct file *file, unsigned int cmd,
 __poll_t fuse_file_poll(struct file *file, poll_table *wait);
 int fuse_dev_release(struct inode *inode, struct file *file);
 
-bool fuse_write_update_size(struct inode *inode, loff_t pos);
+bool fuse_write_update_attr(struct inode *inode, loff_t pos);
 
 int fuse_flush_times(struct inode *inode, struct fuse_file *ff);
 int fuse_write_inode(struct inode *inode, struct writeback_control *wbc);