From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ua0-f193.google.com ([209.85.217.193]:37421 "EHLO mail-ua0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932888AbeCGBB6 (ORCPT ); Tue, 6 Mar 2018 20:01:58 -0500 Received: by mail-ua0-f193.google.com with SMTP id q12so367832uae.4 for ; Tue, 06 Mar 2018 17:01:58 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <5429c6b6d6147d05da33c66c4c59dbcd52f945ee.1520348028.git.sowmini.varadhan@oracle.com> References: <5429c6b6d6147d05da33c66c4c59dbcd52f945ee.1520348028.git.sowmini.varadhan@oracle.com> From: Willem de Bruijn Date: Tue, 6 Mar 2018 20:01:17 -0500 Message-ID: Subject: Re: [PATCH net-next 1/2] rds: refactor zcopy code into rds_message_zcopy_from_user To: Sowmini Varadhan Cc: Network Development , David Miller , Santosh Shilimkar Content-Type: text/plain; charset="UTF-8" Sender: netdev-owner@vger.kernel.org List-ID: On Tue, Mar 6, 2018 at 10:22 AM, Sowmini Varadhan wrote: > Move the large block of code predicated on zcopy from > rds_message_copy_from_user into a new function, > rds_message_zcopy_from_user() > > Signed-off-by: Sowmini Varadhan Acked-by: Willem de Bruijn > +int rds_message_copy_from_user(struct rds_message *rm, struct iov_iter *from, > + bool zcopy) > +{ > + unsigned long to_copy, nbytes; > + unsigned long sg_off; > + struct scatterlist *sg; > + int ret = 0; > + > + rm->m_inc.i_hdr.h_len = cpu_to_be32(iov_iter_count(from)); > + > + /* now allocate and copy in the data payload. */ > + sg = rm->data.op_sg; > + sg_off = 0; /* Dear gcc, sg->page will be null from kzalloc. */ The above lines appear both here and in rds_message_zcopy_from_user. Not strictly necessary, but not buggy, so no need to revise just for that.