Re: [PATCH] cifs: use discard iterator to discard unneeded network data more efficiently

Steve French
2021-02-25T19:33:50Z

The other two routines initialize in iov_iter_bvec

iov->type
iov->bvec
iov->offset
iov->count

but iov_iter_discard already does the initialization:
iov_type
iov_offset
iov_count

and then we call cifs_readv_from_socket in all 3
which sets:
iov->msg_control = NULL
iov->msg_controllen = NULL

I will set the two additional ones to null
iov->msg_name
and
iov->msg_namelen

On Thu, Feb 4, 2021 at 4:29 AM Aurélien Aptel <aaptel@suse.com> wrote:
>
> Steve French <smfrench@gmail.com> writes:
> > +ssize_t
> > +cifs_discard_from_socket(struct TCP_Server_Info *server, size_t to_read)
> > +{
> > + struct msghdr smb_msg;
> > +
> > + iov_iter_discard(&smb_msg.msg_iter, READ, to_read);
> > +
> > + return cifs_readv_from_socket(server, &smb_msg);
> > +}
> > +
>
> Shouldn't smb_msg be initialized to zeroes? Looking around this needs to
> be done for cifs_read_from_socket() and cifs_read_page_from_socket() too.
>
> Cheers,
> --
> Aurélien Aptel / SUSE Labs Samba Team
> GPG: 1839 CB5F 9F5B FB9B AA97 8C99 03C8 A49B 521B D5D3
> SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg, DE
> GF: Felix Imendörffer, Mary Higgins, Sri Rasiah HRB 247165 (AG München)
>

--
Thanks,

Steve