90
90
eb->h_fs_generation = bswap_32(eb->h_fs_generation);
91
91
eb->h_blkno = bswap_64(eb->h_blkno);
92
92
eb->h_next_leaf_blk = bswap_64(eb->h_next_leaf_blk);
93
eb->h_suballoc_loc = bswap_64(eb->h_suballoc_loc);
95
96
void ocfs2_swap_extent_block_from_cpu(ocfs2_filesys *fs,
554
errcode_t ocfs2_extent_iterate_dx_root(ocfs2_filesys *fs,
555
struct ocfs2_dx_root_block *dx_root,
558
int (*func)(ocfs2_filesys *fs,
559
struct ocfs2_extent_rec *rec,
569
struct ocfs2_extent_list *el;
571
struct extent_context ctxt;
573
if (dx_root->dr_flags & OCFS2_DX_FLAG_INLINE)
574
return OCFS2_ET_INODE_CANNOT_BE_ITERATED;
576
el = &dx_root->dr_list;
577
if (el->l_tree_depth) {
578
ret = ocfs2_malloc0(sizeof(char *) * el->l_tree_depth,
584
ctxt.eb_bufs[0] = block_buf;
586
ret = ocfs2_malloc0(fs->fs_blocksize *
593
for (i = 1; i < el->l_tree_depth; i++) {
594
ctxt.eb_bufs[i] = ctxt.eb_bufs[0] +
595
i * fs->fs_blocksize;
603
ctxt.priv_data = priv_data;
606
ctxt.last_eb_blkno = 0;
607
ctxt.last_eb_cpos = 0;
610
iret |= extent_iterate_el(el, 0, &ctxt);
611
if (iret & OCFS2_EXTENT_ERROR)
614
if (iret & OCFS2_EXTENT_ABORT)
617
/* we can only trust ctxt.last_eb_blkno if we walked the whole tree */
618
if (dx_root->dr_last_eb_blk != ctxt.last_eb_blkno) {
619
dx_root->dr_last_eb_blk = ctxt.last_eb_blkno;
620
iret |= OCFS2_EXTENT_CHANGED;
626
* This block needs to be fixed up for write support.
628
if (!ret && (iret & OCFS2_EXTENT_CHANGED))
629
ret = ocfs2_write_inode(fs, inode->i_blkno, (char *)inode);
634
if (!block_buf && ctxt.eb_bufs[0])
635
ocfs2_free(&ctxt.eb_bufs[0]);
636
ocfs2_free(&ctxt.eb_bufs);
553
643
errcode_t ocfs2_extent_iterate(ocfs2_filesys *fs,