OSDN Git Service

xfs: only CIL pushes require a start record
authorDave Chinner <dchinner@redhat.com>
Thu, 21 Apr 2022 00:33:48 +0000 (10:33 +1000)
committerDave Chinner <david@fromorbit.com>
Thu, 21 Apr 2022 00:33:48 +0000 (10:33 +1000)
commit6eaed95e21a0872692246e63cb45542d0f62c922
tree5ee643a6aa7186459d0f8734ff60ac0fe31846d5
parent735fbf67df56f402e9baa079a5560ebe8fa049c1
xfs: only CIL pushes require a start record

So move the one-off start record writing in xlog_write() out into
the static header that the CIL push builds to write into the log
initially. This simplifes the xlog_write() logic a lot.

pahole on x86-64 confirms that the xlog_cil_trans_hdr is correctly
32 bit aligned and packed for copying the log op and transaction
headers directly into the log as a single log region copy.

struct xlog_cil_trans_hdr {
        struct xlog_op_header      oph[2];               /*     0    24 */
        struct xfs_trans_header    thdr;                 /*    24    16 */
        struct xfs_log_iovec       lhdr[2];              /*    40    32 */

        /* size: 72, cachelines: 2, members: 3 */
        /* last cacheline: 8 bytes */
};

A wart is needed to handle the fact that length of the region the
opheader points to doesn't include the opheader length. hence if
we embed the opheader, we have to substract the opheader length from
the length written into the opheader by the generic copying code.
This will eventually go away when everything is converted to
embedded opheaders.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Chandan Babu R <chandan.babu@oracle.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_log.c
fs/xfs/xfs_log_cil.c