Lines Matching refs:s
20 #define SB_ALLOC_OPTS(s) (REISERFS_SB(s)->s_alloc_options.bits) argument
36 #define concentrating_formatted_nodes(s) test_bit(_ALLOC_concentrating_formatted_nodes, &SB_ALLOC_… argument
37 #define displacing_large_files(s) test_bit(_ALLOC_displacing_large_files, &SB_ALLOC_OPTS(s)) argument
38 …efine displacing_new_packing_localities(s) test_bit(_ALLOC_displacing_new_packing_localities, &SB… argument
42 reiserfs_info(s, "block allocator option \"%s\" is set", #optname); \
43 set_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s)); \
45 #define TEST_OPTION(optname, s) \ argument
46 test_bit(_ALLOC_ ## optname , &SB_ALLOC_OPTS(s))
48 static inline void get_bit_address(struct super_block *s, in get_bit_address() argument
57 *bmap_nr = block >> (s->s_blocksize_bits + 3); in get_bit_address()
59 *offset = block & ((s->s_blocksize << 3) - 1); in get_bit_address()
62 int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) in is_reusable() argument
65 unsigned int bmap_count = reiserfs_bmap_count(s); in is_reusable()
67 if (block == 0 || block >= SB_BLOCK_COUNT(s)) { in is_reusable()
68 reiserfs_error(s, "vs-4010", in is_reusable()
70 block, SB_BLOCK_COUNT(s)); in is_reusable()
74 get_bit_address(s, block, &bmap, &offset); in is_reusable()
81 &REISERFS_SB(s)->s_properties))) { in is_reusable()
82 b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; in is_reusable()
85 reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) " in is_reusable()
92 reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) " in is_reusable()
100 reiserfs_error(s, "vs-4030", "bitmap for requested block " in is_reusable()
106 if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) { in is_reusable()
107 reiserfs_error(s, "vs-4050", "this is root block (%u), " in is_reusable()
108 "it must be busy", SB_ROOT_BLOCK(s)); in is_reusable()
120 static inline int is_block_in_journal(struct super_block *s, unsigned int bmap, in is_block_in_journal() argument
125 if (reiserfs_in_journal(s, bmap, off, 1, &tmp)) { in is_block_in_journal()
128 PROC_INFO_INC(s, scan_bitmap.in_journal_hint); in is_block_in_journal()
131 PROC_INFO_INC(s, scan_bitmap.in_journal_nohint); in is_block_in_journal()
133 PROC_INFO_INC(s, scan_bitmap.retry); in is_block_in_journal()
147 struct super_block *s = th->t_super; in scan_bitmap_block() local
148 struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n]; in scan_bitmap_block()
154 RFALSE(bmap_n >= reiserfs_bmap_count(s), "Bitmap %u is out of " in scan_bitmap_block()
155 "range (0..%u)", bmap_n, reiserfs_bmap_count(s) - 1); in scan_bitmap_block()
156 PROC_INFO_INC(s, scan_bitmap.bmap); in scan_bitmap_block()
159 reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer " in scan_bitmap_block()
164 bh = reiserfs_read_bitmap_block(s, bmap_n); in scan_bitmap_block()
188 if (unfm && is_block_in_journal(s, bmap_n, *beg, beg)) in scan_bitmap_block()
203 if (unfm && is_block_in_journal(s, bmap_n, end, &next)) in scan_bitmap_block()
215 reiserfs_prepare_for_journal(s, bh, 1); in scan_bitmap_block()
228 PROC_INFO_INC(s, scan_bitmap.stolen); in scan_bitmap_block()
247 reiserfs_restore_prepared_buffer(s, bh); in scan_bitmap_block()
262 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), in scan_bitmap_block()
264 PUT_SB_FREE_BLOCKS(s, SB_FREE_BLOCKS(s) - (end - *beg)); in scan_bitmap_block()
265 journal_mark_dirty(th, SB_BUFFER_WITH_SB(s)); in scan_bitmap_block()
274 static int bmap_hash_id(struct super_block *s, u32 id) in bmap_hash_id() argument
285 bm = hash % reiserfs_bmap_count(s); in bmap_hash_id()
290 if (bm >= reiserfs_bmap_count(s)) in bmap_hash_id()
299 static inline int block_group_used(struct super_block *s, u32 id) in block_group_used() argument
301 int bm = bmap_hash_id(s, id); in block_group_used()
302 struct reiserfs_bitmap_info *info = &SB_AP_BITMAP(s)[bm]; in block_group_used()
312 struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm); in block_group_used()
316 if (info->free_count > ((s->s_blocksize << 3) * 60 / 100)) { in block_group_used()
352 struct super_block *s = th->t_super; in scan_bitmap() local
355 unsigned int off_max = s->s_blocksize << 3; in scan_bitmap()
358 PROC_INFO_INC(s, scan_bitmap.call); in scan_bitmap()
361 if (SB_FREE_BLOCKS(s) <= 0) in scan_bitmap()
364 get_bit_address(s, *start, &bm, &off); in scan_bitmap()
365 get_bit_address(s, finish, &end_bm, &end_off); in scan_bitmap()
366 if (bm > reiserfs_bmap_count(s)) in scan_bitmap()
368 if (end_bm > reiserfs_bmap_count(s)) in scan_bitmap()
369 end_bm = reiserfs_bmap_count(s); in scan_bitmap()
384 if (TEST_OPTION(skip_busy, s) in scan_bitmap()
385 && SB_FREE_BLOCKS(s) > SB_BLOCK_COUNT(s) / 20) { in scan_bitmap()
388 || SB_AP_BITMAP(s)[bm].free_count > in scan_bitmap()
389 (s->s_blocksize << 3) / 10) in scan_bitmap()
397 get_bit_address(s, *start, &bm, &off); in scan_bitmap()
420 struct super_block *s = th->t_super; in _reiserfs_free_block() local
427 PROC_INFO_INC(s, free_block); in _reiserfs_free_block()
428 rs = SB_DISK_SUPER_BLOCK(s); in _reiserfs_free_block()
429 sbh = SB_BUFFER_WITH_SB(s); in _reiserfs_free_block()
430 apbi = SB_AP_BITMAP(s); in _reiserfs_free_block()
432 get_bit_address(s, block, &nr, &offset); in _reiserfs_free_block()
434 if (nr >= reiserfs_bmap_count(s)) { in _reiserfs_free_block()
435 reiserfs_error(s, "vs-4075", "block %lu is out of range", in _reiserfs_free_block()
440 bmbh = reiserfs_read_bitmap_block(s, nr); in _reiserfs_free_block()
444 reiserfs_prepare_for_journal(s, bmbh, 1); in _reiserfs_free_block()
448 reiserfs_error(s, "vs-4080", in _reiserfs_free_block()
455 reiserfs_prepare_for_journal(s, sbh, 1); in _reiserfs_free_block()
461 int depth = reiserfs_write_unlock_nested(s); in _reiserfs_free_block()
463 reiserfs_write_lock_nested(s, depth); in _reiserfs_free_block()
471 struct super_block *s = th->t_super; in reiserfs_free_block() local
474 RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); in reiserfs_free_block()
475 if (!is_reusable(s, block, 1)) in reiserfs_free_block()
478 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) { in reiserfs_free_block()
482 block, sb_block_count(REISERFS_SB(s)->s_rs)); in reiserfs_free_block()
486 journal_mark_freed(th, s, block); in reiserfs_free_block()
558 void reiserfs_init_alloc_options(struct super_block *s) in reiserfs_init_alloc_options() argument
560 set_bit(_ALLOC_skip_busy, &SB_ALLOC_OPTS(s)); in reiserfs_init_alloc_options()
561 set_bit(_ALLOC_dirid_groups, &SB_ALLOC_OPTS(s)); in reiserfs_init_alloc_options()
562 set_bit(_ALLOC_packing_groups, &SB_ALLOC_OPTS(s)); in reiserfs_init_alloc_options()
566 int reiserfs_parse_alloc_options(struct super_block *s, char *options) in reiserfs_parse_alloc_options() argument
571 REISERFS_SB(s)->s_alloc_options.bits = 0; in reiserfs_parse_alloc_options()
584 REISERFS_SB(s)->s_alloc_options.border = 10; in reiserfs_parse_alloc_options()
586 REISERFS_SB(s)->s_alloc_options.border = in reiserfs_parse_alloc_options()
593 REISERFS_SB(s)->s_alloc_options.large_file_size = in reiserfs_parse_alloc_options()
651 REISERFS_SB(s)->s_alloc_options.preallocmin = in reiserfs_parse_alloc_options()
658 REISERFS_SB(s)->s_alloc_options.preallocsize = in reiserfs_parse_alloc_options()
666 reiserfs_warning(s, "zam-4001", "unknown option - %s", in reiserfs_parse_alloc_options()
671 reiserfs_info(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s)); in reiserfs_parse_alloc_options()
683 void show_alloc_options(struct seq_file *seq, struct super_block *s) in show_alloc_options() argument
687 if (SB_ALLOC_OPTS(s) == ((1 << _ALLOC_skip_busy) | in show_alloc_options()
693 if (TEST_OPTION(concentrating_formatted_nodes, s)) { in show_alloc_options()
695 if (REISERFS_SB(s)->s_alloc_options.border != 10) { in show_alloc_options()
697 100 / REISERFS_SB(s)->s_alloc_options.border); in show_alloc_options()
701 if (TEST_OPTION(displacing_large_files, s)) { in show_alloc_options()
703 if (REISERFS_SB(s)->s_alloc_options.large_file_size != 16) { in show_alloc_options()
705 REISERFS_SB(s)->s_alloc_options.large_file_size); in show_alloc_options()
709 if (TEST_OPTION(displacing_new_packing_localities, s)) { in show_alloc_options()
713 if (TEST_OPTION(old_hashed_relocation, s)) { in show_alloc_options()
717 if (TEST_OPTION(new_hashed_relocation, s)) { in show_alloc_options()
721 if (TEST_OPTION(dirid_groups, s)) { in show_alloc_options()
725 if (TEST_OPTION(oid_groups, s)) { in show_alloc_options()
729 if (TEST_OPTION(packing_groups, s)) { in show_alloc_options()
733 if (TEST_OPTION(hashed_formatted_nodes, s)) { in show_alloc_options()
737 if (TEST_OPTION(skip_busy, s)) { in show_alloc_options()
741 if (TEST_OPTION(hundredth_slices, s)) { in show_alloc_options()
745 if (TEST_OPTION(old_way, s)) { in show_alloc_options()
749 if (TEST_OPTION(displace_based_on_dirid, s)) { in show_alloc_options()
753 if (REISERFS_SB(s)->s_alloc_options.preallocmin != 0) { in show_alloc_options()
756 REISERFS_SB(s)->s_alloc_options.preallocmin); in show_alloc_options()
758 if (REISERFS_SB(s)->s_alloc_options.preallocsize != 17) { in show_alloc_options()
761 REISERFS_SB(s)->s_alloc_options.preallocsize); in show_alloc_options()
899 static inline void set_border_in_hint(struct super_block *s, in set_border_in_hint() argument
903 SB_BLOCK_COUNT(s) / REISERFS_SB(s)->s_alloc_options.border; in set_border_in_hint()
1013 struct super_block *s = hint->th->t_super; in determine_search_start() local
1017 hint->end = SB_BLOCK_COUNT(s) - 1; in determine_search_start()
1020 if (concentrating_formatted_nodes(s)) in determine_search_start()
1021 set_border_in_hint(s, hint); in determine_search_start()
1029 if (displacing_new_packing_localities(s) in determine_search_start()
1046 if (displacing_large_files(s) && !hint->formatted_node in determine_search_start()
1056 if (hint->formatted_node && TEST_OPTION(hashed_formatted_nodes, s)) { in determine_search_start()
1070 if (TEST_OPTION(old_way, s)) { in determine_search_start()
1072 if (!reiserfs_hashed_relocation(s)) in determine_search_start()
1074 else if (!reiserfs_no_unhashed_relocation(s)) in determine_search_start()
1087 if (TEST_OPTION(hundredth_slices, s) in determine_search_start()
1088 && !(displacing_large_files(s) && !hint->formatted_node)) { in determine_search_start()
1095 TEST_OPTION(old_hashed_relocation, s)) { in determine_search_start()
1101 TEST_OPTION(new_hashed_relocation, s)) { in determine_search_start()
1106 if (!unfm_hint && !hint->formatted_node && TEST_OPTION(dirid_groups, s)) { in determine_search_start()
1110 if (hint->formatted_node && TEST_OPTION(dirid_groups, s)) { in determine_search_start()
1116 if (!unfm_hint && !hint->formatted_node && TEST_OPTION(oid_groups, s)) { in determine_search_start()
1189 struct super_block *s = hint->th->t_super; in blocknrs_and_prealloc_arrays_from_search_start() local
1191 b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1; in blocknrs_and_prealloc_arrays_from_search_start()
1200 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1204 depth = reiserfs_write_unlock_nested(s); in blocknrs_and_prealloc_arrays_from_search_start()
1208 reiserfs_write_lock_nested(s, depth); in blocknrs_and_prealloc_arrays_from_search_start()
1213 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1223 reiserfs_write_lock_nested(s, depth); in blocknrs_and_prealloc_arrays_from_search_start()
1230 finish = SB_BLOCK_COUNT(s) - 1; in blocknrs_and_prealloc_arrays_from_search_start()
1245 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1253 depth = reiserfs_write_unlock_nested(s); in blocknrs_and_prealloc_arrays_from_search_start()
1257 reiserfs_write_lock_nested(s, depth); in blocknrs_and_prealloc_arrays_from_search_start()
1281 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1289 depth = reiserfs_write_unlock_nested(s); in blocknrs_and_prealloc_arrays_from_search_start()
1294 reiserfs_write_lock_nested(s, depth); in blocknrs_and_prealloc_arrays_from_search_start()
1334 struct super_block *s = hint->th->t_super; in reiserfs_allocate_blocknrs() local
1337 if (SB_FREE_BLOCKS(s) - REISERFS_SB(s)->reserved_blocks < in reiserfs_allocate_blocknrs()
1363 if (hint->search_start >= SB_BLOCK_COUNT(s)) in reiserfs_allocate_blocknrs()
1364 hint->search_start = SB_BLOCK_COUNT(s) - 1; in reiserfs_allocate_blocknrs()