Commit 48389ef1 authored by Alex Elder's avatar Alex Elder

xfs: kill off l_sectbb_mask

There remains only one user of the l_sectbb_mask field in the log
structure.  Just kill it off and compute the mask where needed from
the power-of-2 sector size.

(Only update from last post is to accomodate the changes in the
previous patch in the series.)
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 69ce58f0
...@@ -1089,7 +1089,6 @@ xlog_alloc_log(xfs_mount_t *mp, ...@@ -1089,7 +1089,6 @@ xlog_alloc_log(xfs_mount_t *mp,
} }
} }
log->l_sectBBsize = 1 << log2_size; log->l_sectBBsize = 1 << log2_size;
log->l_sectbb_mask = log->l_sectBBsize - 1;
xlog_get_iclog_buffer_size(mp, log); xlog_get_iclog_buffer_size(mp, log);
......
...@@ -396,9 +396,7 @@ typedef struct log { ...@@ -396,9 +396,7 @@ typedef struct log {
struct xfs_buf_cancel **l_buf_cancel_table; struct xfs_buf_cancel **l_buf_cancel_table;
int l_iclog_hsize; /* size of iclog header */ int l_iclog_hsize; /* size of iclog header */
int l_iclog_heads; /* # of iclog header sectors */ int l_iclog_heads; /* # of iclog header sectors */
uint l_sectBBsize; /* sector size in BBs */ uint l_sectBBsize; /* sector size in BBs (2^n) */
uint l_sectbb_mask; /* sector size (in BBs)
* alignment mask */
int l_iclog_size; /* size of log in bytes */ int l_iclog_size; /* size of log in bytes */
int l_iclog_size_log; /* log power size of log */ int l_iclog_size_log; /* log power size of log */
int l_iclog_bufs; /* number of iclog buffers */ int l_iclog_bufs; /* number of iclog buffers */
......
...@@ -121,6 +121,10 @@ xlog_put_bp( ...@@ -121,6 +121,10 @@ xlog_put_bp(
xfs_buf_free(bp); xfs_buf_free(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 xfs_caddr_t STATIC xfs_caddr_t
xlog_align( xlog_align(
xlog_t *log, xlog_t *log,
...@@ -128,14 +132,14 @@ xlog_align( ...@@ -128,14 +132,14 @@ xlog_align(
int nbblks, int nbblks,
xfs_buf_t *bp) xfs_buf_t *bp)
{ {
xfs_daddr_t offset;
xfs_caddr_t ptr; xfs_caddr_t ptr;
if (log->l_sectBBsize == 1) offset = blk_no & ((xfs_daddr_t) log->l_sectBBsize - 1);
return XFS_BUF_PTR(bp); ptr = XFS_BUF_PTR(bp) + BBTOB(offset);
ASSERT(ptr + BBTOB(nbblks) <= XFS_BUF_PTR(bp) + XFS_BUF_SIZE(bp));
ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask);
ASSERT(XFS_BUF_SIZE(bp) >=
BBTOB(nbblks + (blk_no & log->l_sectbb_mask)));
return ptr; return ptr;
} }
......
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