summaryrefslogtreecommitdiff
path: root/fs/xfs/xfs_log.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2022-04-21 10:34:15 +1000
committerDave Chinner <david@fromorbit.com>2022-04-21 10:34:15 +1000
commit54021b624261fe5b429d7ab4d081c3b2cca153a8 (patch)
tree049f98a79b34659ea0d37f6dcb64e0184a19de72 /fs/xfs/xfs_log.c
parentffa04c1f2cb047d6a44c3570bfb6e1ca5ba7f489 (diff)
xfs: embed the xlog_op_header in the commit record
Remove the final case where xlog_write() has to prepend an opheader to a log transaction. Similar to the start record, the commit record is just an empty opheader with a XLOG_COMMIT_TRANS type, so we can just make this the payload for the region being passed to xlog_write() and remove the special handling in xlog_write() for the commit record. 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>
Diffstat (limited to 'fs/xfs/xfs_log.c')
-rw-r--r--fs/xfs/xfs_log.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 00e9af9b246a..c23a15c56ef1 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -2267,11 +2267,10 @@ xlog_write_calc_vec_length(
/* Don't account for regions with embedded ophdrs */
if (optype && headers > 0) {
- if (optype & XLOG_UNMOUNT_TRANS)
- headers--;
+ headers--;
if (optype & XLOG_START_TRANS) {
- ASSERT(headers >= 2);
- headers -= 2;
+ ASSERT(headers >= 1);
+ headers--;
}
}
@@ -2472,14 +2471,6 @@ xlog_write(
int data_cnt = 0;
int error = 0;
- /*
- * If this is a commit or unmount transaction, we don't need a start
- * record to be written. We do, however, have to account for the commit
- * header that gets written. Hence we always have to account for an
- * extra xlog_op_header here for commit records.
- */
- if (optype & XLOG_COMMIT_TRANS)
- ticket->t_curr_res -= sizeof(struct xlog_op_header);
if (ticket->t_curr_res < 0) {
xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES,
"ctx ticket reservation ran out. Need to up reservation");
@@ -2536,14 +2527,13 @@ xlog_write(
/*
* The XLOG_START_TRANS has embedded ophdrs for the
* start record and transaction header. They will always
- * be the first two regions in the lv chain.
+ * be the first two regions in the lv chain. Commit and
+ * unmount records also have embedded ophdrs.
*/
- if (optype & XLOG_START_TRANS) {
+ if (optype) {
ophdr = reg->i_addr;
if (index)
optype &= ~XLOG_START_TRANS;
- } else if (optype & XLOG_UNMOUNT_TRANS) {
- ophdr = reg->i_addr;
} else {
ophdr = xlog_write_setup_ophdr(log, ptr,
ticket, optype);