From patchwork Fri May 18 00:22:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Long Li X-Patchwork-Id: 10407925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 44B94602C2 for ; Fri, 18 May 2018 00:24:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 32AF8287C7 for ; Fri, 18 May 2018 00:24:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 273DC287CB; Fri, 18 May 2018 00:24:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C73B4287C7 for ; Fri, 18 May 2018 00:24:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752318AbeERAX4 (ORCPT ); Thu, 17 May 2018 20:23:56 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:37588 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752253AbeERAXk (ORCPT ); Thu, 17 May 2018 20:23:40 -0400 Received: from linuxonhyperv2.linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id JTADftqqcF1fmJTADfRzv8; Thu, 17 May 2018 17:22:39 -0700 x-originating-ip: 107.180.71.197 Received: from longli by linuxonhyperv2.linuxonhyperv.com with local (Exim 4.91) (envelope-from ) id 1fJTAC-0001UV-U0; Thu, 17 May 2018 17:22:28 -0700 From: Long Li To: Steve French , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org, linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org Cc: Long Li Subject: [RFC PATCH 06/09] Change RDMA recv to support offset in the 1st page Date: Thu, 17 May 2018 17:22:11 -0700 Message-Id: <20180518002214.5657-7-longli@linuxonhyperv.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180518002214.5657-1-longli@linuxonhyperv.com> References: <20180518002214.5657-1-longli@linuxonhyperv.com> Reply-To: longli@microsoft.com X-CMAE-Envelope: MS4wfMG1OO6H4E/qPux5mE2gzkuJOyl8fG7HgUBzy8Ip4ecCaUYEjtuEMRbBMlsdfoeABkumMGRytaCBaxU1fgdsBA6xVjy0aI+gDOP62VEpqMwh5U2SywCM 17vvlP00zp68lM3aEt6o8FPXdNIW12MnTIfXp+VtTVSeqffj9gDUIiU2gLhsGRXUZh7u7wHvY0PvGZo+LGTxyy+KUpyfhEEW+Njh7S5cCGwdB1JMhGk+a8CI YrE29PIRfuX4FfPQdcgt9vQbW1yNHJw8VaG6VrKFPQ6s4e/SxZIfpwHMlNV0PJoPg/pCfHyJ2Pdqu6o9abh1ex42kNdzGEQ69Y3+Leo7601fMRmTdPOtmB/m fHqoMZ9FqJgi0q1dmbzTOFkZBdRx9NIkR5YrAGXZ20F+AV3iJFjmJorT4qFAzI69h3cEXy+m Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Long Li The actaul data buffer may start with an offset in the 1st page, modify RDMA recv function to read the data to the correct buffer. Signed-off-by: Long Li --- fs/cifs/smbdirect.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/fs/cifs/smbdirect.c b/fs/cifs/smbdirect.c index b46586d..939c289 100644 --- a/fs/cifs/smbdirect.c +++ b/fs/cifs/smbdirect.c @@ -1978,7 +1978,7 @@ static int smbd_recv_buf(struct smbd_connection *info, char *buf, * return value: actual data read */ static int smbd_recv_page(struct smbd_connection *info, - struct page *page, unsigned int to_read) + struct page *page, unsigned int page_offset, unsigned int to_read) { int ret; char *to_address; @@ -1989,10 +1989,10 @@ static int smbd_recv_page(struct smbd_connection *info, info->reassembly_data_length >= to_read || info->transport_status != SMBD_CONNECTED); if (ret) - return 0; + return ret; /* now we can read from reassembly queue and not sleep */ - to_address = kmap_atomic(page); + to_address = (char *) kmap_atomic(page) + page_offset; log_read(INFO, "reading from page=%p address=%p to_read=%d\n", page, to_address, to_read); @@ -2012,7 +2012,7 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg) { char *buf; struct page *page; - unsigned int to_read; + unsigned int to_read, page_offset; int rc; switch (msg->msg_iter.type) { @@ -2024,15 +2024,16 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg) case READ | ITER_BVEC: page = msg->msg_iter.bvec->bv_page; + page_offset = msg->msg_iter.bvec->bv_offset; to_read = msg->msg_iter.bvec->bv_len; - rc = smbd_recv_page(info, page, to_read); + rc = smbd_recv_page(info, page, page_offset, to_read); break; default: /* It's a bug in upper layer to get there */ cifs_dbg(VFS, "CIFS: invalid msg type %d\n", msg->msg_iter.type); - rc = -EIO; + rc = -EINVAL; } /* SMBDirect will read it all or nothing */