When xlog_write_partial splits a log region over multiple iclogs, it has to include the continuation ophder in the length requested for the new iclog. Currently is simply adds that to the request, which makes the accounting of the used space below look slightly different from the other users of iclog space that decrement it. To prepare for more code sharing, adding the ophdr size to the len variable before the call to xlog_write_get_more_iclog_space and then decrement it later. This changes the contents of len when xlog_write_get_more_iclog_space returns an error, but as nothing looks at len in that case the difference doesn't matter. Signed-off-by: Christoph Hellwig <hch@xxxxxx> --- fs/xfs/xfs_log.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c index 15fc7cac6da3..19f5521405bf 100644 --- a/fs/xfs/xfs_log.c +++ b/fs/xfs/xfs_log.c @@ -2079,10 +2079,10 @@ xlog_write_partial( * consumes hasn't been accounted to the lv we are * writing. */ + *len += sizeof(struct xlog_op_header); error = xlog_write_get_more_iclog_space(ticket, - &iclog, log_offset, - *len + sizeof(struct xlog_op_header), - record_cnt, data_cnt); + &iclog, log_offset, *len, record_cnt, + data_cnt); if (error) return error; @@ -2095,6 +2095,7 @@ xlog_write_partial( ticket->t_curr_res -= sizeof(struct xlog_op_header); *log_offset += sizeof(struct xlog_op_header); *data_cnt += sizeof(struct xlog_op_header); + *len -= sizeof(struct xlog_op_header); /* * If rlen fits in the iclog, then end the region -- 2.47.2