diff options
author | Christoph Hellwig <hch@lst.de> | 2019-06-28 19:27:26 -0700 |
---|---|---|
committer | Darrick J. Wong <darrick.wong@oracle.com> | 2019-06-28 19:27:26 -0700 |
commit | 18ffb8c3f0bfd2a0b92026eb43651591288c3a39 (patch) | |
tree | d9703d53de314f97f178af7949dd362c2658e161 | |
parent | 1058d0f5eeb422325e2574dbd88927dc821dee57 (diff) | |
download | linux-18ffb8c3f0bfd2a0b92026eb43651591288c3a39.tar.bz2 |
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
-rw-r--r-- | fs/xfs/xfs_log_recover.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 883e930f2426..a9811c01e007 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -151,20 +151,14 @@ xlog_put_bp( * 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. */ -STATIC char * +static inline unsigned int xlog_align( struct xlog *log, - xfs_daddr_t blk_no, - int nbblks, - struct xfs_buf *bp) + xfs_daddr_t blk_no) { - xfs_daddr_t offset = blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1); - - ASSERT(offset + nbblks <= bp->b_length); - return bp->b_addr + BBTOB(offset); + return BBTOB(blk_no & ((xfs_daddr_t)log->l_sectBBsize - 1)); } - /* * nbblks should be uint, but oh well. Just want to catch that 32-bit length. */ @@ -216,7 +210,7 @@ xlog_bread( if (error) return error; - *offset = xlog_align(log, blk_no, nbblks, bp); + *offset = bp->b_addr + xlog_align(log, blk_no); return 0; } @@ -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++) { xlog_add_record(log, offset, cycle, i+j, tail_cycle, tail_block); |