• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/xnu-2782.1.97/bsd/vfs/

Lines Matching refs:blhdr

225 	if (tr->blhdr != (block_list_header *)tr->tbuffer) {		\
226 panic("%s:%d: blhdr (%p) != tbuffer (%p)\n", __FILE__, __LINE__, tr->blhdr, tr->tbuffer); \
237 if (tr->blhdr && (tr->blhdr->max_blocks <= 0 || tr->blhdr->max_blocks > (tr->jnl->jhdr->size/tr->jnl->jhdr->jhdr_size))) { \
238 panic("%s:%d: tr blhdr max_blocks looks bad: %d\n", __FILE__, __LINE__, tr->blhdr->max_blocks); \
536 block_list_header *blhdr=NULL, *next_blhdr=NULL;
547 for (blhdr = tr->blhdr; blhdr; blhdr = next_blhdr) {
548 next_blhdr = (block_list_header *)((long)blhdr->binfo[0].bnum);
549 blhdr->binfo[0].bnum = 0xdeadc0de;
551 kmem_free(kernel_map, (vm_offset_t)blhdr, tr->tbuffer_size);
760 swap_block_list_header(journal *jnl, block_list_header *blhdr)
764 blhdr->max_blocks = SWAP16(blhdr->max_blocks);
765 blhdr->num_blocks = SWAP16(blhdr->num_blocks);
766 blhdr->bytes_used = SWAP32(blhdr->bytes_used);
767 blhdr->checksum = SWAP32(blhdr->checksum);
768 blhdr->flags = SWAP32(blhdr->flags);
770 if (blhdr->num_blocks >= ((jnl->jhdr->blhdr_size / sizeof(block_info)) - 1)) {
771 printf("jnl: %s: blhdr num blocks looks suspicious (%d / blhdr size %d). not swapping.\n", jnl->jdev_name, blhdr->num_blocks, jnl->jhdr->blhdr_size);
775 for(i = 0; i < blhdr->num_blocks; i++) {
776 blhdr->binfo[i].bnum = SWAP64(blhdr->binfo[i].bnum);
777 blhdr->binfo[i].u.bi.bsize = SWAP32(blhdr->binfo[i].u.bi.bsize);
778 blhdr->binfo[i].u.bi.b.cksum = SWAP32(blhdr->binfo[i].u.bi.b.cksum);
1118 block_list_header *blhdr;
1140 // allocate memory for the header_block. we'll read each blhdr into this
1174 blhdr = (block_list_header *)buff;
1176 orig_checksum = blhdr->checksum;
1177 blhdr->checksum = 0;
1182 checksum = calc_checksum((char *)blhdr, BLHDR_CHECKSUM_SIZE);
1183 swap_block_list_header(jnl, blhdr);
1185 checksum = calc_checksum((char *)blhdr, BLHDR_CHECKSUM_SIZE);
1220 && (blhdr->binfo[0].u.bi.b.sequence_num != 0)
1221 && (blhdr->binfo[0].u.bi.b.sequence_num != last_sequence_num)
1222 && (blhdr->binfo[0].u.bi.b.sequence_num != last_sequence_num+1)) {
1229 jnl->jdev_name, blhdr_offset, blhdr_offset, blhdr->binfo[0].u.bi.b.sequence_num, last_sequence_num);
1234 jnl->jdev_name, blhdr_offset, blhdr_offset, blhdr->binfo[0].u.bi.b.sequence_num, last_sequence_num);
1238 last_sequence_num = blhdr->binfo[0].u.bi.b.sequence_num;
1253 if ( blhdr->max_blocks <= 0 || blhdr->max_blocks > (jnl->jhdr->size/jnl->jhdr->jhdr_size)
1254 || blhdr->num_blocks <= 0 || blhdr->num_blocks > blhdr->max_blocks) {
1256 jnl->jdev_name, blhdr->max_blocks, blhdr->num_blocks);
1262 for (i = 1; i < blhdr->num_blocks; i++) {
1263 if (blhdr->binfo[i].bnum < 0 && blhdr->binfo[i].bnum != (off_t)-1) {
1264 printf("jnl: %s: replay_journal: bogus block number 0x%llx\n", jnl->jdev_name, blhdr->binfo[i].bnum);
1269 if ((size_t)blhdr->binfo[i].u.bi.bsize > max_bsize) {
1270 max_bsize = blhdr->binfo[i].u.bi.bsize;
1274 if (blhdr->flags & BLHDR_CHECK_CHECKSUMS) {
1283 if (blhdr->flags & BLHDR_FIRST_HEADER) {
1288 // blhdr->num_blocks-1, jnl->jhdr->start);
1290 for (i = 1; i < blhdr->num_blocks; i++) {
1294 size = blhdr->binfo[i].u.bi.bsize;
1295 number = blhdr->binfo[i].bnum;
1319 // it got swapped when the blhdr was read in.
1320 if (blhdr->binfo[i].u.bi.b.cksum != 0 && disk_cksum != blhdr->binfo[i].u.bi.b.cksum) {
1321 printf("jnl: %s: txn starting at %lld (%lld) @ index %3d bnum %lld (%d) with disk cksum != blhdr cksum (0x%.8x 0x%.8x)\n",
1322 jnl->jdev_name, txn_start_offset, blhdr_offset, i, number, size, disk_cksum, blhdr->binfo[i].u.bi.b.cksum);
1335 ret_val = add_block(jnl, &co_buf, number, size, (size_t) offset, blhdr->binfo[i].u.bi.b.cksum, &num_buckets, &num_full);
1389 jnl->jhdr->start += blhdr->bytes_used;
1500 // size of the blhdr. It assumes that jnl->jhdr->size
2057 printf("jnl: %s: open: jhdr size and blhdr size are not compatible (0x%llx, %d, %d)\n", jdev_name, jnl->jhdr->size,
2325 printf(" blhdr size: %d\n", jnl->jhdr->blhdr_size);
2512 tr->blhdr = (block_list_header *)tr->tbuffer;
2513 tr->blhdr->max_blocks = (jnl->jhdr->blhdr_size / sizeof(block_info)) - 1;
2514 tr->blhdr->num_blocks = 1; // accounts for this header block
2515 tr->blhdr->bytes_used = jnl->jhdr->blhdr_size;
2516 tr->blhdr->flags = BLHDR_CHECK_CHECKSUMS | BLHDR_FIRST_HEADER;
2712 block_list_header *blhdr;
2747 for (blhdr = tr->blhdr; blhdr; blhdr = (block_list_header *)((long)blhdr->binfo[0].bnum)) {
2748 for (i = 1; i < blhdr->num_blocks; i++) {
2749 if (bp == blhdr->binfo[i].u.bp) {
2754 if (i < blhdr->num_blocks) {
2760 // if blhdr is null, then this block has only had modify_block_start
2763 // modified. if blhdr is non-null then modify_block_end was called
2766 if (blhdr == NULL) {
2780 block_list_header *blhdr, *prev=NULL;
2809 for (blhdr = tr->blhdr; blhdr; prev = blhdr, blhdr = (block_list_header *)((long)blhdr->binfo[0].bnum)) {
2812 for (i = 1; i < blhdr->num_blocks; i++) {
2813 if (bp == blhdr->binfo[i].u.bp) {
2816 if (blhdr->binfo[i].bnum != (off_t)-1) {
2817 tbuffer_offset += buf_size(blhdr->binfo[i].u.bp);
2819 tbuffer_offset += blhdr->binfo[i].u.bi.bsize;
2823 if (i < blhdr->num_blocks) {
2828 if (blhdr == NULL
2832 blhdr = prev;
2834 } else if (blhdr == NULL) {
2870 blhdr = nblhdr;
2876 if ((i+1) > blhdr->max_blocks) {
2877 panic("jnl: modify_block_end: i = %d, max_blocks %d\n", i, blhdr->max_blocks);
2881 if (i >= blhdr->num_blocks) {
2889 blhdr->binfo[i].bnum = (off_t)(buf_blkno(bp));
2890 blhdr->binfo[i].u.bp = bp;
2892 KERNEL_DEBUG_CONSTANT(0x3018004, VM_KERNEL_ADDRPERM(vp), blhdr->binfo[i].bnum, bsize, 0, 0);
2903 blhdr->bytes_used += bsize;
2906 blhdr->num_blocks++;
2918 block_list_header *blhdr;
2946 for (blhdr = tr->blhdr; blhdr; blhdr = (block_list_header *)((long)blhdr->binfo[0].bnum)) {
2948 for (i = 1; i < blhdr->num_blocks; i++) {
2949 if (bp == blhdr->binfo[i].u.bp) {
2968 blhdr->binfo[i].bnum = (off_t)-1;
2969 blhdr->binfo[i].u.bp = NULL;
2970 blhdr->binfo[i].u.bi.bsize = buf_size(bp);
2979 if (i < blhdr->num_blocks) {
3729 block_list_header *blhdr=NULL, *next=NULL;
3866 for (blhdr = tr->blhdr; blhdr; blhdr = next) {
3873 for (i = 1; i < blhdr->num_blocks; i++) {
3875 if (blhdr->binfo[i].bnum != (off_t)-1) {
3879 bp = blhdr->binfo[i].u.bp;
3883 blhdr->binfo[i].bnum, jnl, tr);
3912 blhdr->binfo[i].bnum = (off_t)-1;
3922 blkptr = (char *)&((char *)blhdr)[tbuffer_offset];
3949 blhdr->binfo[i].u.bp = sbp;
3953 bsize = blhdr->binfo[i].u.bi.bsize;
3957 next = (block_list_header *)((long)blhdr->binfo[0].bnum);
4038 block_list_header *blhdr=NULL, *next=NULL;
4047 for (blhdr = tr->blhdr; blhdr; blhdr = (block_list_header *)((long)blhdr->binfo[0].bnum)) {
4050 amt = blhdr->bytes_used;
4052 blhdr->binfo[0].u.bi.b.sequence_num = tr->sequence_num;
4054 blhdr->checksum = 0;
4055 blhdr->checksum = calc_checksum((char *)blhdr, BLHDR_CHECKSUM_SIZE);
4067 if (kmem_alloc(kernel_map, (vm_offset_t *)&bparray, blhdr->num_blocks * sizeof(struct buf *))) {
4068 panic("can't allocate %zd bytes for bparray\n", blhdr->num_blocks * sizeof(struct buf *));
4075 for (i = 1; i < blhdr->num_blocks; i++) {
4084 if (blhdr->binfo[i].bnum != (off_t)-1) {
4088 bp = blhdr->binfo[i].u.bp;
4127 blhdr->binfo[i].bnum = (off_t)(blkno);
4145 blhdr->binfo[i].u.bi.bsize = bsize;
4146 blhdr->binfo[i].u.bi.b.cksum = calc_checksum(&((char *)blhdr)[tbuffer_offset], bsize);
4149 bsize = blhdr->binfo[i].u.bi.bsize;
4150 blhdr->binfo[i].u.bi.b.cksum = 0;
4162 ret = write_journal_data(jnl, &end, blhdr, amt);
4169 for (i = 1; i < blhdr->num_blocks; i++)
4170 blhdr->binfo[i].u.bp = bparray[i];
4172 kmem_free(kernel_map, (vm_offset_t)bparray, blhdr->num_blocks * sizeof(struct buf *));
4222 // setup for looping through all the blhdr's.
4224 for (blhdr = tr->blhdr; blhdr; blhdr = next) {
4229 * once the last one goes out, its possible for blhdr
4232 * grab the next blhdr pointer...
4234 next = (block_list_header *)((long)blhdr->binfo[0].bnum);
4235 num_blocks = blhdr->num_blocks;
4240 qsort(&blhdr->binfo[1], num_blocks-1, sizeof(block_info), journal_binfo_cmp);
4244 * does not touch blhdr once the last buf_bawrite has been
4250 if (blhdr->binfo[i].bnum != (off_t)-1)
4256 if ((bp = blhdr->binfo[i].u.bp)) {
4369 block_list_header *blhdr, *next;
4383 for (blhdr = tr->blhdr; blhdr; blhdr = next) {
4386 for (i = 1; i < blhdr->num_blocks; i++) {
4391 if (blhdr->binfo[i].bnum == (off_t)-1)
4394 tbp = blhdr->binfo[i].u.bp;
4434 jnl->jdev_name, blhdr->binfo[i].bnum, tbp);
4443 next = (block_list_header *)((long)blhdr->binfo[0].bnum);
4445 // we can free blhdr here since we won't need it any more
4446 blhdr->binfo[0].bnum = 0xdeadc0de;
4447 kmem_free(kernel_map, (vm_offset_t)blhdr, tr->tbuffer_size);
4468 tr->blhdr = NULL;