CIFS: SMBD: Support page offset in RDMA recv
RDMA recv function needs to place data to the correct place starting at page offset. Signed-off-by: Long Li <longli@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
b6903bcf0a
commit
6509f50cd1
|
@ -2004,10 +2004,12 @@ read_rfc1002_done:
|
||||||
* return value: actual data read
|
* return value: actual data read
|
||||||
*/
|
*/
|
||||||
static int smbd_recv_page(struct smbd_connection *info,
|
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;
|
int ret;
|
||||||
char *to_address;
|
char *to_address;
|
||||||
|
void *page_address;
|
||||||
|
|
||||||
/* make sure we have the page ready for read */
|
/* make sure we have the page ready for read */
|
||||||
ret = wait_event_interruptible(
|
ret = wait_event_interruptible(
|
||||||
|
@ -2015,16 +2017,17 @@ static int smbd_recv_page(struct smbd_connection *info,
|
||||||
info->reassembly_data_length >= to_read ||
|
info->reassembly_data_length >= to_read ||
|
||||||
info->transport_status != SMBD_CONNECTED);
|
info->transport_status != SMBD_CONNECTED);
|
||||||
if (ret)
|
if (ret)
|
||||||
return 0;
|
return ret;
|
||||||
|
|
||||||
/* now we can read from reassembly queue and not sleep */
|
/* now we can read from reassembly queue and not sleep */
|
||||||
to_address = kmap_atomic(page);
|
page_address = kmap_atomic(page);
|
||||||
|
to_address = (char *) page_address + page_offset;
|
||||||
|
|
||||||
log_read(INFO, "reading from page=%p address=%p to_read=%d\n",
|
log_read(INFO, "reading from page=%p address=%p to_read=%d\n",
|
||||||
page, to_address, to_read);
|
page, to_address, to_read);
|
||||||
|
|
||||||
ret = smbd_recv_buf(info, to_address, to_read);
|
ret = smbd_recv_buf(info, to_address, to_read);
|
||||||
kunmap_atomic(to_address);
|
kunmap_atomic(page_address);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -2038,7 +2041,7 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
|
||||||
{
|
{
|
||||||
char *buf;
|
char *buf;
|
||||||
struct page *page;
|
struct page *page;
|
||||||
unsigned int to_read;
|
unsigned int to_read, page_offset;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
info->smbd_recv_pending++;
|
info->smbd_recv_pending++;
|
||||||
|
@ -2052,15 +2055,16 @@ int smbd_recv(struct smbd_connection *info, struct msghdr *msg)
|
||||||
|
|
||||||
case READ | ITER_BVEC:
|
case READ | ITER_BVEC:
|
||||||
page = msg->msg_iter.bvec->bv_page;
|
page = msg->msg_iter.bvec->bv_page;
|
||||||
|
page_offset = msg->msg_iter.bvec->bv_offset;
|
||||||
to_read = msg->msg_iter.bvec->bv_len;
|
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;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* It's a bug in upper layer to get there */
|
/* It's a bug in upper layer to get there */
|
||||||
cifs_dbg(VFS, "CIFS: invalid msg type %d\n",
|
cifs_dbg(VFS, "CIFS: invalid msg type %d\n",
|
||||||
msg->msg_iter.type);
|
msg->msg_iter.type);
|
||||||
rc = -EIO;
|
rc = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->smbd_recv_pending--;
|
info->smbd_recv_pending--;
|
||||||
|
|
Loading…
Reference in New Issue