Commit 18ffb8c3 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Darrick J. Wong

xfs: return an offset instead of a pointer from xlog_align

This simplifies both the helper and the callers.  We lost a bit of
size sanity checking, but that is already covered by KASAN if needed.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
parent 1058d0f5
...@@ -151,20 +151,14 @@ xlog_put_bp( ...@@ -151,20 +151,14 @@ xlog_put_bp(
* Return the address of the start of the given block number's data * Return the address of the start of the given block number's data
* in a log buffer. The buffer covers a log sector-aligned region. * in a log buffer. The buffer covers a log sector-aligned region.
*/ */
STATIC char * static inline unsigned int
xlog_align( xlog_align(
struct xlog *log, struct xlog *log,
xfs_daddr_t blk_no, xfs_daddr_t blk_no)
int nbblks,
struct xfs_buf *bp)
{ {
xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); return BBTOB(blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1));
ASSERT(offset + nbblks <= bp->b_length);
return bp->b_addr + BBTOB(offset);
} }
/* /*
* nbblks should be uint, but oh well. Just want to catch that 32-bit length. * nbblks should be uint, but oh well. Just want to catch that 32-bit length.
*/ */
...@@ -216,7 +210,7 @@ xlog_bread( ...@@ -216,7 +210,7 @@ xlog_bread(
if (error) if (error)
return error; return error;
*offset = xlog_align(log, blk_no, nbblks, bp); *offset = bp->b_addr + xlog_align(log, blk_no);
return 0; return 0;
} }
...@@ -1713,7 +1707,7 @@ xlog_write_log_records( ...@@ -1713,7 +1707,7 @@ xlog_write_log_records(
} }
offset = xlog_align(log, start_block, endcount, bp); offset = bp->b_addr + xlog_align(log, start_block);
for (; j < endcount; j++) { for (; j < endcount; j++) {
xlog_add_record(log, offset, cycle, i+j, xlog_add_record(log, offset, cycle, i+j,
tail_cycle, tail_block); tail_cycle, tail_block);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment