aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/xfs/xfs_log.c1
-rw-r--r--fs/xfs/xfs_log_priv.h4
-rw-r--r--fs/xfs/xfs_log_recover.c14
3 files changed, 10 insertions, 9 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 36e09e362f7f..3038dd52c72a 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1089,7 +1089,6 @@ xlog_alloc_log(xfs_mount_t *mp,
1089 } 1089 }
1090 } 1090 }
1091 log->l_sectBBsize = 1 << log2_size; 1091 log->l_sectBBsize = 1 << log2_size;
1092 log->l_sectbb_mask = log->l_sectBBsize - 1;
1093 1092
1094 xlog_get_iclog_buffer_size(mp, log); 1093 xlog_get_iclog_buffer_size(mp, log);
1095 1094
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index 56f221d7bf61..9cf695154451 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -396,9 +396,7 @@ typedef struct log {
396 struct xfs_buf_cancel **l_buf_cancel_table; 396 struct xfs_buf_cancel **l_buf_cancel_table;
397 int l_iclog_hsize; /* size of iclog header */ 397 int l_iclog_hsize; /* size of iclog header */
398 int l_iclog_heads; /* # of iclog header sectors */ 398 int l_iclog_heads; /* # of iclog header sectors */
399 uint l_sectBBsize; /* sector size in BBs */ 399 uint l_sectBBsize; /* sector size in BBs (2^n) */
400 uint l_sectbb_mask; /* sector size (in BBs)
401 * alignment mask */
402 int l_iclog_size; /* size of log in bytes */ 400 int l_iclog_size; /* size of log in bytes */
403 int l_iclog_size_log; /* log power size of log */ 401 int l_iclog_size_log; /* log power size of log */
404 int l_iclog_bufs; /* number of iclog buffers */ 402 int l_iclog_bufs; /* number of iclog buffers */
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index f1220ec1896f..0de08e366315 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -121,6 +121,10 @@ xlog_put_bp(
121 xfs_buf_free(bp); 121 xfs_buf_free(bp);
122} 122}
123 123
124/*
125 * Return the address of the start of the given block number's data
126 * in a log buffer. The buffer covers a log sector-aligned region.
127 */
124STATIC xfs_caddr_t 128STATIC xfs_caddr_t
125xlog_align( 129xlog_align(
126 xlog_t *log, 130 xlog_t *log,
@@ -128,14 +132,14 @@ xlog_align(
128 int nbblks, 132 int nbblks,
129 xfs_buf_t *bp) 133 xfs_buf_t *bp)
130{ 134{
135 xfs_daddr_t offset;
131 xfs_caddr_t ptr; 136 xfs_caddr_t ptr;
132 137
133 if (log->l_sectBBsize == 1) 138 offset = blk_no & ((xfs_daddr_t) log->l_sectBBsize - 1);
134 return XFS_BUF_PTR(bp); 139 ptr = XFS_BUF_PTR(bp) + BBTOB(offset);
140
141 ASSERT(ptr + BBTOB(nbblks) <= XFS_BUF_PTR(bp) + XFS_BUF_SIZE(bp));
135 142
136 ptr = XFS_BUF_PTR(bp) + BBTOB((int)blk_no & log->l_sectbb_mask);
137 ASSERT(XFS_BUF_SIZE(bp) >=
138 BBTOB(nbblks + (blk_no & log->l_sectbb_mask)));
139 return ptr; 143 return ptr;
140} 144}
141 145