Ignore:
Timestamp:
May 12, 2014, 8:58:38 PM (11 years ago)
Author:
Silvan Scherrer
Message:

Samba 3.6: updated vendor to latest version

Location:
vendor/current/lib/tsocket
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/tsocket/tsocket.h

    r740 r860  
    627627char *tsocket_address_unix_path(const struct tsocket_address *addr,
    628628                                TALLOC_CTX *mem_ctx);
     629
     630/**
     631 * @brief Request a syscall optimization for tdgram_recvfrom_send()
     632 *
     633 * This function is only used to reduce the amount of syscalls and
     634 * optimize performance. You should only use this if you know
     635 * what you're doing.
     636 *
     637 * The optimization is off by default.
     638 *
     639 * @param[in]  dgram    The tdgram_context of a bsd socket, if this
     640 *                      not a bsd socket the function does nothing.
     641 *
     642 * @param[in]  on       The boolean value to turn the optimization on and off.
     643 *
     644 * @return              The old boolean value.
     645 *
     646 * @see tdgram_recvfrom_send()
     647 */
     648bool tdgram_bsd_optimize_recvfrom(struct tdgram_context *dgram,
     649                                  bool on);
    629650
    630651#ifdef DOXYGEN
     
    688709        _tdgram_unix_socket(local, remote, mem_ctx, dgram, __location__)
    689710#endif
     711
     712/**
     713 * @brief Request a syscall optimization for tstream_readv_send()
     714 *
     715 * This function is only used to reduce the amount of syscalls and
     716 * optimize performance. You should only use this if you know
     717 * what you're doing.
     718 *
     719 * The optimization is off by default.
     720 *
     721 * @param[in]  stream   The tstream_context of a bsd socket, if this
     722 *                      not a bsd socket the function does nothing.
     723 *
     724 * @param[in]  on       The boolean value to turn the optimization on and off.
     725 *
     726 * @return              The old boolean value.
     727 *
     728 * @see tstream_readv_send()
     729 */
     730bool tstream_bsd_optimize_readv(struct tstream_context *stream,
     731                                bool on);
    690732
    691733/**
  • vendor/current/lib/tsocket/tsocket_bsd.c

    r740 r860  
    655655        void *event_ptr;
    656656        struct tevent_fd *fde;
     657        bool optimize_recvfrom;
    657658
    658659        void *readable_private;
     
    661662        void (*writeable_handler)(void *private_data);
    662663};
     664
     665bool tdgram_bsd_optimize_recvfrom(struct tdgram_context *dgram,
     666                                  bool on)
     667{
     668        struct tdgram_bsd *bsds =
     669                talloc_get_type(_tdgram_context_data(dgram),
     670                struct tdgram_bsd);
     671        bool old;
     672
     673        if (bsds == NULL) {
     674                /* not a bsd socket */
     675                return false;
     676        }
     677
     678        old = bsds->optimize_recvfrom;
     679        bsds->optimize_recvfrom = on;
     680
     681        return old;
     682}
    663683
    664684static void tdgram_bsd_fde_handler(struct tevent_context *ev,
     
    838858        }
    839859
     860
    840861        /*
    841862         * this is a fast path, not waiting for the
     
    843864         * about 10%-20% performance in benchmark tests.
    844865         */
    845         tdgram_bsd_recvfrom_handler(req);
    846         if (!tevent_req_is_in_progress(req)) {
    847                 goto post;
     866        if (bsds->optimize_recvfrom) {
     867                /*
     868                 * We only do the optimization on
     869                 * recvfrom if the caller asked for it.
     870                 *
     871                 * This is needed because in most cases
     872                 * we preferr to flush send buffers before
     873                 * receiving incoming requests.
     874                 */
     875                tdgram_bsd_recvfrom_handler(req);
     876                if (!tevent_req_is_in_progress(req)) {
     877                        goto post;
     878                }
    848879        }
    849880
     
    14011432        void *event_ptr;
    14021433        struct tevent_fd *fde;
     1434        bool optimize_readv;
    14031435
    14041436        void *readable_private;
     
    14071439        void (*writeable_handler)(void *private_data);
    14081440};
     1441
     1442bool tstream_bsd_optimize_readv(struct tstream_context *stream,
     1443                                bool on)
     1444{
     1445        struct tstream_bsd *bsds =
     1446                talloc_get_type(_tstream_context_data(stream),
     1447                struct tstream_bsd);
     1448        bool old;
     1449
     1450        if (bsds == NULL) {
     1451                /* not a bsd socket */
     1452                return false;
     1453        }
     1454
     1455        old = bsds->optimize_readv;
     1456        bsds->optimize_readv = on;
     1457
     1458        return old;
     1459}
    14091460
    14101461static void tstream_bsd_fde_handler(struct tevent_context *ev,
     
    16201671         * about 10%-20% performance in benchmark tests.
    16211672         */
    1622         tstream_bsd_readv_handler(req);
    1623         if (!tevent_req_is_in_progress(req)) {
    1624                 goto post;
     1673        if (bsds->optimize_readv) {
     1674                /*
     1675                 * We only do the optimization on
     1676                 * readv if the caller asked for it.
     1677                 *
     1678                 * This is needed because in most cases
     1679                 * we preferr to flush send buffers before
     1680                 * receiving incoming requests.
     1681                 */
     1682                tstream_bsd_readv_handler(req);
     1683                if (!tevent_req_is_in_progress(req)) {
     1684                        goto post;
     1685                }
    16251686        }
    16261687
  • vendor/current/lib/tsocket/tsocket_helpers.c

    r478 r860  
    213213        size_t i;
    214214        struct tevent_req *subreq;
     215        bool optimize = false;
     216        bool save_optimize = false;
     217
     218        if (state->count > 0) {
     219                /*
     220                 * This is not the first time we asked for a vector,
     221                 * which means parts of the pdu already arrived.
     222                 *
     223                 * In this case it make sense to enable
     224                 * a syscall/performance optimization if the
     225                 * low level tstream implementation supports it.
     226                 */
     227                optimize = true;
     228        }
    215229
    216230        TALLOC_FREE(state->vector);
     
    256270        }
    257271
     272        if (optimize) {
     273                /*
     274                 * If the low level stream is a bsd socket
     275                 * we will get syscall optimization.
     276                 *
     277                 * If it is not a bsd socket
     278                 * tstream_bsd_optimize_readv() just returns.
     279                 */
     280                save_optimize = tstream_bsd_optimize_readv(state->caller.stream,
     281                                                           true);
     282        }
    258283        subreq = tstream_readv_send(state,
    259284                                    state->caller.ev,
     
    261286                                    state->vector,
    262287                                    state->count);
     288        if (optimize) {
     289                tstream_bsd_optimize_readv(state->caller.stream,
     290                                           save_optimize);
     291        }
    263292        if (tevent_req_nomem(subreq, req)) {
    264293                return;
Note: See TracChangeset for help on using the changeset viewer.