* Re: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 15:50 [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c Kemeng Shi
@ 2023-08-28 12:00 ` Christoph Hellwig
2023-08-28 12:17 ` Kemeng Shi
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Christoph Hellwig @ 2023-08-28 12:00 UTC (permalink / raw)
To: Kemeng Shi; +Cc: viro, brauner, linux-fsdevel, linux-kernel
On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
> use helpers for calling f_op->{read,write}_iter() in read_write.c
>
Why? We really should just remove the completely pointless wrappers
instead.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 12:00 ` Christoph Hellwig
@ 2023-08-28 12:17 ` Kemeng Shi
2023-08-28 12:43 ` Matthew Wilcox
2023-08-28 12:19 ` Matthew Wilcox
2023-08-28 12:30 ` Christian Brauner
2 siblings, 1 reply; 8+ messages in thread
From: Kemeng Shi @ 2023-08-28 12:17 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: viro, brauner, linux-fsdevel, linux-kernel
on 8/28/2023 8:00 PM, Christoph Hellwig wrote:
> On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
>> use helpers for calling f_op->{read,write}_iter() in read_write.c
>>
>
> Why? We really should just remove the completely pointless wrappers
> instead.
>
This patch is intended to uniform how we call {read,write}_iter()...
Would it be good to opencode all call_{read,write}_iter. But I'm not sure
if these wrappers are really needless...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 12:00 ` Christoph Hellwig
2023-08-28 12:17 ` Kemeng Shi
@ 2023-08-28 12:19 ` Matthew Wilcox
2023-08-28 12:30 ` Christian Brauner
2 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox @ 2023-08-28 12:19 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Kemeng Shi, viro, brauner, linux-fsdevel, linux-kernel
On Mon, Aug 28, 2023 at 05:00:36AM -0700, Christoph Hellwig wrote:
> On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
> > use helpers for calling f_op->{read,write}_iter() in read_write.c
> >
>
> Why? We really should just remove the completely pointless wrappers
> instead.
Agreed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 12:00 ` Christoph Hellwig
2023-08-28 12:17 ` Kemeng Shi
2023-08-28 12:19 ` Matthew Wilcox
@ 2023-08-28 12:30 ` Christian Brauner
2023-08-28 14:09 ` Al Viro
2 siblings, 1 reply; 8+ messages in thread
From: Christian Brauner @ 2023-08-28 12:30 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Kemeng Shi, viro, linux-fsdevel, linux-kernel
On Mon, Aug 28, 2023 at 05:00:36AM -0700, Christoph Hellwig wrote:
> On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
> > use helpers for calling f_op->{read,write}_iter() in read_write.c
> >
>
> Why? We really should just remove the completely pointless wrappers
> instead.
Especially because it means you chase this helper to figure out what's
actually going on. If there was more to it then it would make sense but
not just as a pointless wrapper.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 12:17 ` Kemeng Shi
@ 2023-08-28 12:43 ` Matthew Wilcox
0 siblings, 0 replies; 8+ messages in thread
From: Matthew Wilcox @ 2023-08-28 12:43 UTC (permalink / raw)
To: Kemeng Shi
Cc: Christoph Hellwig, viro, brauner, linux-fsdevel, linux-kernel,
Miklos Szeredi
On Mon, Aug 28, 2023 at 08:17:52PM +0800, Kemeng Shi wrote:
> on 8/28/2023 8:00 PM, Christoph Hellwig wrote:
> > On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
> >> use helpers for calling f_op->{read,write}_iter() in read_write.c
> >>
> >
> > Why? We really should just remove the completely pointless wrappers
> > instead.
> >
> This patch is intended to uniform how we call {read,write}_iter()...
> Would it be good to opencode all call_{read,write}_iter. But I'm not sure
> if these wrappers are really needless...
All three, call_read_iter(), call_write_iter(), call_mmap()
should go. Miklos dumped them into the tree without any discussion
that I noticed.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 12:30 ` Christian Brauner
@ 2023-08-28 14:09 ` Al Viro
2023-08-28 14:25 ` David Laight
0 siblings, 1 reply; 8+ messages in thread
From: Al Viro @ 2023-08-28 14:09 UTC (permalink / raw)
To: Christian Brauner
Cc: Christoph Hellwig, Kemeng Shi, linux-fsdevel, linux-kernel
On Mon, Aug 28, 2023 at 02:30:42PM +0200, Christian Brauner wrote:
> On Mon, Aug 28, 2023 at 05:00:36AM -0700, Christoph Hellwig wrote:
> > On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
> > > use helpers for calling f_op->{read,write}_iter() in read_write.c
> > >
> >
> > Why? We really should just remove the completely pointless wrappers
> > instead.
>
> Especially because it means you chase this helper to figure out what's
> actually going on. If there was more to it then it would make sense but
> not just as a pointless wrapper.
It's borderline easier to grep for, but not dramatically so. call_mmap()
has a stronger argument in favour - there are several methods called
->mmap and telling one from another is hard without looking into context.
For ->{read,write}_iter() I'd prefer to get rid of the wrappers.
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
2023-08-28 14:09 ` Al Viro
@ 2023-08-28 14:25 ` David Laight
0 siblings, 0 replies; 8+ messages in thread
From: David Laight @ 2023-08-28 14:25 UTC (permalink / raw)
To: 'Al Viro', Christian Brauner
Cc: Christoph Hellwig, Kemeng Shi, linux-fsdevel, linux-kernel
From: Al Viro
> Sent: 28 August 2023 15:10
>
> On Mon, Aug 28, 2023 at 02:30:42PM +0200, Christian Brauner wrote:
> > On Mon, Aug 28, 2023 at 05:00:36AM -0700, Christoph Hellwig wrote:
> > > On Mon, Aug 28, 2023 at 11:50:56PM +0800, Kemeng Shi wrote:
> > > > use helpers for calling f_op->{read,write}_iter() in read_write.c
> > > >
> > >
> > > Why? We really should just remove the completely pointless wrappers
> > > instead.
> >
> > Especially because it means you chase this helper to figure out what's
> > actually going on. If there was more to it then it would make sense but
> > not just as a pointless wrapper.
>
> It's borderline easier to grep for, but not dramatically so. call_mmap()
> has a stronger argument in favour - there are several methods called
> ->mmap and telling one from another is hard without looking into context.
Which might be a justification for renaming some/all of the ->mmap()
do make them easier to find.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c
@ 2023-08-28 15:50 Kemeng Shi
2023-08-28 12:00 ` Christoph Hellwig
0 siblings, 1 reply; 8+ messages in thread
From: Kemeng Shi @ 2023-08-28 15:50 UTC (permalink / raw)
To: viro, brauner, linux-fsdevel, linux-kernel
use helpers for calling f_op->{read,write}_iter() in read_write.c
Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
---
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 a21ba3be7dbe..2f816f1212f4 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -425,7 +425,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, ITER_DEST, &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;
@@ -514,7 +514,7 @@ ssize_t __kernel_write_iter(struct file *file, struct iov_iter *from, loff_t *po
init_sync_kiocb(&kiocb, file);
kiocb.ki_pos = pos ? *pos : 0;
- ret = file->f_op->write_iter(&kiocb, from);
+ ret = call_write_iter(file, &kiocb, from);
if (ret > 0) {
if (pos)
*pos = kiocb.ki_pos;
--
2.30.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-08-28 14:26 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28 15:50 [PATCH] vfs: use helpers for calling f_op->{read,write}_iter() in read_write.c Kemeng Shi
2023-08-28 12:00 ` Christoph Hellwig
2023-08-28 12:17 ` Kemeng Shi
2023-08-28 12:43 ` Matthew Wilcox
2023-08-28 12:19 ` Matthew Wilcox
2023-08-28 12:30 ` Christian Brauner
2023-08-28 14:09 ` Al Viro
2023-08-28 14:25 ` David Laight
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).