* [PATCH] gdth: use offset_in_page() macro
2017-04-22 1:21 [PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang
@ 2017-04-22 1:21 ` Geliang Tang
2017-04-22 1:21 ` [PATCH] net: atheros: atl1: " Geliang Tang
` (4 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Geliang Tang @ 2017-04-22 1:21 UTC (permalink / raw)
To: Achim Leubner, James E.J. Bottomley, Martin K. Petersen
Cc: Geliang Tang, linux-scsi, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/scsi/gdth.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c
index d020a13..557ce73 100644
--- a/drivers/scsi/gdth.c
+++ b/drivers/scsi/gdth.c
@@ -2648,7 +2648,7 @@ static int gdth_fill_raw_cmd(gdth_ha_str *ha, Scsi_Cmnd *scp, u8 b)
} else {
page = virt_to_page(scp->sense_buffer);
- offset = (unsigned long)scp->sense_buffer & ~PAGE_MASK;
+ offset = offset_in_page(scp->sense_buffer);
sense_paddr = pci_map_page(ha->pdev,page,offset,
16,PCI_DMA_FROMDEVICE);
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] net: atheros: atl1: use offset_in_page() macro
2017-04-22 1:21 [PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang
2017-04-22 1:21 ` [PATCH] gdth: " Geliang Tang
@ 2017-04-22 1:21 ` Geliang Tang
2017-04-24 17:58 ` David Miller
2017-04-22 1:21 ` [PATCH] serial: pch_uart: " Geliang Tang
` (3 subsequent siblings)
5 siblings, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2017-04-22 1:21 UTC (permalink / raw)
To: Jay Cliburn, Chris Snook, David S. Miller, Eric Dumazet
Cc: Geliang Tang, netdev, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/net/ethernet/atheros/atlx/atl1.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/atheros/atlx/atl1.c b/drivers/net/ethernet/atheros/atlx/atl1.c
index 022772e..83d2db2 100644
--- a/drivers/net/ethernet/atheros/atlx/atl1.c
+++ b/drivers/net/ethernet/atheros/atlx/atl1.c
@@ -1886,7 +1886,7 @@ static u16 atl1_alloc_rx_buffers(struct atl1_adapter *adapter)
buffer_info->skb = skb;
buffer_info->length = (u16) adapter->rx_buffer_len;
page = virt_to_page(skb->data);
- offset = (unsigned long)skb->data & ~PAGE_MASK;
+ offset = offset_in_page(skb->data);
buffer_info->dma = pci_map_page(pdev, page, offset,
adapter->rx_buffer_len,
PCI_DMA_FROMDEVICE);
@@ -2230,7 +2230,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
hdr_len = skb_transport_offset(skb) + tcp_hdrlen(skb);
buffer_info->length = hdr_len;
page = virt_to_page(skb->data);
- offset = (unsigned long)skb->data & ~PAGE_MASK;
+ offset = offset_in_page(skb->data);
buffer_info->dma = pci_map_page(adapter->pdev, page,
offset, hdr_len,
PCI_DMA_TODEVICE);
@@ -2254,9 +2254,8 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
data_len -= buffer_info->length;
page = virt_to_page(skb->data +
(hdr_len + i * ATL1_MAX_TX_BUF_LEN));
- offset = (unsigned long)(skb->data +
- (hdr_len + i * ATL1_MAX_TX_BUF_LEN)) &
- ~PAGE_MASK;
+ offset = offset_in_page(skb->data +
+ (hdr_len + i * ATL1_MAX_TX_BUF_LEN));
buffer_info->dma = pci_map_page(adapter->pdev,
page, offset, buffer_info->length,
PCI_DMA_TODEVICE);
@@ -2268,7 +2267,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
/* not TSO */
buffer_info->length = buf_len;
page = virt_to_page(skb->data);
- offset = (unsigned long)skb->data & ~PAGE_MASK;
+ offset = offset_in_page(skb->data);
buffer_info->dma = pci_map_page(adapter->pdev, page,
offset, buf_len, PCI_DMA_TODEVICE);
if (++next_to_use == tpd_ring->count)
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] serial: pch_uart: use offset_in_page() macro
2017-04-22 1:21 [PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang
2017-04-22 1:21 ` [PATCH] gdth: " Geliang Tang
2017-04-22 1:21 ` [PATCH] net: atheros: atl1: " Geliang Tang
@ 2017-04-22 1:21 ` Geliang Tang
2017-04-22 1:21 ` [PATCH] tty/serial: atmel: " Geliang Tang
` (2 subsequent siblings)
5 siblings, 0 replies; 16+ messages in thread
From: Geliang Tang @ 2017-04-22 1:21 UTC (permalink / raw)
To: Greg Kroah-Hartman, Jiri Slaby; +Cc: Geliang Tang, linux-serial, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/tty/serial/pch_uart.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c
index 42caccb..d3796dc 100644
--- a/drivers/tty/serial/pch_uart.c
+++ b/drivers/tty/serial/pch_uart.c
@@ -878,8 +878,7 @@ static int dma_handle_rx(struct eg20t_port *priv)
sg_dma_len(sg) = priv->trigger_level;
sg_set_page(&priv->sg_rx, virt_to_page(priv->rx_buf_virt),
- sg_dma_len(sg), (unsigned long)priv->rx_buf_virt &
- ~PAGE_MASK);
+ sg_dma_len(sg), offset_in_page(priv->rx_buf_virt));
sg_dma_address(sg) = priv->rx_buf_dma;
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] tty/serial: atmel: use offset_in_page() macro
2017-04-22 1:21 [PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang
` (2 preceding siblings ...)
2017-04-22 1:21 ` [PATCH] serial: pch_uart: " Geliang Tang
@ 2017-04-22 1:21 ` Geliang Tang
2017-04-24 7:12 ` Richard Genoud
2017-04-22 1:21 ` [PATCH] xen/scsifront: " Geliang Tang
2017-04-22 1:21 ` [PATCH] xprtrdma: " Geliang Tang
5 siblings, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2017-04-22 1:21 UTC (permalink / raw)
To: Richard Genoud, Greg Kroah-Hartman, Jiri Slaby
Cc: Geliang Tang, linux-serial, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/tty/serial/atmel_serial.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index c355ac9..f398db8 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -959,7 +959,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
sg_set_page(&atmel_port->sg_tx,
virt_to_page(port->state->xmit.buf),
UART_XMIT_SIZE,
- (unsigned long)port->state->xmit.buf & ~PAGE_MASK);
+ offset_in_page(port->state->xmit.buf));
nent = dma_map_sg(port->dev,
&atmel_port->sg_tx,
1,
@@ -1141,7 +1141,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
sg_set_page(&atmel_port->sg_rx,
virt_to_page(ring->buf),
sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE,
- (unsigned long)ring->buf & ~PAGE_MASK);
+ offset_in_page(ring->buf));
nent = dma_map_sg(port->dev,
&atmel_port->sg_rx,
1,
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] tty/serial: atmel: use offset_in_page() macro
2017-04-22 1:21 ` [PATCH] tty/serial: atmel: " Geliang Tang
@ 2017-04-24 7:12 ` Richard Genoud
2017-04-29 1:39 ` [PATCH v2] " Geliang Tang
0 siblings, 1 reply; 16+ messages in thread
From: Richard Genoud @ 2017-04-24 7:12 UTC (permalink / raw)
To: Geliang Tang; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel
On 22/04/2017 03:21, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
> drivers/tty/serial/atmel_serial.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index c355ac9..f398db8 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -959,7 +959,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
> sg_set_page(&atmel_port->sg_tx,
> virt_to_page(port->state->xmit.buf),
> UART_XMIT_SIZE,
> - (unsigned long)port->state->xmit.buf & ~PAGE_MASK);
> + offset_in_page(port->state->xmit.buf));
> nent = dma_map_sg(port->dev,
> &atmel_port->sg_tx,
> 1,
> @@ -1141,7 +1141,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
> sg_set_page(&atmel_port->sg_rx,
> virt_to_page(ring->buf),
> sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE,
> - (unsigned long)ring->buf & ~PAGE_MASK);
> + offset_in_page(ring->buf));
> nent = dma_map_sg(port->dev,
> &atmel_port->sg_rx,
> 1,
>
I guess you want to #include <linux/mm.h>
(even if it compiles ok without it)
Regards,
Richard.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH v2] tty/serial: atmel: use offset_in_page() macro
2017-04-24 7:12 ` Richard Genoud
@ 2017-04-29 1:39 ` Geliang Tang
2017-05-02 8:47 ` Richard Genoud
0 siblings, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2017-04-29 1:39 UTC (permalink / raw)
To: Richard Genoud, Greg Kroah-Hartman, Jiri Slaby
Cc: Geliang Tang, linux-serial, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
Changes in v2:
- include mm.h
---
drivers/tty/serial/atmel_serial.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index c355ac9..d25f044 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -46,6 +46,7 @@
#include <linux/err.h>
#include <linux/irq.h>
#include <linux/suspend.h>
+#include <linux/mm.h>
#include <asm/io.h>
#include <asm/ioctls.h>
@@ -959,7 +960,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
sg_set_page(&atmel_port->sg_tx,
virt_to_page(port->state->xmit.buf),
UART_XMIT_SIZE,
- (unsigned long)port->state->xmit.buf & ~PAGE_MASK);
+ offset_in_page(port->state->xmit.buf));
nent = dma_map_sg(port->dev,
&atmel_port->sg_tx,
1,
@@ -1141,7 +1142,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
sg_set_page(&atmel_port->sg_rx,
virt_to_page(ring->buf),
sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE,
- (unsigned long)ring->buf & ~PAGE_MASK);
+ offset_in_page(ring->buf));
nent = dma_map_sg(port->dev,
&atmel_port->sg_rx,
1,
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH v2] tty/serial: atmel: use offset_in_page() macro
2017-04-29 1:39 ` [PATCH v2] " Geliang Tang
@ 2017-05-02 8:47 ` Richard Genoud
0 siblings, 0 replies; 16+ messages in thread
From: Richard Genoud @ 2017-05-02 8:47 UTC (permalink / raw)
To: Geliang Tang, Greg Kroah-Hartman, Jiri Slaby; +Cc: linux-serial, linux-kernel
On 29/04/2017 03:39, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com>
> ---
> Changes in v2:
> - include mm.h
> ---
> drivers/tty/serial/atmel_serial.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
> index c355ac9..d25f044 100644
> --- a/drivers/tty/serial/atmel_serial.c
> +++ b/drivers/tty/serial/atmel_serial.c
> @@ -46,6 +46,7 @@
> #include <linux/err.h>
> #include <linux/irq.h>
> #include <linux/suspend.h>
> +#include <linux/mm.h>
>
> #include <asm/io.h>
> #include <asm/ioctls.h>
> @@ -959,7 +960,7 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
> sg_set_page(&atmel_port->sg_tx,
> virt_to_page(port->state->xmit.buf),
> UART_XMIT_SIZE,
> - (unsigned long)port->state->xmit.buf & ~PAGE_MASK);
> + offset_in_page(port->state->xmit.buf));
> nent = dma_map_sg(port->dev,
> &atmel_port->sg_tx,
> 1,
> @@ -1141,7 +1142,7 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
> sg_set_page(&atmel_port->sg_rx,
> virt_to_page(ring->buf),
> sizeof(struct atmel_uart_char) * ATMEL_SERIAL_RINGSIZE,
> - (unsigned long)ring->buf & ~PAGE_MASK);
> + offset_in_page(ring->buf));
> nent = dma_map_sg(port->dev,
> &atmel_port->sg_rx,
> 1,
>
Thanks !
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] xen/scsifront: use offset_in_page() macro
2017-04-22 1:21 [PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang
` (3 preceding siblings ...)
2017-04-22 1:21 ` [PATCH] tty/serial: atmel: " Geliang Tang
@ 2017-04-22 1:21 ` Geliang Tang
2017-04-24 5:05 ` Juergen Gross
2017-04-25 6:58 ` Juergen Gross
2017-04-22 1:21 ` [PATCH] xprtrdma: " Geliang Tang
5 siblings, 2 replies; 16+ messages in thread
From: Geliang Tang @ 2017-04-22 1:21 UTC (permalink / raw)
To: Juergen Gross, Boris Ostrovsky, James E.J. Bottomley, Martin K. Petersen
Cc: Geliang Tang, xen-devel, linux-scsi, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
drivers/scsi/xen-scsifront.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/xen-scsifront.c b/drivers/scsi/xen-scsifront.c
index 9aa1fe1..a6a8b60 100644
--- a/drivers/scsi/xen-scsifront.c
+++ b/drivers/scsi/xen-scsifront.c
@@ -434,7 +434,7 @@ static int map_data_for_request(struct vscsifrnt_info *info,
if (seg_grants) {
page = virt_to_page(seg);
- off = (unsigned long)seg & ~PAGE_MASK;
+ off = offset_in_page(seg);
len = sizeof(struct scsiif_request_segment) * data_grants;
while (len > 0) {
bytes = min_t(unsigned int, len, PAGE_SIZE - off);
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] xen/scsifront: use offset_in_page() macro
2017-04-22 1:21 ` [PATCH] xen/scsifront: " Geliang Tang
@ 2017-04-24 5:05 ` Juergen Gross
2017-04-24 22:15 ` Martin K. Petersen
2017-04-25 6:58 ` Juergen Gross
1 sibling, 1 reply; 16+ messages in thread
From: Juergen Gross @ 2017-04-24 5:05 UTC (permalink / raw)
To: Geliang Tang, Boris Ostrovsky, James E.J. Bottomley, Martin K. Petersen
Cc: xen-devel, linux-scsi, linux-kernel
On 22/04/17 03:21, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Thanks,
Juergen
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] xen/scsifront: use offset_in_page() macro
2017-04-24 5:05 ` Juergen Gross
@ 2017-04-24 22:15 ` Martin K. Petersen
2017-04-25 5:07 ` Juergen Gross
0 siblings, 1 reply; 16+ messages in thread
From: Martin K. Petersen @ 2017-04-24 22:15 UTC (permalink / raw)
To: Juergen Gross
Cc: Geliang Tang, Boris Ostrovsky, James E.J. Bottomley,
Martin K. Petersen, xen-devel, linux-scsi, linux-kernel
Juergen,
> On 22/04/17 03:21, Geliang Tang wrote:
>> Use offset_in_page() macro instead of open-coding.
>>
>> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
>
> Reviewed-by: Juergen Gross <jgross@suse.com>
Taking this through the Xen tree or should I queue it?
--
Martin K. Petersen Oracle Linux Engineering
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] xen/scsifront: use offset_in_page() macro
2017-04-24 22:15 ` Martin K. Petersen
@ 2017-04-25 5:07 ` Juergen Gross
0 siblings, 0 replies; 16+ messages in thread
From: Juergen Gross @ 2017-04-25 5:07 UTC (permalink / raw)
To: Martin K. Petersen
Cc: Geliang Tang, Boris Ostrovsky, James E.J. Bottomley, xen-devel,
linux-scsi, linux-kernel
On 25/04/17 00:15, Martin K. Petersen wrote:
>
> Juergen,
>
>> On 22/04/17 03:21, Geliang Tang wrote:
>>> Use offset_in_page() macro instead of open-coding.
>>>
>>> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
>>
>> Reviewed-by: Juergen Gross <jgross@suse.com>
>
> Taking this through the Xen tree or should I queue it?
I can take it through the Xen tree.
Thanks,
Juergen
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] xen/scsifront: use offset_in_page() macro
2017-04-22 1:21 ` [PATCH] xen/scsifront: " Geliang Tang
2017-04-24 5:05 ` Juergen Gross
@ 2017-04-25 6:58 ` Juergen Gross
1 sibling, 0 replies; 16+ messages in thread
From: Juergen Gross @ 2017-04-25 6:58 UTC (permalink / raw)
To: Geliang Tang, Boris Ostrovsky, James E.J. Bottomley, Martin K. Petersen
Cc: xen-devel, linux-scsi, linux-kernel
On 22/04/17 03:21, Geliang Tang wrote:
> Use offset_in_page() macro instead of open-coding.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Pushed to xen/tip for-linus-4.12
Thanks,
Juergen
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] xprtrdma: use offset_in_page() macro
2017-04-22 1:21 [PATCH] fs/ocfs2/cluster: use offset_in_page() macro Geliang Tang
` (4 preceding siblings ...)
2017-04-22 1:21 ` [PATCH] xen/scsifront: " Geliang Tang
@ 2017-04-22 1:21 ` Geliang Tang
2017-04-22 3:37 ` Chuck Lever
5 siblings, 1 reply; 16+ messages in thread
From: Geliang Tang @ 2017-04-22 1:21 UTC (permalink / raw)
To: J. Bruce Fields, Jeff Layton, Trond Myklebust, Anna Schumaker,
David S. Miller, Chuck Lever, Sagi Grimberg
Cc: Geliang Tang, linux-nfs, netdev, linux-kernel
Use offset_in_page() macro instead of open-coding.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++--
net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 +--
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index a044be2..429beea 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -540,7 +540,7 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req,
goto out;
page = virt_to_page(xdr->tail[0].iov_base);
- page_base = (unsigned long)xdr->tail[0].iov_base & ~PAGE_MASK;
+ page_base = offset_in_page(xdr->tail[0].iov_base);
/* If the content in the page list is an odd length,
* xdr_write_pages() has added a pad at the beginning
@@ -587,7 +587,7 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req,
*/
if (xdr->tail[0].iov_len) {
page = virt_to_page(xdr->tail[0].iov_base);
- page_base = (unsigned long)xdr->tail[0].iov_base & ~PAGE_MASK;
+ page_base = offset_in_page(xdr->tail[0].iov_base);
len = xdr->tail[0].iov_len;
map_tail:
diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
index 1736337..60b3f29 100644
--- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
+++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
@@ -306,12 +306,11 @@ static int svc_rdma_dma_map_buf(struct svcxprt_rdma *rdma,
unsigned char *base,
unsigned int len)
{
- unsigned long offset = (unsigned long)base & ~PAGE_MASK;
struct ib_device *dev = rdma->sc_cm_id->device;
dma_addr_t dma_addr;
dma_addr = ib_dma_map_page(dev, virt_to_page(base),
- offset, len, DMA_TO_DEVICE);
+ offset_in_page(base), len, DMA_TO_DEVICE);
if (ib_dma_mapping_error(dev, dma_addr))
return -EIO;
--
2.9.3
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] xprtrdma: use offset_in_page() macro
2017-04-22 1:21 ` [PATCH] xprtrdma: " Geliang Tang
@ 2017-04-22 3:37 ` Chuck Lever
0 siblings, 0 replies; 16+ messages in thread
From: Chuck Lever @ 2017-04-22 3:37 UTC (permalink / raw)
To: Geliang Tang
Cc: J. Bruce Fields, Jeff Layton, Trond Myklebust, Anna Schumaker,
David S. Miller, Sagi Grimberg, Linux NFS Mailing List, netdev,
linux-kernel
> On Apr 21, 2017, at 9:21 PM, Geliang Tang <geliangtang@gmail.com> wrote:
>
> Use offset_in_page() macro instead of open-coding.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
> net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++--
> net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 +--
> 2 files changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
> index a044be2..429beea 100644
> --- a/net/sunrpc/xprtrdma/rpc_rdma.c
> +++ b/net/sunrpc/xprtrdma/rpc_rdma.c
> @@ -540,7 +540,7 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req,
> goto out;
>
> page = virt_to_page(xdr->tail[0].iov_base);
> - page_base = (unsigned long)xdr->tail[0].iov_base & ~PAGE_MASK;
> + page_base = offset_in_page(xdr->tail[0].iov_base);
>
> /* If the content in the page list is an odd length,
> * xdr_write_pages() has added a pad at the beginning
> @@ -587,7 +587,7 @@ rpcrdma_prepare_msg_sges(struct rpcrdma_ia *ia, struct rpcrdma_req *req,
> */
> if (xdr->tail[0].iov_len) {
> page = virt_to_page(xdr->tail[0].iov_base);
> - page_base = (unsigned long)xdr->tail[0].iov_base & ~PAGE_MASK;
> + page_base = offset_in_page(xdr->tail[0].iov_base);
> len = xdr->tail[0].iov_len;
>
> map_tail:
There are several other sites that use PAGE_MASK in
rpc_rdma.c. Should those be included in this patch?
Do you have a way to test this change? If not I
can take it (once the above comment is addressed),
run it through the usual battery of NFS/RDMA
testing, and then pass it along to Anna.
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> index 1736337..60b3f29 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> @@ -306,12 +306,11 @@ static int svc_rdma_dma_map_buf(struct svcxprt_rdma *rdma,
> unsigned char *base,
> unsigned int len)
> {
> - unsigned long offset = (unsigned long)base & ~PAGE_MASK;
> struct ib_device *dev = rdma->sc_cm_id->device;
> dma_addr_t dma_addr;
>
> dma_addr = ib_dma_map_page(dev, virt_to_page(base),
> - offset, len, DMA_TO_DEVICE);
> + offset_in_page(base), len, DMA_TO_DEVICE);
> if (ib_dma_mapping_error(dev, dma_addr))
> return -EIO;
>
This hunk conflicts with a rewrite of svc_rdma_sendto.c that
Bruce has already accepted for v4.12. I would prefer this
be dropped.
The rewritten code also has this issue. I can submit a patch
separately that adds offset_in_page in the appropriate place.
--
Chuck Lever
^ permalink raw reply [flat|nested] 16+ messages in thread