public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: fix to use mnt_{want,drop}_write_file replace file_{start,end}_wrtie
@ 2024-06-13  9:35 Zhiguo Niu
  2024-06-18  1:01 ` Chao Yu
  2024-06-24 17:40 ` [f2fs-dev] [PATCH] f2fs: fix to use mnt_{want, drop}_write_file replace file_{start, end}_wrtie patchwork-bot+f2fs
  0 siblings, 2 replies; 3+ messages in thread
From: Zhiguo Niu @ 2024-06-13  9:35 UTC (permalink / raw)
  To: jaegeuk, chao
  Cc: linux-f2fs-devel, linux-kernel, niuzhiguo84, zhiguo.niu, ke.wang,
	Hao_hao.Wang

mnt_{want,drop}_write_file is more suitable than
file_{start,end}_wrtie and also is consistent with
other ioctl operations.

Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
---
 fs/f2fs/file.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index c50213d..e4a7cff 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -3935,7 +3935,9 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg)
 			 IS_ENCRYPTED(inode) && f2fs_is_multi_device(sbi)))
 		return -EOPNOTSUPP;
 
-	file_start_write(filp);
+	ret = mnt_want_write_file(filp);
+	if (ret)
+		return ret;
 	inode_lock(inode);
 
 	if (f2fs_is_atomic_file(inode) || f2fs_compressed_file(inode) ||
@@ -4061,7 +4063,7 @@ static int f2fs_sec_trim_file(struct file *filp, unsigned long arg)
 	f2fs_up_write(&F2FS_I(inode)->i_gc_rwsem[WRITE]);
 err:
 	inode_unlock(inode);
-	file_end_write(filp);
+	mnt_drop_write_file(filp);
 
 	return ret;
 }
@@ -4115,7 +4117,9 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
 		option.algorithm >= COMPRESS_MAX)
 		return -EINVAL;
 
-	file_start_write(filp);
+	ret = mnt_want_write_file(filp);
+	if (ret)
+		return ret;
 	inode_lock(inode);
 
 	f2fs_down_write(&F2FS_I(inode)->i_sem);
@@ -4154,7 +4158,7 @@ static int f2fs_ioc_set_compress_option(struct file *filp, unsigned long arg)
 out:
 	f2fs_up_write(&F2FS_I(inode)->i_sem);
 	inode_unlock(inode);
-	file_end_write(filp);
+	mnt_drop_write_file(filp);
 
 	return ret;
 }
@@ -4211,7 +4215,9 @@ static int f2fs_ioc_decompress_file(struct file *filp)
 
 	f2fs_balance_fs(sbi, true);
 
-	file_start_write(filp);
+	ret = mnt_want_write_file(filp);
+	if (ret)
+		return ret;
 	inode_lock(inode);
 
 	if (!f2fs_is_compress_backend_ready(inode)) {
@@ -4266,7 +4272,7 @@ static int f2fs_ioc_decompress_file(struct file *filp)
 	f2fs_update_time(sbi, REQ_TIME);
 out:
 	inode_unlock(inode);
-	file_end_write(filp);
+	mnt_drop_write_file(filp);
 
 	return ret;
 }
@@ -4288,7 +4294,9 @@ static int f2fs_ioc_compress_file(struct file *filp)
 
 	f2fs_balance_fs(sbi, true);
 
-	file_start_write(filp);
+	ret = mnt_want_write_file(filp);
+	if (ret)
+		return ret;
 	inode_lock(inode);
 
 	if (!f2fs_is_compress_backend_ready(inode)) {
@@ -4344,7 +4352,7 @@ static int f2fs_ioc_compress_file(struct file *filp)
 	f2fs_update_time(sbi, REQ_TIME);
 out:
 	inode_unlock(inode);
-	file_end_write(filp);
+	mnt_drop_write_file(filp);
 
 	return ret;
 }
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] f2fs: fix to use mnt_{want,drop}_write_file replace file_{start,end}_wrtie
  2024-06-13  9:35 [PATCH] f2fs: fix to use mnt_{want,drop}_write_file replace file_{start,end}_wrtie Zhiguo Niu
@ 2024-06-18  1:01 ` Chao Yu
  2024-06-24 17:40 ` [f2fs-dev] [PATCH] f2fs: fix to use mnt_{want, drop}_write_file replace file_{start, end}_wrtie patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2024-06-18  1:01 UTC (permalink / raw)
  To: Zhiguo Niu, jaegeuk
  Cc: linux-f2fs-devel, linux-kernel, niuzhiguo84, ke.wang,
	Hao_hao.Wang

On 2024/6/13 17:35, Zhiguo Niu wrote:
> mnt_{want,drop}_write_file is more suitable than
> file_{start,end}_wrtie and also is consistent with
> other ioctl operations.
> 
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: fix to use mnt_{want, drop}_write_file replace file_{start, end}_wrtie
  2024-06-13  9:35 [PATCH] f2fs: fix to use mnt_{want,drop}_write_file replace file_{start,end}_wrtie Zhiguo Niu
  2024-06-18  1:01 ` Chao Yu
@ 2024-06-24 17:40 ` patchwork-bot+f2fs
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2024-06-24 17:40 UTC (permalink / raw)
  To: Zhiguo Niu
  Cc: jaegeuk, chao, ke.wang, linux-kernel, linux-f2fs-devel,
	Hao_hao.Wang

Hello:

This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:

On Thu, 13 Jun 2024 17:35:33 +0800 you wrote:
> mnt_{want,drop}_write_file is more suitable than
> file_{start,end}_wrtie and also is consistent with
> other ioctl operations.
> 
> Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
> ---
>  fs/f2fs/file.c | 24 ++++++++++++++++--------
>  1 file changed, 16 insertions(+), 8 deletions(-)

Here is the summary with links:
  - [f2fs-dev] f2fs: fix to use mnt_{want, drop}_write_file replace file_{start, end}_wrtie
    https://git.kernel.org/jaegeuk/f2fs/c/1efb7c8fd8bf

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-06-24 17:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-13  9:35 [PATCH] f2fs: fix to use mnt_{want,drop}_write_file replace file_{start,end}_wrtie Zhiguo Niu
2024-06-18  1:01 ` Chao Yu
2024-06-24 17:40 ` [f2fs-dev] [PATCH] f2fs: fix to use mnt_{want, drop}_write_file replace file_{start, end}_wrtie patchwork-bot+f2fs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox