• Dave Chinner's avatar
    xfs: reserve space and initialise xlog_op_header in item formatting · 8d547cf9
    Dave Chinner authored
    Current xlog_write() adds op headers to the log manually for every
    log item region that is in the vector passed to it. While
    xlog_write() needs to stamp the transaction ID into the ophdr, we
    already know it's length, flags, clientid, etc at CIL commit time.
    
    This means the only time that xlog write really needs to format and
    reserve space for a new ophdr is when a region is split across two
    iclogs. Adding the opheader and accounting for it as part of the
    normal formatted item region means we simplify the accounting
    of space used by a transaction and we don't have to special case
    reserving of space in for the ophdrs in xlog_write(). It also means
    we can largely initialise the ophdr in transaction commit instead
    of xlog_write, making the xlog_write formatting inner loop much
    tighter.
    
    xlog_prepare_iovec() is now too large to stay as an inline function,
    so we move it out of line and into xfs_log.c.
    
    Object sizes:
    text	   data	    bss	    dec	    hex	filename
    1125934	 305951	    484	1432369	 15db31 fs/xfs/built-in.a.before
    1123360	 305951	    484	1429795	 15d123 fs/xfs/built-in.a.after
    
    So the code is a roughly 2.5kB smaller with xlog_prepare_iovec() now
    out of line, even though it grew in size itself.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Reviewed-by: default avatarChandan Babu R <chandan.babu@oracle.com>
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    8d547cf9
xfs_log_cil.c 49.2 KB