Revision 128aa589
b/block/sheepdog.c | ||
---|---|---|
702 | 702 |
return !QLIST_EMPTY(&s->outstanding_aio_head); |
703 | 703 |
} |
704 | 704 |
|
705 |
#if !defined(SOL_TCP) || !defined(TCP_CORK) |
|
706 |
|
|
707 |
static int set_cork(int fd, int v) |
|
708 |
{ |
|
709 |
return 0; |
|
710 |
} |
|
711 |
|
|
712 |
#else |
|
713 |
|
|
714 |
static int set_cork(int fd, int v) |
|
715 |
{ |
|
716 |
return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v)); |
|
717 |
} |
|
718 |
|
|
719 |
#endif |
|
720 |
|
|
721 | 705 |
static int set_nodelay(int fd) |
722 | 706 |
{ |
723 | 707 |
int ret, opt; |
... | ... | |
923 | 907 |
s->co_send = qemu_coroutine_self(); |
924 | 908 |
qemu_aio_set_fd_handler(s->fd, co_read_response, co_write_request, |
925 | 909 |
aio_flush_request, NULL, s); |
926 |
set_cork(s->fd, 1); |
|
910 |
socket_set_cork(s->fd, 1);
|
|
927 | 911 |
|
928 | 912 |
/* send a header */ |
929 | 913 |
ret = qemu_co_send(s->fd, &hdr, sizeof(hdr)); |
... | ... | |
942 | 926 |
} |
943 | 927 |
} |
944 | 928 |
|
945 |
set_cork(s->fd, 0); |
|
929 |
socket_set_cork(s->fd, 0);
|
|
946 | 930 |
qemu_aio_set_fd_handler(s->fd, co_read_response, NULL, |
947 | 931 |
aio_flush_request, NULL, s); |
948 | 932 |
qemu_co_mutex_unlock(&s->lock); |
b/osdep.c | ||
---|---|---|
48 | 48 |
#include "trace.h" |
49 | 49 |
#include "qemu_socket.h" |
50 | 50 |
|
51 |
int socket_set_cork(int fd, int v) |
|
52 |
{ |
|
53 |
#if defined(SOL_TCP) && defined(TCP_CORK) |
|
54 |
return setsockopt(fd, SOL_TCP, TCP_CORK, &v, sizeof(v)); |
|
55 |
#else |
|
56 |
return 0; |
|
57 |
#endif |
|
58 |
} |
|
59 |
|
|
51 | 60 |
int qemu_madvise(void *addr, size_t len, int advice) |
52 | 61 |
{ |
53 | 62 |
if (advice == QEMU_MADV_INVALID) { |
b/qemu_socket.h | ||
---|---|---|
35 | 35 |
/* misc helpers */ |
36 | 36 |
int qemu_socket(int domain, int type, int protocol); |
37 | 37 |
int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen); |
38 |
int socket_set_cork(int fd, int v); |
|
38 | 39 |
void socket_set_block(int fd); |
39 | 40 |
void socket_set_nonblock(int fd); |
40 | 41 |
int send_all(int fd, const void *buf, int len1); |
Also available in: Unified diff