Lines Matching refs:sb
24 static int befs_find_brun_direct(struct super_block *sb,
28 static int befs_find_brun_indirect(struct super_block *sb,
33 static int befs_find_brun_dblindirect(struct super_block *sb,
49 befs_read_datastream(struct super_block *sb, const befs_data_stream *ds, in befs_read_datastream() argument
56 befs_debug(sb, "---> %s %llu", __func__, pos); in befs_read_datastream()
57 block = pos >> BEFS_SB(sb)->block_shift; in befs_read_datastream()
59 *off = pos - (block << BEFS_SB(sb)->block_shift); in befs_read_datastream()
61 if (befs_fblock2brun(sb, ds, block, &run) != BEFS_OK) { in befs_read_datastream()
62 befs_error(sb, "BeFS: Error finding disk addr of block %lu", in befs_read_datastream()
64 befs_debug(sb, "<--- %s ERROR", __func__); in befs_read_datastream()
67 bh = befs_bread_iaddr(sb, run); in befs_read_datastream()
69 befs_error(sb, "BeFS: Error reading block %lu from datastream", in befs_read_datastream()
74 befs_debug(sb, "<--- %s read data, starting at %llu", __func__, pos); in befs_read_datastream()
95 befs_fblock2brun(struct super_block *sb, const befs_data_stream *data, in befs_fblock2brun() argument
99 befs_off_t pos = fblock << BEFS_SB(sb)->block_shift; in befs_fblock2brun()
102 err = befs_find_brun_direct(sb, data, fblock, run); in befs_fblock2brun()
105 err = befs_find_brun_indirect(sb, data, fblock, run); in befs_fblock2brun()
108 err = befs_find_brun_dblindirect(sb, data, fblock, run); in befs_fblock2brun()
111 befs_error(sb, in befs_fblock2brun()
130 befs_read_lsymlink(struct super_block *sb, const befs_data_stream *ds, in befs_read_lsymlink() argument
137 befs_debug(sb, "---> %s length: %llu", __func__, len); in befs_read_lsymlink()
140 bh = befs_read_datastream(sb, ds, bytes_read, NULL); in befs_read_lsymlink()
142 befs_error(sb, "BeFS: Error reading datastream block " in befs_read_lsymlink()
144 befs_debug(sb, "<--- %s ERROR", __func__); in befs_read_lsymlink()
148 plen = ((bytes_read + BEFS_SB(sb)->block_size) < len) ? in befs_read_lsymlink()
149 BEFS_SB(sb)->block_size : len - bytes_read; in befs_read_lsymlink()
155 befs_debug(sb, "<--- %s read %u bytes", __func__, (unsigned int) in befs_read_lsymlink()
172 befs_count_blocks(struct super_block *sb, const befs_data_stream *ds) in befs_count_blocks() argument
177 struct befs_sb_info *befs_sb = BEFS_SB(sb); in befs_count_blocks()
179 befs_debug(sb, "---> %s", __func__); in befs_count_blocks()
209 indirblocks = dbl_bruns / befs_iaddrs_per_block(sb); in befs_count_blocks()
216 befs_debug(sb, "<--- %s %u blocks", __func__, (unsigned int)blocks); in befs_count_blocks()
251 befs_find_brun_direct(struct super_block *sb, const befs_data_stream *data, in befs_find_brun_direct() argument
258 befs_debug(sb, "---> %s, find %lu", __func__, (unsigned long)blockno); in befs_find_brun_direct()
269 befs_debug(sb, "---> %s, " in befs_find_brun_direct()
276 befs_error(sb, "%s failed to find file block %lu", __func__, in befs_find_brun_direct()
278 befs_debug(sb, "---> %s ERROR", __func__); in befs_find_brun_direct()
305 befs_find_brun_indirect(struct super_block *sb, in befs_find_brun_indirect() argument
318 befs_blocknr_t indirblockno = iaddr2blockno(sb, &indirect); in befs_find_brun_indirect()
319 int arraylen = befs_iaddrs_per_block(sb); in befs_find_brun_indirect()
321 befs_debug(sb, "---> %s, find %lu", __func__, (unsigned long)blockno); in befs_find_brun_indirect()
323 indir_start_blk = data->max_direct_range >> BEFS_SB(sb)->block_shift; in befs_find_brun_indirect()
328 indirblock = sb_bread(sb, indirblockno + i); in befs_find_brun_indirect()
330 befs_error(sb, "---> %s failed to read " in befs_find_brun_indirect()
333 befs_debug(sb, "<--- %s ERROR", __func__); in befs_find_brun_indirect()
340 int len = fs16_to_cpu(sb, array[j].len); in befs_find_brun_indirect()
345 fs32_to_cpu(sb, array[j].allocation_group); in befs_find_brun_indirect()
347 fs16_to_cpu(sb, array[j].start) + offset; in befs_find_brun_indirect()
349 fs16_to_cpu(sb, array[j].len) - offset; in befs_find_brun_indirect()
352 befs_debug(sb, in befs_find_brun_indirect()
366 befs_error(sb, "BeFS: %s failed to find " in befs_find_brun_indirect()
369 befs_debug(sb, "<--- %s ERROR", __func__); in befs_find_brun_indirect()
414 befs_find_brun_dblindirect(struct super_block *sb, in befs_find_brun_dblindirect() argument
434 data->max_indirect_range >> BEFS_SB(sb)->block_shift; in befs_find_brun_dblindirect()
446 size_t diblklen = iblklen * befs_iaddrs_per_block(sb) in befs_find_brun_dblindirect()
449 befs_debug(sb, "---> %s find %lu", __func__, (unsigned long)blockno); in befs_find_brun_dblindirect()
462 dbl_which_block = dblindir_indx / befs_iaddrs_per_block(sb); in befs_find_brun_dblindirect()
464 befs_error(sb, "The double-indirect index calculated by " in befs_find_brun_dblindirect()
472 sb_bread(sb, iaddr2blockno(sb, &data->double_indirect) + in befs_find_brun_dblindirect()
475 befs_error(sb, "%s couldn't read the " in befs_find_brun_dblindirect()
478 iaddr2blockno(sb, &data->double_indirect) + in befs_find_brun_dblindirect()
484 dblindir_indx - (dbl_which_block * befs_iaddrs_per_block(sb)); in befs_find_brun_dblindirect()
486 indir_run = fsrun_to_cpu(sb, iaddr_array[dbl_block_indx]); in befs_find_brun_dblindirect()
490 which_block = indir_indx / befs_iaddrs_per_block(sb); in befs_find_brun_dblindirect()
492 befs_error(sb, "The indirect index calculated by " in befs_find_brun_dblindirect()
499 sb_bread(sb, iaddr2blockno(sb, &indir_run) + which_block); in befs_find_brun_dblindirect()
501 befs_error(sb, "%s couldn't read the indirect block " in befs_find_brun_dblindirect()
503 iaddr2blockno(sb, &indir_run) + which_block); in befs_find_brun_dblindirect()
507 block_indx = indir_indx - (which_block * befs_iaddrs_per_block(sb)); in befs_find_brun_dblindirect()
509 *run = fsrun_to_cpu(sb, iaddr_array[block_indx]); in befs_find_brun_dblindirect()
520 befs_debug(sb, "Found file block %lu in double_indirect[%d][%d]," in befs_find_brun_dblindirect()