• Chuck Lever's avatar
    NFSD: Restore NFSv4 decoding's SAVEMEM functionality · 7b723008
    Chuck Lever authored
    While converting the NFSv4 decoder to use xdr_stream-based XDR
    processing, I removed the old SAVEMEM() macro. This macro wrapped
    a bit of logic that avoided a memory allocation by recognizing when
    the decoded item resides in a linear section of the Receive buffer.
    In that case, it returned a pointer into that buffer instead of
    allocating a bounce buffer.
    
    The bounce buffer is necessary only when xdr_inline_decode() has
    placed the decoded item in the xdr_stream's scratch buffer, which
    disappears the next time xdr_inline_decode() is called with that
    xdr_stream. That happens only if the data item crosses a page
    boundary in the receive buffer, an exceedingly rare occurrence.
    
    Allocating a bounce buffer every time results in a minor performance
    regression that was introduced by the recent NFSv4 decoder overhaul.
    Let's restore the previous behavior. On average, it saves about 1.5
    kmalloc() calls per COMPOUND.
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    7b723008
nfs4xdr.c 140 KB