Displaying 20 results from an estimated 78 matches for "iov_iter_count".
2015 Feb 04
1
[PATCH v3 16/18] vhost: don't bother with copying iovec in handle_tx()
.../* Skip header. TODO: support TSO. */
- s = move_iovec_hdr(vq->iov, nvq->hdr, hdr_size, out);
len = iov_length(vq->iov, out);
iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len);
+ iov_iter_advance(&msg.msg_iter, hdr_size);
/* Sanity check */
- if (!len) {
+ if (!iov_iter_count(&msg.msg_iter)) {
vq_err(vq, "Unexpected header len for TX: "
"%zd expected %zd\n",
- iov_length(nvq->hdr, s), hdr_size);
+ len, hdr_size);
break;
}
+ len = iov_iter_count(&msg.msg_iter);
zcopy_used = zcopy && len...
2015 Feb 04
1
[PATCH v3 16/18] vhost: don't bother with copying iovec in handle_tx()
.../* Skip header. TODO: support TSO. */
- s = move_iovec_hdr(vq->iov, nvq->hdr, hdr_size, out);
len = iov_length(vq->iov, out);
iov_iter_init(&msg.msg_iter, WRITE, vq->iov, out, len);
+ iov_iter_advance(&msg.msg_iter, hdr_size);
/* Sanity check */
- if (!len) {
+ if (!iov_iter_count(&msg.msg_iter)) {
vq_err(vq, "Unexpected header len for TX: "
"%zd expected %zd\n",
- iov_length(nvq->hdr, s), hdr_size);
+ len, hdr_size);
break;
}
+ len = iov_iter_count(&msg.msg_iter);
zcopy_used = zcopy && len...
2018 May 21
1
[RFC PATCH net-next 01/12] vhost_net: introduce helper to initialize tx iov iter
...iov_iter *iter,
> + size_t hdr_size, int out)
> +{
> + /* Skip header. TODO: support TSO. */
> + size_t len = iov_length(vq->iov, out);
> +
> + iov_iter_init(iter, WRITE, vq->iov, out, len);
> + iov_iter_advance(iter, hdr_size);
> + /* Sanity check */
> + if (!iov_iter_count(iter)) {
> + vq_err(vq, "Unexpected header len for TX: "
> + "%zd expected %zd\n",
> + len, hdr_size);
ok, it was like this before, but please unwrap the string in " ", there
should be no line breaks in string declarations and they are allowed to
go over...
2017 Dec 01
9
[PATCH net,stable v4 0/3] vhost: fix a few skb leaks
From: Wei Xu <wexu at redhat.com>
Matthew found a roughly 40% tcp throughput regression with commit
c67df11f(vhost_net: try batch dequing from skb array) as discussed
in the following thread:
https://www.mail-archive.com/netdev at vger.kernel.org/msg187936.html
v4:
- fix zero iov iterator count in tap/tap_do_read()(Jason)
- don't put tun in case of EBADFD(Jason)
- Replace
2017 Dec 01
9
[PATCH net,stable v4 0/3] vhost: fix a few skb leaks
From: Wei Xu <wexu at redhat.com>
Matthew found a roughly 40% tcp throughput regression with commit
c67df11f(vhost_net: try batch dequing from skb array) as discussed
in the following thread:
https://www.mail-archive.com/netdev at vger.kernel.org/msg187936.html
v4:
- fix zero iov iterator count in tap/tap_do_read()(Jason)
- don't put tun in case of EBADFD(Jason)
- Replace
2017 Dec 01
0
[PATCH 2/3] tun: free skb in early errors
...rivers/net/tun.c
> index 9574900..4f4a842 100644
> --- a/drivers/net/tun.c
> +++ b/drivers/net/tun.c
> @@ -1952,8 +1952,11 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
>
> tun_debug(KERN_INFO, tun, "tun_do_read\n");
>
> - if (!iov_iter_count(to))
> + if (!iov_iter_count(to)) {
> + if (skb)
> + kfree_skb(skb);
> return 0;
> + }
>
> if (!skb) {
> /* Read frames from ring */
> @@ -2069,22 +2072,24 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len,
> {
> struc...
2017 Dec 01
0
[PATCH 3/3] tap: free skb if flags error
...>
> diff --git a/drivers/net/tap.c b/drivers/net/tap.c
> index e9489b8..0a886fda 100644
> --- a/drivers/net/tap.c
> +++ b/drivers/net/tap.c
> @@ -829,8 +829,11 @@ static ssize_t tap_do_read(struct tap_queue *q,
> DEFINE_WAIT(wait);
> ssize_t ret = 0;
>
> - if (!iov_iter_count(to))
> + if (!iov_iter_count(to)) {
> + if (skb)
> + kfree_skb(skb);
> return 0;
> + }
>
> if (skb)
> goto put;
> @@ -1154,11 +1157,14 @@ static int tap_recvmsg(struct socket *sock, struct msghdr *m,
> size_t total_len, int flags)
> {
>...
2018 May 21
0
[RFC PATCH net-next 01/12] vhost_net: introduce helper to initialize tx iov iter
..._iov_iter(struct vhost_virtqueue *vq, struct iov_iter *iter,
+ size_t hdr_size, int out)
+{
+ /* Skip header. TODO: support TSO. */
+ size_t len = iov_length(vq->iov, out);
+
+ iov_iter_init(iter, WRITE, vq->iov, out, len);
+ iov_iter_advance(iter, hdr_size);
+ /* Sanity check */
+ if (!iov_iter_count(iter)) {
+ vq_err(vq, "Unexpected header len for TX: "
+ "%zd expected %zd\n",
+ len, hdr_size);
+ return -EFAULT;
+ }
+ len = iov_iter_count(iter);
+
+ return len;
+}
+
/* Expects to be always run from workqueue - which acts as
* read-size critical section for our kind...
2017 Dec 01
0
[PATCH 2/3] tun: free skb in early errors
...s(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 9574900..4f4a842 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1952,8 +1952,11 @@ static ssize_t tun_do_read(struct tun_struct *tun, struct tun_file *tfile,
tun_debug(KERN_INFO, tun, "tun_do_read\n");
- if (!iov_iter_count(to))
+ if (!iov_iter_count(to)) {
+ if (skb)
+ kfree_skb(skb);
return 0;
+ }
if (!skb) {
/* Read frames from ring */
@@ -2069,22 +2072,24 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len,
{
struct tun_file *tfile = container_of(sock, struct tun_file,...
2017 Dec 01
0
[PATCH 3/3] tap: free skb if flags error
...1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index e9489b8..0a886fda 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -829,8 +829,11 @@ static ssize_t tap_do_read(struct tap_queue *q,
DEFINE_WAIT(wait);
ssize_t ret = 0;
- if (!iov_iter_count(to))
+ if (!iov_iter_count(to)) {
+ if (skb)
+ kfree_skb(skb);
return 0;
+ }
if (skb)
goto put;
@@ -1154,11 +1157,14 @@ static int tap_recvmsg(struct socket *sock, struct msghdr *m,
size_t total_len, int flags)
{
struct tap_queue *q = container_of(sock, struct tap_queue, s...
2023 Mar 10
1
[PATCH v4 2/5] erofs: convert to use i_blockmask()
...a.c
@@ -376,7 +376,7 @@ static ssize_t erofs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
if (bdev)
blksize_mask = bdev_logical_block_size(bdev) - 1;
else
- blksize_mask = (1 << inode->i_blkbits) - 1;
+ blksize_mask = i_blockmask(inode);
if ((iocb->ki_pos | iov_iter_count(to) |
iov_iter_alignment(to)) & blksize_mask)
--
2.25.1
2011 Jul 12
0
[PATCH] Btrfs: Remove unused variable 'last_index' in file.c
...s = NULL;
unsigned long first_index;
- unsigned long last_index;
size_t num_written = 0;
int nrptrs;
int ret = 0;
@@ -1172,7 +1171,6 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
return -ENOMEM;
first_index = pos >> PAGE_CACHE_SHIFT;
- last_index = (pos + iov_iter_count(i)) >> PAGE_CACHE_SHIFT;
while (iov_iter_count(i) > 0) {
size_t offset = pos & (PAGE_CACHE_SIZE - 1);
@@ -1206,8 +1204,7 @@ static noinline ssize_t __btrfs_buffered_write(struct file *file,
* contents of pages from loop to loop
*/
ret = prepare_pages(root, file, pages...
2023 Mar 10
1
[PATCH v3 2/6] erofs: convert to use i_blockmask()
..._iter(struct kiocb *iocb, struct iov_iter *to)
>> if (bdev)
>> blksize_mask = bdev_logical_block_size(bdev) - 1;
>> else
>> - blksize_mask = i_blocksize(inode) - 1;
>> + blksize_mask = i_blockmask(inode);
>>
>> if ((iocb->ki_pos | iov_iter_count(to) |
>> iov_iter_alignment(to)) & blksize_mask)
>> --
>> 2.25.1
>>
2018 May 21
2
[RFC PATCH net-next 10/12] vhost_net: build xdp buff
...ild_xdp(struct vhost_net_virtqueue *nvq,
> + struct iov_iter *from,
> + struct xdp_buff *xdp)
> +{
> + struct vhost_virtqueue *vq = &nvq->vq;
> + struct page_frag *alloc_frag = ¤t->task_frag;
> + struct virtio_net_hdr *gso;
> + size_t len = iov_iter_count(from);
> + int buflen = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
> + int pad = SKB_DATA_ALIGN(VHOST_NET_RX_PAD + VHOST_NET_HEADROOM
> + + nvq->sock_hlen);
> + int sock_hlen = nvq->sock_hlen;
> + void *buf;
> + int copied;
> +
> + if (len < nvq->sock_hl...
2023 Mar 10
3
[PATCH v3 2/6] erofs: convert to use i_blockmask()
...@@ static ssize_t erofs_file_read_iter(struct kiocb *iocb, struct iov_iter *to)
> if (bdev)
> blksize_mask = bdev_logical_block_size(bdev) - 1;
> else
> - blksize_mask = i_blocksize(inode) - 1;
> + blksize_mask = i_blockmask(inode);
>
> if ((iocb->ki_pos | iov_iter_count(to) |
> iov_iter_alignment(to)) & blksize_mask)
> --
> 2.25.1
>
2023 Mar 09
8
[PATCH v3 1/6] fs: add i_blockmask()
Introduce i_blockmask() to simplify code, which replace
(i_blocksize(node) - 1). Like done in commit
93407472a21b("fs: add i_blocksize()").
Signed-off-by: Yangtao Li <frank.li at vivo.com>
---
v3:
-none
v2:
-convert to i_blockmask()
include/linux/fs.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/include/linux/fs.h b/include/linux/fs.h
index c85916e9f7db..17387d465b8b
2017 Nov 30
2
[PATCH net,stable v2] vhost: fix skb leak in handle_rx()
...= container_of(sock, struct tun_file, socket);
??? struct tun_struct *tun = __tun_get(tfile);
??? int ret;
??? if (!tun)
??? ??? return -EBADFD;
??? if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) {
??? ??? ret = -EINVAL;
??? ??? goto out;
??? }
And tun_do_read() has:
??? if (!iov_iter_count(to))
??? ??? return 0;
So I think we need free skb in those cases.
Thanks
2017 Nov 30
2
[PATCH net,stable v2] vhost: fix skb leak in handle_rx()
...= container_of(sock, struct tun_file, socket);
??? struct tun_struct *tun = __tun_get(tfile);
??? int ret;
??? if (!tun)
??? ??? return -EBADFD;
??? if (flags & ~(MSG_DONTWAIT|MSG_TRUNC|MSG_ERRQUEUE)) {
??? ??? ret = -EINVAL;
??? ??? goto out;
??? }
And tun_do_read() has:
??? if (!iov_iter_count(to))
??? ??? return 0;
So I think we need free skb in those cases.
Thanks
2018 Aug 03
4
[PATCH net-next] vhost: switch to use new message format
...process_iotlb_msg(struct vhost_dev *dev,
ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
struct iov_iter *from)
{
- struct vhost_msg_node node;
- unsigned size = sizeof(struct vhost_msg);
- size_t ret;
- int err;
+ struct vhost_iotlb_msg msg;
+ size_t offset;
+ int type, ret;
- if (iov_iter_count(from) < size)
- return 0;
- ret = copy_from_iter(&node.msg, size, from);
- if (ret != size)
+ ret = copy_from_iter(&type, sizeof(type), from);
+ if (ret != sizeof(type))
goto done;
- switch (node.msg.type) {
+ switch (type) {
case VHOST_IOTLB_MSG:
- err = vhost_process_iotlb_msg...
2018 Aug 03
4
[PATCH net-next] vhost: switch to use new message format
...process_iotlb_msg(struct vhost_dev *dev,
ssize_t vhost_chr_write_iter(struct vhost_dev *dev,
struct iov_iter *from)
{
- struct vhost_msg_node node;
- unsigned size = sizeof(struct vhost_msg);
- size_t ret;
- int err;
+ struct vhost_iotlb_msg msg;
+ size_t offset;
+ int type, ret;
- if (iov_iter_count(from) < size)
- return 0;
- ret = copy_from_iter(&node.msg, size, from);
- if (ret != size)
+ ret = copy_from_iter(&type, sizeof(type), from);
+ if (ret != sizeof(type))
goto done;
- switch (node.msg.type) {
+ switch (type) {
case VHOST_IOTLB_MSG:
- err = vhost_process_iotlb_msg...