Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2003 23:56:24 +0400 (MSD)
From:      Igor Sysoev <is@rambler-co.ru>
To:        Bill Fenner <fenner@research.att.com>
Cc:        arch@freebsd.org
Subject:   Re: sendfile(2) SF_NOPUSH flag proposal
Message-ID:  <Pine.BSF.4.21.0305282355390.51293-100000@is>
In-Reply-To: <200305281755.h4SHtbu05504@windsor.research.att.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 28 May 2003, Bill Fenner wrote:

> Why not set PRUS_MORETOCOME on all but the final pru_send() call?

I think it's a good solution.  We can

1) use TF_NOPUSH to coalesce the header and the first file part 
   or the last file part and the trailer as Matthew Dillon suggested;

2) use the same TF_NOPUSH to postpone the sending partial packet while
   a reading file page from the disk;

3) and use PRUS_MORETOCOME to avoid partial packet after EAGAIN
   on non-blocking socket.

---------- 
sendfile()
{
    saved = tp->t_flags & TF_NOPUSH;
    if (header) {
        writev(header);
    }

    if (file) {
        send file pages with PRUS_MORETOCOME
    }

    if (trailer) {
        writev(trailer);
    }

done:
    if (sendfile completed) {
        tp->t_flags &= ~TF_MORETOCOME;
    }

    tp->t_flags |= saved;
    if (saved & TF_NOPUSH) {
        tcp_output(tp);
    }
}
----------

As I understand TF_MORETOCOME should postpone the sending the partially
filled packet after sendfile will return EAGAIN.


Igor Sysoev
http://sysoev.ru/en/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0305282355390.51293-100000>