Lines Matching refs:sf
864 struct btrfsic_stack_frame *sf; in btrfsic_stack_frame_alloc() local
866 sf = kzalloc(sizeof(*sf), GFP_NOFS); in btrfsic_stack_frame_alloc()
867 if (sf) in btrfsic_stack_frame_alloc()
868 sf->magic = BTRFSIC_BLOCK_STACK_FRAME_MAGIC_NUMBER; in btrfsic_stack_frame_alloc()
869 return sf; in btrfsic_stack_frame_alloc()
872 static void btrfsic_stack_frame_free(struct btrfsic_stack_frame *sf) in btrfsic_stack_frame_free() argument
874 BUG_ON(!(NULL == sf || in btrfsic_stack_frame_free()
875 BTRFSIC_BLOCK_STACK_FRAME_MAGIC_NUMBER == sf->magic)); in btrfsic_stack_frame_free()
876 kfree(sf); in btrfsic_stack_frame_free()
886 struct btrfsic_stack_frame *sf; in btrfsic_process_metablock() local
892 sf = &initial_stack_frame; in btrfsic_process_metablock()
893 sf->error = 0; in btrfsic_process_metablock()
894 sf->i = -1; in btrfsic_process_metablock()
895 sf->limit_nesting = first_limit_nesting; in btrfsic_process_metablock()
896 sf->block = first_block; in btrfsic_process_metablock()
897 sf->block_ctx = first_block_ctx; in btrfsic_process_metablock()
898 sf->next_block = NULL; in btrfsic_process_metablock()
899 sf->hdr = first_hdr; in btrfsic_process_metablock()
900 sf->prev = NULL; in btrfsic_process_metablock()
903 sf->block->generation = btrfs_stack_header_generation(sf->hdr); in btrfsic_process_metablock()
904 if (0 == sf->hdr->level) { in btrfsic_process_metablock()
906 (struct btrfs_leaf *)sf->hdr; in btrfsic_process_metablock()
908 if (-1 == sf->i) { in btrfsic_process_metablock()
909 sf->nr = btrfs_stack_header_nritems(&leafhdr->header); in btrfsic_process_metablock()
913 sf->block_ctx->start, sf->nr, in btrfsic_process_metablock()
921 if (0 == sf->num_copies || sf->mirror_num > sf->num_copies) { in btrfsic_process_metablock()
922 sf->i++; in btrfsic_process_metablock()
923 sf->num_copies = 0; in btrfsic_process_metablock()
926 if (sf->i < sf->nr) { in btrfsic_process_metablock()
929 (uintptr_t)(leafhdr->items + sf->i) - in btrfsic_process_metablock()
937 sf->block_ctx->len) { in btrfsic_process_metablock()
941 sf->block_ctx->start, in btrfsic_process_metablock()
942 sf->block_ctx->dev->bdev); in btrfsic_process_metablock()
945 btrfsic_read_from_block_data(sf->block_ctx, in btrfsic_process_metablock()
962 sf->block_ctx->len) in btrfsic_process_metablock()
965 sf->block_ctx, &root_item, in btrfsic_process_metablock()
970 sf->error = in btrfsic_process_metablock()
973 sf->block, in btrfsic_process_metablock()
974 sf->block_ctx, in btrfsic_process_metablock()
976 sf->limit_nesting, in btrfsic_process_metablock()
977 &sf->next_block_ctx, in btrfsic_process_metablock()
978 &sf->next_block, in btrfsic_process_metablock()
980 &sf->num_copies, in btrfsic_process_metablock()
981 &sf->mirror_num, in btrfsic_process_metablock()
985 if (sf->error) in btrfsic_process_metablock()
988 if (NULL != sf->next_block) { in btrfsic_process_metablock()
991 sf->next_block_ctx.datav[0]; in btrfsic_process_metablock()
996 sf->error = -1; in btrfsic_process_metablock()
998 &sf-> in btrfsic_process_metablock()
1004 next_stack->block = sf->next_block; in btrfsic_process_metablock()
1006 &sf->next_block_ctx; in btrfsic_process_metablock()
1010 sf->limit_nesting - 1; in btrfsic_process_metablock()
1011 next_stack->prev = sf; in btrfsic_process_metablock()
1012 sf = next_stack; in btrfsic_process_metablock()
1017 sf->error = btrfsic_handle_extent_data( in btrfsic_process_metablock()
1019 sf->block, in btrfsic_process_metablock()
1020 sf->block_ctx, in btrfsic_process_metablock()
1023 if (sf->error) in btrfsic_process_metablock()
1030 struct btrfs_node *const nodehdr = (struct btrfs_node *)sf->hdr; in btrfsic_process_metablock()
1032 if (-1 == sf->i) { in btrfsic_process_metablock()
1033 sf->nr = btrfs_stack_header_nritems(&nodehdr->header); in btrfsic_process_metablock()
1037 sf->block_ctx->start, in btrfsic_process_metablock()
1038 nodehdr->header.level, sf->nr, in btrfsic_process_metablock()
1046 if (0 == sf->num_copies || sf->mirror_num > sf->num_copies) { in btrfsic_process_metablock()
1047 sf->i++; in btrfsic_process_metablock()
1048 sf->num_copies = 0; in btrfsic_process_metablock()
1051 if (sf->i < sf->nr) { in btrfsic_process_metablock()
1056 key_ptr_offset = (uintptr_t)(nodehdr->ptrs + sf->i) - in btrfsic_process_metablock()
1059 sf->block_ctx->len) { in btrfsic_process_metablock()
1062 sf->block_ctx->start, in btrfsic_process_metablock()
1063 sf->block_ctx->dev->bdev); in btrfsic_process_metablock()
1067 sf->block_ctx, &key_ptr, key_ptr_offset, in btrfsic_process_metablock()
1071 sf->error = btrfsic_create_link_to_next_block( in btrfsic_process_metablock()
1073 sf->block, in btrfsic_process_metablock()
1074 sf->block_ctx, in btrfsic_process_metablock()
1076 sf->limit_nesting, in btrfsic_process_metablock()
1077 &sf->next_block_ctx, in btrfsic_process_metablock()
1078 &sf->next_block, in btrfsic_process_metablock()
1080 &sf->num_copies, in btrfsic_process_metablock()
1081 &sf->mirror_num, in btrfsic_process_metablock()
1084 if (sf->error) in btrfsic_process_metablock()
1087 if (NULL != sf->next_block) { in btrfsic_process_metablock()
1090 sf->next_block_ctx.datav[0]; in btrfsic_process_metablock()
1094 sf->error = -1; in btrfsic_process_metablock()
1099 next_stack->block = sf->next_block; in btrfsic_process_metablock()
1100 next_stack->block_ctx = &sf->next_block_ctx; in btrfsic_process_metablock()
1104 sf->limit_nesting - 1; in btrfsic_process_metablock()
1105 next_stack->prev = sf; in btrfsic_process_metablock()
1106 sf = next_stack; in btrfsic_process_metablock()
1115 if (NULL != sf->prev) { in btrfsic_process_metablock()
1116 struct btrfsic_stack_frame *const prev = sf->prev; in btrfsic_process_metablock()
1119 btrfsic_release_block_ctx(sf->block_ctx); in btrfsic_process_metablock()
1121 if (sf->error) { in btrfsic_process_metablock()
1122 prev->error = sf->error; in btrfsic_process_metablock()
1123 btrfsic_stack_frame_free(sf); in btrfsic_process_metablock()
1124 sf = prev; in btrfsic_process_metablock()
1128 btrfsic_stack_frame_free(sf); in btrfsic_process_metablock()
1129 sf = prev; in btrfsic_process_metablock()
1132 BUG_ON(&initial_stack_frame != sf); in btrfsic_process_metablock()
1135 return sf->error; in btrfsic_process_metablock()