fs/ocfs2/cluster: use offset_in_page() macro
Subsystems (12)
PATCH 1/1 fs/ocfs2/cluster: use offset_in_page() macro
Use offset_in_page() macro instead of open-coding.
--- fs/ocfs2/cluster/tcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/cluster/tcp.c +1 -1
@@ -955,7 +955,7 @@ static void o2net_sendpage(struct o2net_sock_container *sc,mutex_lock (&sc->sc_send_lock); ret = sc->sc_sock->ops->sendpage (sc->sc_sock,virt_to_page (kmalloced_virt), - (long )kmalloced_virt & ~PAGE_MASK , +offset_in_page (kmalloced_virt), size,MSG_DONTWAIT );mutex_unlock (&sc->sc_send_lock);if (ret == size)
Signature · 1 line
2.9.3
PATCH 1/1 gdth: use offset_in_page() macro
Use offset_in_page() macro instead of open-coding.
--- drivers/scsi/gdth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/gdth.c +1 -1
@@ -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 );
Signature · 1 line
2.9.3
PATCH 1/1 net: atheros: atl1: use offset_in_page() macro
In reply to Geliang TangUse offset_in_page() macro instead of open-coding.
--- drivers/net/ethernet/atheros/atlx/atl1.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
drivers/net/ethernet/atheros/atlx/atl1.c +5 -6
@@ -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)
Signature · 1 line
2.9.3
Re: [PATCH] net: atheros: atl1: use offset_in_page() macro
From: Geliang Tang <[email protected]>
Date: Sat, 22 Apr 2017 09:21:10 +0800
Quoted 3 lines
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>
Applied, thanks.
PATCH 1/1 serial: pch_uart: use offset_in_page() macro
In reply to Geliang TangUse offset_in_page() macro instead of open-coding.
--- drivers/tty/serial/pch_uart.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/tty/serial/pch_uart.c +1 -2
@@ -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;
Signature · 1 line
2.9.3
PATCH 1/1 tty/serial: atmel: use offset_in_page() macro
In reply to Geliang TangUse offset_in_page() macro instead of open-coding.
--- drivers/tty/serial/atmel_serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/atmel_serial.c +2 -2
@@ -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,
Signature · 1 line
2.9.3
Re: [PATCH] tty/serial: atmel: use offset_in_page() macro
Quoted 22 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>--- drivers/tty/serial/atmel_serial.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/tty/serial/atmel_serial.c +1
-1@@ -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,
drivers/tty/serial/atmel_serial.c static int atmel_prepare_rx_dma(struct uart_port *port) · line 1147
Quoted 8 lines
drivers/tty/serial/atmel_serial.c +1
-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.
PATCH v2 1/1 tty/serial: atmel: use offset_in_page() macro
Use offset_in_page() macro instead of open-coding.
---
Changes in v2:
- include mm.h
--- drivers/tty/serial/atmel_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/tty/serial/atmel_serial.c +3 -2
@@ -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,
Signature · 1 line
2.9.3
Re: [PATCH v2] tty/serial: atmel: use offset_in_page() macro
Quoted 3 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>
Quoted 30 lines
---
Changes in v2:
- includemm.h--- drivers/tty/serial/atmel_serial.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/tty/serial/atmel_serial.c +2
-1@@ -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,
drivers/tty/serial/atmel_serial.c static int atmel_prepare_rx_dma(struct uart_port *port) · line 1148
Quoted 8 lines
drivers/tty/serial/atmel_serial.c +1
-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 !
PATCH 1/1 xen/scsifront: use offset_in_page() macro
In reply to Geliang TangUse offset_in_page() macro instead of open-coding.
--- drivers/scsi/xen-scsifront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/xen-scsifront.c +1 -1
@@ -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);
Signature · 1 line
2.9.3
Re: [PATCH] xen/scsifront: use offset_in_page() macro
Quoted 3 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>
Thanks,
Juergen
Re: [PATCH] xen/scsifront: use offset_in_page() macro
Juergen,
Quoted 6 lines · Geliang Tang
Quoted 3 lines
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Taking this through the Xen tree or should I queue it?
Signature · 6 lines
Martin K. Petersen Oracle Linux Engineering _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Re: [PATCH] xen/scsifront: use offset_in_page() macro
In reply to Juergen GrossJuergen,
Quoted 6 lines · Geliang Tang
Quoted 3 lines
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>Reviewed-by Juergen Gross <[email protected]>
Taking this through the Xen tree or should I queue it?
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Juergen Gross
maintainerRe: [PATCH] xen/scsifront: use offset_in_page() macro
Quoted 11 lines · Martin K. Petersen
Juergen,
Quoted 6 lines · Geliang Tang
Quoted 3 lines
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>Reviewed-by Juergen Gross <[email protected]>Taking this through the Xen tree or should I queue it?
I can take it through the Xen tree.
Thanks,
Juergen
Juergen Gross
maintainerRe: [PATCH] xen/scsifront: use offset_in_page() macro
In reply to Martin K. PetersenQuoted 11 lines · Martin K. Petersen
Juergen,
Quoted 6 lines · Geliang Tang
Quoted 3 lines
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>Reviewed-by Juergen Gross <[email protected]>Taking this through the Xen tree or should I queue it?
I can take it through the Xen tree.
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH] xen/scsifront: use offset_in_page() macro
In reply to Geliang TangQuoted 3 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Re: [PATCH] xen/scsifront: use offset_in_page() macro
In reply to Geliang TangQuoted 3 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>
Pushed to xen/tip for-linus-4.12
Thanks,
Juergen
Re: [PATCH] xen/scsifront: use offset_in_page() macro
In reply to Geliang TangQuoted 3 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>
Pushed to xen/tip for-linus-4.12
Thanks,
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
PATCH 1/1 xen/scsifront: use offset_in_page() macro
In reply to Geliang TangUse offset_in_page() macro instead of open-coding.
--- drivers/scsi/xen-scsifront.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/xen-scsifront.c +1 -1
@@ -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);
Signature · 7 lines
2.9.3 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
PATCH 1/1 xprtrdma: use offset_in_page() macro
In reply to Geliang TangUse offset_in_page() macro instead of open-coding.
--- net/sunrpc/xprtrdma/rpc_rdma.c | 4 ++-- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-)
net/sunrpc/xprtrdma/rpc_rdma.c +2 -2
@@ -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:
net/sunrpc/xprtrdma/svc_rdma_sendto.c +1 -2
@@ -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 ;
Signature · 1 line
2.9.3
Re: [PATCH] xprtrdma: use offset_in_page() macro
Quoted 32 lines · Geliang Tang
Use
offset_in_page()macro instead of open-coding.Signed-off-by Geliang Tang <[email protected]>---
net/sunrpc/xprtrdma/rpc_rdma.c| 4 ++--net/sunrpc/xprtrdma/svc_rdma_sendto.c| 3 +--2 files changed, 3 insertions(+), 4 deletions(-)net/sunrpc/xprtrdma/rpc_rdma.c +2
-2@@ -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;
Quoted 1 line
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.
Quoted 8 lines
net/sunrpc/xprtrdma/svc_rdma_sendto.c +0
-0@@ -306,12 +306,11 @@ static int svc_rdma_dma_map_buf(struct svcxprt_rdma *rdma,unsigned char *base, unsigned int len) {
net/sunrpc/xprtrdma/svc_rdma_sendto.c static int svc_rdma_dma_map_buf(struct svcxprt_rdma *rdma, · line 316
Quoted 10 lines
net/sunrpc/xprtrdma/svc_rdma_sendto.c +1
-2-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