dlm: use kernel_sendpage
Using kernel_sendpage() is cleaner and safer than following sock->ops ourselves. Signed-off-by: Paolo Bonzini <bonzini@gnu.org> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
063c4c9963
commit
1329e3f2c8
|
@ -1285,7 +1285,6 @@ out:
|
||||||
static void send_to_sock(struct connection *con)
|
static void send_to_sock(struct connection *con)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
ssize_t(*sendpage) (struct socket *, struct page *, int, size_t, int);
|
|
||||||
const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
|
const int msg_flags = MSG_DONTWAIT | MSG_NOSIGNAL;
|
||||||
struct writequeue_entry *e;
|
struct writequeue_entry *e;
|
||||||
int len, offset;
|
int len, offset;
|
||||||
|
@ -1294,8 +1293,6 @@ static void send_to_sock(struct connection *con)
|
||||||
if (con->sock == NULL)
|
if (con->sock == NULL)
|
||||||
goto out_connect;
|
goto out_connect;
|
||||||
|
|
||||||
sendpage = con->sock->ops->sendpage;
|
|
||||||
|
|
||||||
spin_lock(&con->writequeue_lock);
|
spin_lock(&con->writequeue_lock);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
e = list_entry(con->writequeue.next, struct writequeue_entry,
|
e = list_entry(con->writequeue.next, struct writequeue_entry,
|
||||||
|
@ -1310,8 +1307,8 @@ static void send_to_sock(struct connection *con)
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
if (len) {
|
if (len) {
|
||||||
ret = sendpage(con->sock, e->page, offset, len,
|
ret = kernel_sendpage(con->sock, e->page, offset, len,
|
||||||
msg_flags);
|
msg_flags);
|
||||||
if (ret == -EAGAIN || ret == 0) {
|
if (ret == -EAGAIN || ret == 0) {
|
||||||
cond_resched();
|
cond_resched();
|
||||||
goto out;
|
goto out;
|
||||||
|
|
Loading…
Reference in New Issue