Re: [PATCH] fs: use call_read_iter(file, &kiocb, &iter); for __kernel_{read|write}

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 18, 2022 at 08:19:11PM -0700, Li Chen wrote:
> From: Li Chen <lchen@xxxxxxxxxxxxx>
> 
> Just use these helper functions to replace f_op->{read,write}_iter()

... why?  You've saved a massive two bytes of kernel source.
What is the point of these functions?  I'd rather just get rid of them.

> Signed-off-by: Li Chen <lchen@xxxxxxxxxxxxx>
> ---
>  fs/read_write.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/read_write.c b/fs/read_write.c
> index b1b1cdfee9d3..9518aeca0273 100644
> --- a/fs/read_write.c
> +++ b/fs/read_write.c
> @@ -437,7 +437,7 @@ ssize_t __kernel_read(struct file *file, void *buf, size_t count, loff_t *pos)
>  	init_sync_kiocb(&kiocb, file);
>  	kiocb.ki_pos = pos ? *pos : 0;
>  	iov_iter_kvec(&iter, READ, &iov, 1, iov.iov_len);
> -	ret = file->f_op->read_iter(&kiocb, &iter);
> +	ret = call_read_iter(file, &kiocb, &iter);
>  	if (ret > 0) {
>  		if (pos)
>  			*pos = kiocb.ki_pos;
> @@ -533,7 +533,7 @@ ssize_t __kernel_write(struct file *file, const void *buf, size_t count, loff_t
>  	init_sync_kiocb(&kiocb, file);
>  	kiocb.ki_pos = pos ? *pos : 0;
>  	iov_iter_kvec(&iter, WRITE, &iov, 1, iov.iov_len);
> -	ret = file->f_op->write_iter(&kiocb, &iter);
> +	ret = call_write_iter(file, &kiocb, &iter);
>  	if (ret > 0) {
>  		if (pos)
>  			*pos = kiocb.ki_pos;
> -- 
> 2.36.1
> 
> 



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux