aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/xfs/xfs_log.c12
-rw-r--r--fs/xfs/xfs_log_priv.h46
-rw-r--r--fs/xfs/xfs_log_recover.c7
3 files changed, 19 insertions, 46 deletions
diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
index 8a5b05536a28..aadaa1472f69 100644
--- a/fs/xfs/xfs_log.c
+++ b/fs/xfs/xfs_log.c
@@ -1029,12 +1029,6 @@ xlog_iodone(xfs_buf_t *bp)
1029 ASSERT(XFS_BUF_FSPRIVATE2(bp, unsigned long) == (unsigned long) 2); 1029 ASSERT(XFS_BUF_FSPRIVATE2(bp, unsigned long) == (unsigned long) 2);
1030 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1); 1030 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1031 aborted = 0; 1031 aborted = 0;
1032
1033 /*
1034 * Some versions of cpp barf on the recursive definition of
1035 * ic_log -> hic_fields.ic_log and expand ic_log twice when
1036 * it is passed through two macros. Workaround broken cpp.
1037 */
1038 l = iclog->ic_log; 1032 l = iclog->ic_log;
1039 1033
1040 /* 1034 /*
@@ -1301,7 +1295,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1301 XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb); 1295 XFS_BUF_SET_BDSTRAT_FUNC(bp, xlog_bdstrat_cb);
1302 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1); 1296 XFS_BUF_SET_FSPRIVATE2(bp, (unsigned long)1);
1303 iclog->ic_bp = bp; 1297 iclog->ic_bp = bp;
1304 iclog->hic_data = bp->b_addr; 1298 iclog->ic_data = bp->b_addr;
1305#ifdef DEBUG 1299#ifdef DEBUG
1306 log->l_iclog_bak[i] = (xfs_caddr_t)&(iclog->ic_header); 1300 log->l_iclog_bak[i] = (xfs_caddr_t)&(iclog->ic_header);
1307#endif 1301#endif
@@ -1321,7 +1315,7 @@ xlog_alloc_log(xfs_mount_t *mp,
1321 atomic_set(&iclog->ic_refcnt, 0); 1315 atomic_set(&iclog->ic_refcnt, 0);
1322 spin_lock_init(&iclog->ic_callback_lock); 1316 spin_lock_init(&iclog->ic_callback_lock);
1323 iclog->ic_callback_tail = &(iclog->ic_callback); 1317 iclog->ic_callback_tail = &(iclog->ic_callback);
1324 iclog->ic_datap = (char *)iclog->hic_data + log->l_iclog_hsize; 1318 iclog->ic_datap = (char *)iclog->ic_data + log->l_iclog_hsize;
1325 1319
1326 ASSERT(XFS_BUF_ISBUSY(iclog->ic_bp)); 1320 ASSERT(XFS_BUF_ISBUSY(iclog->ic_bp));
1327 ASSERT(XFS_BUF_VALUSEMA(iclog->ic_bp) <= 0); 1321 ASSERT(XFS_BUF_VALUSEMA(iclog->ic_bp) <= 0);
@@ -3463,7 +3457,7 @@ xlog_verify_iclog(xlog_t *log,
3463 ptr = iclog->ic_datap; 3457 ptr = iclog->ic_datap;
3464 base_ptr = ptr; 3458 base_ptr = ptr;
3465 ophead = (xlog_op_header_t *)ptr; 3459 ophead = (xlog_op_header_t *)ptr;
3466 xhdr = (xlog_in_core_2_t *)&iclog->ic_header; 3460 xhdr = iclog->ic_data;
3467 for (i = 0; i < len; i++) { 3461 for (i = 0; i < len; i++) {
3468 ophead = (xlog_op_header_t *)ptr; 3462 ophead = (xlog_op_header_t *)ptr;
3469 3463
diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
index b39a1980e82d..654167be0efb 100644
--- a/fs/xfs/xfs_log_priv.h
+++ b/fs/xfs/xfs_log_priv.h
@@ -310,6 +310,16 @@ typedef struct xlog_rec_ext_header {
310} xlog_rec_ext_header_t; 310} xlog_rec_ext_header_t;
311 311
312#ifdef __KERNEL__ 312#ifdef __KERNEL__
313
314/*
315 * Quite misnamed, because this union lays out the actual on-disk log buffer.
316 */
317typedef union xlog_in_core2 {
318 xlog_rec_header_t hic_header;
319 xlog_rec_ext_header_t hic_xheader;
320 char hic_sector[XLOG_HEADER_SIZE];
321} xlog_in_core_2_t;
322
313/* 323/*
314 * - A log record header is 512 bytes. There is plenty of room to grow the 324 * - A log record header is 512 bytes. There is plenty of room to grow the
315 * xlog_rec_header_t into the reserved space. 325 * xlog_rec_header_t into the reserved space.
@@ -339,7 +349,7 @@ typedef struct xlog_rec_ext_header {
339 * We'll put all the read-only and l_icloglock fields in the first cacheline, 349 * We'll put all the read-only and l_icloglock fields in the first cacheline,
340 * and move everything else out to subsequent cachelines. 350 * and move everything else out to subsequent cachelines.
341 */ 351 */
342typedef struct xlog_iclog_fields { 352typedef struct xlog_in_core {
343 sv_t ic_force_wait; 353 sv_t ic_force_wait;
344 sv_t ic_write_wait; 354 sv_t ic_write_wait;
345 struct xlog_in_core *ic_next; 355 struct xlog_in_core *ic_next;
@@ -362,41 +372,11 @@ typedef struct xlog_iclog_fields {
362 372
363 /* reference counts need their own cacheline */ 373 /* reference counts need their own cacheline */
364 atomic_t ic_refcnt ____cacheline_aligned_in_smp; 374 atomic_t ic_refcnt ____cacheline_aligned_in_smp;
365} xlog_iclog_fields_t; 375 xlog_in_core_2_t *ic_data;
366 376#define ic_header ic_data->hic_header
367typedef union xlog_in_core2 {
368 xlog_rec_header_t hic_header;
369 xlog_rec_ext_header_t hic_xheader;
370 char hic_sector[XLOG_HEADER_SIZE];
371} xlog_in_core_2_t;
372
373typedef struct xlog_in_core {
374 xlog_iclog_fields_t hic_fields;
375 xlog_in_core_2_t *hic_data;
376} xlog_in_core_t; 377} xlog_in_core_t;
377 378
378/* 379/*
379 * Defines to save our code from this glop.
380 */
381#define ic_force_wait hic_fields.ic_force_wait
382#define ic_write_wait hic_fields.ic_write_wait
383#define ic_next hic_fields.ic_next
384#define ic_prev hic_fields.ic_prev
385#define ic_bp hic_fields.ic_bp
386#define ic_log hic_fields.ic_log
387#define ic_callback hic_fields.ic_callback
388#define ic_callback_lock hic_fields.ic_callback_lock
389#define ic_callback_tail hic_fields.ic_callback_tail
390#define ic_trace hic_fields.ic_trace
391#define ic_size hic_fields.ic_size
392#define ic_offset hic_fields.ic_offset
393#define ic_refcnt hic_fields.ic_refcnt
394#define ic_bwritecnt hic_fields.ic_bwritecnt
395#define ic_state hic_fields.ic_state
396#define ic_datap hic_fields.ic_datap
397#define ic_header hic_data->hic_header
398
399/*
400 * The reservation head lsn is not made up of a cycle number and block number. 380 * The reservation head lsn is not made up of a cycle number and block number.
401 * Instead, it uses a cycle number and byte number. Logs don't expect to 381 * Instead, it uses a cycle number and byte number. Logs don't expect to
402 * overflow 31 bits worth of byte offset, so using a byte number will mean 382 * overflow 31 bits worth of byte offset, so using a byte number will mean
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index d94987915d5e..9abb96a7674d 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -3332,7 +3332,6 @@ xlog_pack_data(
3332 int size = iclog->ic_offset + roundoff; 3332 int size = iclog->ic_offset + roundoff;
3333 __be32 cycle_lsn; 3333 __be32 cycle_lsn;
3334 xfs_caddr_t dp; 3334 xfs_caddr_t dp;
3335 xlog_in_core_2_t *xhdr;
3336 3335
3337 xlog_pack_data_checksum(log, iclog, size); 3336 xlog_pack_data_checksum(log, iclog, size);
3338 3337
@@ -3347,7 +3346,8 @@ xlog_pack_data(
3347 } 3346 }
3348 3347
3349 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { 3348 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
3350 xhdr = (xlog_in_core_2_t *)&iclog->ic_header; 3349 xlog_in_core_2_t *xhdr = iclog->ic_data;
3350
3351 for ( ; i < BTOBB(size); i++) { 3351 for ( ; i < BTOBB(size); i++) {
3352 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); 3352 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
3353 k = i % (XLOG_HEADER_CYCLE_SIZE / BBSIZE); 3353 k = i % (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
@@ -3405,7 +3405,6 @@ xlog_unpack_data(
3405 xlog_t *log) 3405 xlog_t *log)
3406{ 3406{
3407 int i, j, k; 3407 int i, j, k;
3408 xlog_in_core_2_t *xhdr;
3409 3408
3410 for (i = 0; i < BTOBB(be32_to_cpu(rhead->h_len)) && 3409 for (i = 0; i < BTOBB(be32_to_cpu(rhead->h_len)) &&
3411 i < (XLOG_HEADER_CYCLE_SIZE / BBSIZE); i++) { 3410 i < (XLOG_HEADER_CYCLE_SIZE / BBSIZE); i++) {
@@ -3414,7 +3413,7 @@ xlog_unpack_data(
3414 } 3413 }
3415 3414
3416 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) { 3415 if (xfs_sb_version_haslogv2(&log->l_mp->m_sb)) {
3417 xhdr = (xlog_in_core_2_t *)rhead; 3416 xlog_in_core_2_t *xhdr = (xlog_in_core_2_t *)rhead;
3418 for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) { 3417 for ( ; i < BTOBB(be32_to_cpu(rhead->h_len)); i++) {
3419 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE); 3418 j = i / (XLOG_HEADER_CYCLE_SIZE / BBSIZE);
3420 k = i % (XLOG_HEADER_CYCLE_SIZE / BBSIZE); 3419 k = i % (XLOG_HEADER_CYCLE_SIZE / BBSIZE);