View Incident:
http://co-op.engr.sgi.com/BugWorks/code/bwxquery.cgi?search=Search&wlong=1&view_type=Bug&wi=802017
Status : open Priority : 3
Assigned Engineer : dxm Submitter : dxm
*Modified User : dxm *Modified User Domain : engr
*Description :
I haven't seen this problem for ages on my 64Mb crash box,
but the problem is still there.
I installed XFS on my home machine last night and was very
happy with its performance (P100, 32Mb RAM, 32Gb disk) until
I tried to cleanly remount my XFS partition and tripped an
ASSERT in xlog_get_bp.
My home machine is very tight on memory, but I don't think
it's an unreasonable machine to try to run XFS on. Unfortunately,
.....
==========================
ADDITIONAL INFORMATION (ADD)
From: dxm@engr (BugWorks)
Date: Sep 19 2000 06:14:03PM
==========================
This patch removes the need for xfs_log_recover.c to allocate
large buffers. All log access except for the actual recovery
is done with single block reads and writes (the recovery
uses 32k buffers, but these are used in normal XFS operation
too).
The largest allocation and read/write before was 256 blocks
(128k). On most remounts, the code now does 256 writes and
less than 300 reads.
(I'd suggest that the simplicity of the code is an ok trade-off
against the inefficiency)
33c33
< #ident "$Revision: 1.189 $"
---
> #ident "$Revision: 1.188 $"
296a297
>
298,301c299,303
< xlog_find_verify_cycle(xfs_caddr_t *bap, /* update ptr as we go
*/
< xfs_daddr_t start_blk,
< int nbblks,
< uint stop_on_cycle_no)
---
> xlog_find_verify_cycle(
> xlog_t *log,
> xfs_daddr_t start_blk,
> int nbblks,
> uint stop_on_cycle_no)
303,311c305,322
< int i;
< uint cycle;
<
< for (i=0; i<nbblks; i++) {
< cycle = GET_CYCLE(*bap, ARCH_CONVERT);
< if (cycle != stop_on_cycle_no) {
< (*bap) += BBSIZE;
< } else {
< return (start_blk+i);
---
> int i;
> uint cycle;
> xfs_buf_t *bp;
> int error = 0;
>
> bp = xlog_get_bp(1, log->l_mp);
> if (!bp)
> return -ENOMEM;
>
> for (i=start_blk; i< start_blk + nbblks; i++) {
> error = xlog_bread(log, i, 1, bp);
> if (error)
> goto out;
>
> cycle = GET_CYCLE(XFS_BUF_PTR(bp), ARCH_CONVERT);
> if (cycle == stop_on_cycle_no) {
> error = i;
> goto out;
314c325,331
< return -1;
---
>
> error = -1;
>
> out:
> xlog_put_bp(bp);
>
> return error;
329a347
>
331c349,350
< xlog_find_verify_log_record(xfs_caddr_t ba, /* update ptr as
we go */
---
> xlog_find_verify_log_record(
> xlog_t *log,
336,337c355,358
< xlog_rec_header_t *rhead;
< xfs_daddr_t i;
---
> xfs_daddr_t i;
> xfs_buf_t *bp;
> xlog_rec_header_t *head;
> int error = 0;
341c362,365
< ba -= BBSIZE;
---
> bp = xlog_get_bp(1, log->l_mp);
> if (!bp)
> return -ENOMEM;
>
347c371,372
< return XFS_ERROR(EIO);
---
> error = XFS_ERROR(EIO);
> goto out;
349c374,380
< if (INT_GET(*(uint *)ba, ARCH_CONVERT) == XLOG_HEADER_MAGIC_NUM) {
---
>
> error = xlog_bread(log, i, 1, bp);
> if (error)
> goto out;
> head = (xlog_rec_header_t*)XFS_BUF_PTR(bp);
>
> if (INT_GET(head->h_magicno, ARCH_CONVERT) == XLOG_HEADER_MAGIC_NUM)
351,352d381
< }
< ba -= BBSIZE;
360,361c389,392
< if (i == -1)
< return -1;
---
> if (i == -1) {
> error = -1;
> goto out;
> }
370,371c401,402
< rhead = (xlog_rec_header_t *)ba;
< if (*last_blk - i + extra_bblks != BTOBB(INT_GET(rhead->h_len,
ARCH_CONVERT))+1)
---
> if (*last_blk - i + extra_bblks
> != BTOBB(INT_GET(head->h_len, ARCH_CONVERT))+1)
373c404,408
< return 0;
---
>
> out:
> xlog_put_bp(bp);
>
> return error;
396c431
< xfs_buf_t *bp, *big_bp;
---
> xfs_buf_t *bp;
401d435
< xfs_caddr_t ba;
498,503d531
< big_bp = xlog_get_bp(num_scan_bblks,log->l_mp);
< if (!big_bp) {
< error = -ENOMEM;
< goto bp_err;
< }
<
510,513c538
< if (error = xlog_bread(log, start_blk, num_scan_bblks, big_bp))
< goto big_bp_err;
< ba = XFS_BUF_PTR(big_bp);
< new_blk = xlog_find_verify_cycle(&ba, start_blk, num_scan_bblks,
---
> new_blk = xlog_find_verify_cycle(log, start_blk, num_scan_bblks,
545,549c570
< if (error = xlog_bread(log, start_blk,
< num_scan_bblks-(int)head_blk, big_bp))
< goto big_bp_err;
< ba = XFS_BUF_PTR(big_bp);
< new_blk= xlog_find_verify_cycle(&ba, start_blk,
---
> new_blk= xlog_find_verify_cycle(log, start_blk,
563,566c584
< if (error = xlog_bread(log, start_blk, (int) head_blk, big_bp))
< goto big_bp_err;
< ba = XFS_BUF_PTR(big_bp);
< new_blk = xlog_find_verify_cycle(&ba, start_blk, (int) head_blk,
---
> new_blk = xlog_find_verify_cycle(log, start_blk, (int) head_blk,
580,581d597
< if (error = xlog_bread(log, start_blk, num_scan_bblks, big_bp))
< goto big_bp_err;
584,585c600
< ba = XFS_BUF_PTR(big_bp) + XLOG_MAX_RECORD_BSIZE;
< if ((error = xlog_find_verify_log_record(ba,
---
> if ((error = xlog_find_verify_log_record(log,
590c605
< goto big_bp_err;
---
> goto bp_err;
592c607
< goto big_bp_err;
---
> goto bp_err;
596,599c611
< if (error = xlog_bread(log, start_blk, (int)head_blk, big_bp))
< goto big_bp_err;
< ba = XFS_BUF_PTR(big_bp) + BBTOB(head_blk);
< if ((error = xlog_find_verify_log_record(ba,
---
> if ((error = xlog_find_verify_log_record(log,
607,610d618
< if (error = xlog_bread(log, start_blk, log_bbnum - (int)start_blk,
< big_bp))
< goto big_bp_err;
< ba = XFS_BUF_PTR(big_bp) + BBTOB(log_bbnum - start_blk);
612c620
< if ((error = xlog_find_verify_log_record(ba,
---
> if ((error = xlog_find_verify_log_record(log,
617c625
< goto big_bp_err;
---
> goto bp_err;
619c627
< goto big_bp_err;
---
> goto bp_err;
623c631
< goto big_bp_err;
---
> goto bp_err;
626d633
< xlog_put_bp(big_bp);
640,641d646
< big_bp_err:
< xlog_put_bp(big_bp);
910,911c915,916
< xfs_buf_t *bp, *big_bp;
< uint first_cycle, last_cycle;
---
> xfs_buf_t *bp;
> uint first_cycle, last_cycle;
913,915c918,919
< xfs_daddr_t num_scan_bblks;
< xfs_caddr_t ba;
< int error, log_bbnum = log->l_logBBsize;
---
> xfs_daddr_t num_scan_bblks;
> int error, log_bbnum = log->l_logBBsize;
961,966d964
< big_bp = xlog_get_bp((int)num_scan_bblks,log->l_mp);
< if (!big_bp) {
< error = -ENOMEM;
< goto bp_err;
< }
< ASSERT(big_bp);
971,975c969
<
< if (error = xlog_bread(log, start_blk, (int)num_scan_bblks, big_bp))
< goto big_bp_err;
< ba = XFS_BUF_PTR(big_bp);
<
---
>
982c976
< new_blk = xlog_find_verify_cycle(&ba, start_blk,
---
> new_blk = xlog_find_verify_cycle(log, start_blk,
991,992c985,987
< if (error = xlog_find_verify_log_record(ba, start_blk, &last_blk, 0))
< goto big_bp_err;
---
> if (error = xlog_find_verify_log_record(log, start_blk,
> &last_blk, 0))
> goto bp_err;
995,996d989
< big_bp_err:
< xlog_put_bp(big_bp);
1017,1018c1010
< int tail_block,
< xfs_buf_t *bp)
---
> int tail_block)
1022d1013
< int curr_block;
1023a1015,1017
> xfs_buf_t *bp;
>
> error = 0;
1024a1019,1021
> bp = xlog_get_bp(1, log->l_mp);
> if (!bp)
> return -ENOMEM;
1026,1040d1022
< curr_block = start_block;
< for (i = 0; i < blocks; i++) {
< INT_SET(recp->h_magicno, ARCH_CONVERT, XLOG_HEADER_MAGIC_NUM);
< INT_SET(recp->h_cycle, ARCH_CONVERT, cycle);
< INT_SET(recp->h_version, ARCH_CONVERT, 1);
< INT_ZERO(recp->h_len, ARCH_CONVERT);
< ASSIGN_ANY_LSN(recp->h_lsn, cycle, curr_block, ARCH_CONVERT);
< ASSIGN_ANY_LSN(recp->h_tail_lsn, tail_cycle, tail_block,
ARCH_CONVERT);
< INT_ZERO(recp->h_chksum, ARCH_CONVERT);
< INT_ZERO(recp->h_prev_block, ARCH_CONVERT); /* unused */
< INT_ZERO(recp->h_num_logops, ARCH_CONVERT);
<
< curr_block++;
< recp = (xlog_rec_header_t*)(((char *)recp) + BBSIZE);
< }
1042c1024,1039
< error = xlog_bwrite(log, start_block, blocks, bp);
---
> INT_SET(recp->h_magicno, ARCH_CONVERT, XLOG_HEADER_MAGIC_NUM);
> INT_SET(recp->h_cycle, ARCH_CONVERT, cycle);
> INT_SET(recp->h_version, ARCH_CONVERT, 1);
> INT_ZERO(recp->h_len, ARCH_CONVERT);
> ASSIGN_ANY_LSN(recp->h_tail_lsn, tail_cycle, tail_block,
> ARCH_CONVERT);
> INT_ZERO(recp->h_chksum, ARCH_CONVERT);
> INT_ZERO(recp->h_prev_block, ARCH_CONVERT); /* unused */
> INT_ZERO(recp->h_num_logops, ARCH_CONVERT);
>
> for (i = start_block; i < start_block + blocks; i++) {
> ASSIGN_ANY_LSN(recp->h_lsn, cycle, i, ARCH_CONVERT);
> error = xlog_bwrite(log, i, 1, bp);
> if (error)
> break;
> }
> xlog_put_bp(bp);
1075d1071
< xfs_buf_t *bp;
1130,1132d1125
< bp = xlog_get_bp(max_distance,log->l_mp);
< if (!bp)
< return -ENOMEM;
1144,1148c1137
< tail_block, bp);
< if (error) {
< xlog_put_bp(bp);
< return error;
< }
---
> tail_block);
1160,1164c1149
< tail_block, bp);
< if (error) {
< xlog_put_bp(bp);
< return error;
< }
---
> tail_block);
1176,1180c1161
< tail_cycle, tail_block, bp);
< if (error) {
< xlog_put_bp(bp);
< return error;
< }
---
> tail_cycle, tail_block);
1182,1183d1162
<
< xlog_put_bp(bp);
|