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
55 *bmap_nr = block >> (s->s_blocksize_bits + 3); in get_bit_address()
57 *offset = block & ((s->s_blocksize << 3) - 1); in get_bit_address()
60 int is_reusable(struct super_block *s, b_blocknr_t block, int bit_value) in is_reusable() argument
63 unsigned int bmap_count = reiserfs_bmap_count(s); in is_reusable()
65 if (block == 0 || block >= SB_BLOCK_COUNT(s)) { in is_reusable()
66 reiserfs_error(s, "vs-4010", in is_reusable()
68 block, SB_BLOCK_COUNT(s)); in is_reusable()
72 get_bit_address(s, block, &bmap, &offset); in is_reusable()
77 &(REISERFS_SB(s)->s_properties)))) { in is_reusable()
78 b_blocknr_t bmap1 = REISERFS_SB(s)->s_sbh->b_blocknr + 1; in is_reusable()
81 reiserfs_error(s, "vs-4019", "bitmap block %lu(%u) " in is_reusable()
88 reiserfs_error(s, "vs-4020", "bitmap block %lu(%u) " in is_reusable()
96 reiserfs_error(s, "vs-4030", "bitmap for requested block " in is_reusable()
102 if (bit_value == 0 && block == SB_ROOT_BLOCK(s)) { in is_reusable()
103 reiserfs_error(s, "vs-4050", "this is root block (%u), " in is_reusable()
104 "it must be busy", SB_ROOT_BLOCK(s)); in is_reusable()
113 static inline int is_block_in_journal(struct super_block *s, unsigned int bmap, in is_block_in_journal() argument
118 if (reiserfs_in_journal(s, bmap, off, 1, &tmp)) { in is_block_in_journal()
121 PROC_INFO_INC(s, scan_bitmap.in_journal_hint); in is_block_in_journal()
124 PROC_INFO_INC(s, scan_bitmap.in_journal_nohint); in is_block_in_journal()
126 PROC_INFO_INC(s, scan_bitmap.retry); in is_block_in_journal()
138 struct super_block *s = th->t_super; in scan_bitmap_block() local
139 struct reiserfs_bitmap_info *bi = &SB_AP_BITMAP(s)[bmap_n]; in scan_bitmap_block()
146 RFALSE(bmap_n >= reiserfs_bmap_count(s), "Bitmap %u is out of " in scan_bitmap_block()
147 "range (0..%u)", bmap_n, reiserfs_bmap_count(s) - 1); in scan_bitmap_block()
148 PROC_INFO_INC(s, scan_bitmap.bmap); in scan_bitmap_block()
155 reiserfs_error(s, "jdm-4055", "NULL bitmap info pointer " in scan_bitmap_block()
160 bh = reiserfs_read_bitmap_block(s, bmap_n); in scan_bitmap_block()
181 if (unfm && is_block_in_journal(s, bmap_n, *beg, beg)) in scan_bitmap_block()
192 if (unfm && is_block_in_journal(s, bmap_n, end, &next)) in scan_bitmap_block()
200 reiserfs_prepare_for_journal(s, bh, 1); in scan_bitmap_block()
208 PROC_INFO_INC(s, scan_bitmap.stolen); in scan_bitmap_block()
218 reiserfs_restore_prepared_buffer(s, bh); in scan_bitmap_block()
225 journal_mark_dirty(th, s, bh); in scan_bitmap_block()
229 reiserfs_prepare_for_journal(s, SB_BUFFER_WITH_SB(s), in scan_bitmap_block()
231 PUT_SB_FREE_BLOCKS(s, SB_FREE_BLOCKS(s) - (end - *beg)); in scan_bitmap_block()
232 journal_mark_dirty(th, s, SB_BUFFER_WITH_SB(s)); in scan_bitmap_block()
241 static int bmap_hash_id(struct super_block *s, u32 id) in bmap_hash_id() argument
252 bm = hash % reiserfs_bmap_count(s); in bmap_hash_id()
257 if (bm >= reiserfs_bmap_count(s)) in bmap_hash_id()
266 static inline int block_group_used(struct super_block *s, u32 id) in block_group_used() argument
268 int bm = bmap_hash_id(s, id); in block_group_used()
269 struct reiserfs_bitmap_info *info = &SB_AP_BITMAP(s)[bm]; in block_group_used()
277 struct buffer_head *bh = reiserfs_read_bitmap_block(s, bm); in block_group_used()
281 if (info->free_count > ((s->s_blocksize << 3) * 60 / 100)) { in block_group_used()
315 struct super_block *s = th->t_super; in scan_bitmap() local
321 unsigned int off_max = s->s_blocksize << 3; in scan_bitmap()
325 PROC_INFO_INC(s, scan_bitmap.call); in scan_bitmap()
326 if (SB_FREE_BLOCKS(s) <= 0) in scan_bitmap()
329 get_bit_address(s, *start, &bm, &off); in scan_bitmap()
330 get_bit_address(s, finish, &end_bm, &end_off); in scan_bitmap()
331 if (bm > reiserfs_bmap_count(s)) in scan_bitmap()
333 if (end_bm > reiserfs_bmap_count(s)) in scan_bitmap()
334 end_bm = reiserfs_bmap_count(s); in scan_bitmap()
348 if (TEST_OPTION(skip_busy, s) in scan_bitmap()
349 && SB_FREE_BLOCKS(s) > SB_BLOCK_COUNT(s) / 20) { in scan_bitmap()
352 || SB_AP_BITMAP(s)[bm].free_count > in scan_bitmap()
353 (s->s_blocksize << 3) / 10) in scan_bitmap()
361 get_bit_address(s, *start, &bm, &off); in scan_bitmap()
384 struct super_block *s = th->t_super; in _reiserfs_free_block() local
392 PROC_INFO_INC(s, free_block); in _reiserfs_free_block()
394 rs = SB_DISK_SUPER_BLOCK(s); in _reiserfs_free_block()
395 sbh = SB_BUFFER_WITH_SB(s); in _reiserfs_free_block()
396 apbi = SB_AP_BITMAP(s); in _reiserfs_free_block()
398 get_bit_address(s, block, &nr, &offset); in _reiserfs_free_block()
400 if (nr >= reiserfs_bmap_count(s)) { in _reiserfs_free_block()
401 reiserfs_error(s, "vs-4075", "block %lu is out of range", in _reiserfs_free_block()
406 bmbh = reiserfs_read_bitmap_block(s, nr); in _reiserfs_free_block()
410 reiserfs_prepare_for_journal(s, bmbh, 1); in _reiserfs_free_block()
414 reiserfs_error(s, "vs-4080", in _reiserfs_free_block()
418 journal_mark_dirty(th, s, bmbh); in _reiserfs_free_block()
421 reiserfs_prepare_for_journal(s, sbh, 1); in _reiserfs_free_block()
425 journal_mark_dirty(th, s, sbh); in _reiserfs_free_block()
434 struct super_block *s = th->t_super; in reiserfs_free_block() local
437 RFALSE(!s, "vs-4061: trying to free block on nonexistent device"); in reiserfs_free_block()
438 if (!is_reusable(s, block, 1)) in reiserfs_free_block()
441 if (block > sb_block_count(REISERFS_SB(s)->s_rs)) { in reiserfs_free_block()
445 block, sb_block_count(REISERFS_SB(s)->s_rs)); in reiserfs_free_block()
449 journal_mark_freed(th, s, block); in reiserfs_free_block()
520 void reiserfs_init_alloc_options(struct super_block *s) in reiserfs_init_alloc_options() argument
522 set_bit(_ALLOC_skip_busy, &SB_ALLOC_OPTS(s)); in reiserfs_init_alloc_options()
523 set_bit(_ALLOC_dirid_groups, &SB_ALLOC_OPTS(s)); in reiserfs_init_alloc_options()
524 set_bit(_ALLOC_packing_groups, &SB_ALLOC_OPTS(s)); in reiserfs_init_alloc_options()
528 int reiserfs_parse_alloc_options(struct super_block *s, char *options) in reiserfs_parse_alloc_options() argument
532 REISERFS_SB(s)->s_alloc_options.bits = 0; /* clear default settings */ in reiserfs_parse_alloc_options()
545 REISERFS_SB(s)->s_alloc_options.border = 10; in reiserfs_parse_alloc_options()
547 REISERFS_SB(s)->s_alloc_options.border = in reiserfs_parse_alloc_options()
554 REISERFS_SB(s)->s_alloc_options.large_file_size = in reiserfs_parse_alloc_options()
612 REISERFS_SB(s)->s_alloc_options.preallocmin = in reiserfs_parse_alloc_options()
619 REISERFS_SB(s)->s_alloc_options.preallocsize = in reiserfs_parse_alloc_options()
627 reiserfs_warning(s, "zam-4001", "unknown option - %s", in reiserfs_parse_alloc_options()
632 reiserfs_info(s, "allocator options = [%08x]\n", SB_ALLOC_OPTS(s)); in reiserfs_parse_alloc_options()
644 void show_alloc_options(struct seq_file *seq, struct super_block *s) in show_alloc_options() argument
648 if (SB_ALLOC_OPTS(s) == ((1 << _ALLOC_skip_busy) | in show_alloc_options()
654 if (TEST_OPTION(concentrating_formatted_nodes, s)) { in show_alloc_options()
656 if (REISERFS_SB(s)->s_alloc_options.border != 10) { in show_alloc_options()
658 100 / REISERFS_SB(s)->s_alloc_options.border); in show_alloc_options()
662 if (TEST_OPTION(displacing_large_files, s)) { in show_alloc_options()
664 if (REISERFS_SB(s)->s_alloc_options.large_file_size != 16) { in show_alloc_options()
666 REISERFS_SB(s)->s_alloc_options.large_file_size); in show_alloc_options()
670 if (TEST_OPTION(displacing_new_packing_localities, s)) { in show_alloc_options()
674 if (TEST_OPTION(old_hashed_relocation, s)) { in show_alloc_options()
678 if (TEST_OPTION(new_hashed_relocation, s)) { in show_alloc_options()
682 if (TEST_OPTION(dirid_groups, s)) { in show_alloc_options()
686 if (TEST_OPTION(oid_groups, s)) { in show_alloc_options()
690 if (TEST_OPTION(packing_groups, s)) { in show_alloc_options()
694 if (TEST_OPTION(hashed_formatted_nodes, s)) { in show_alloc_options()
698 if (TEST_OPTION(skip_busy, s)) { in show_alloc_options()
702 if (TEST_OPTION(hundredth_slices, s)) { in show_alloc_options()
706 if (TEST_OPTION(old_way, s)) { in show_alloc_options()
710 if (TEST_OPTION(displace_based_on_dirid, s)) { in show_alloc_options()
714 if (REISERFS_SB(s)->s_alloc_options.preallocmin != 0) { in show_alloc_options()
717 REISERFS_SB(s)->s_alloc_options.preallocmin); in show_alloc_options()
719 if (REISERFS_SB(s)->s_alloc_options.preallocsize != 17) { in show_alloc_options()
722 REISERFS_SB(s)->s_alloc_options.preallocsize); in show_alloc_options()
850 static inline void set_border_in_hint(struct super_block *s, in set_border_in_hint() argument
854 SB_BLOCK_COUNT(s) / REISERFS_SB(s)->s_alloc_options.border; in set_border_in_hint()
964 struct super_block *s = hint->th->t_super; in determine_search_start() local
968 hint->end = SB_BLOCK_COUNT(s) - 1; in determine_search_start()
971 if (concentrating_formatted_nodes(s)) in determine_search_start()
972 set_border_in_hint(s, hint); in determine_search_start()
978 if (displacing_new_packing_localities(s) in determine_search_start()
991 if (displacing_large_files(s) && !hint->formatted_node in determine_search_start()
999 if (hint->formatted_node && TEST_OPTION(hashed_formatted_nodes, s)) { in determine_search_start()
1010 if (TEST_OPTION(old_way, s)) { in determine_search_start()
1012 if (!reiserfs_hashed_relocation(s)) in determine_search_start()
1014 else if (!reiserfs_no_unhashed_relocation(s)) in determine_search_start()
1027 if (TEST_OPTION(hundredth_slices, s) in determine_search_start()
1028 && !(displacing_large_files(s) && !hint->formatted_node)) { in determine_search_start()
1035 TEST_OPTION(old_hashed_relocation, s)) { in determine_search_start()
1040 TEST_OPTION(new_hashed_relocation, s)) { in determine_search_start()
1044 if (!unfm_hint && !hint->formatted_node && TEST_OPTION(dirid_groups, s)) { in determine_search_start()
1048 if (hint->formatted_node && TEST_OPTION(dirid_groups, s)) { in determine_search_start()
1054 if (!unfm_hint && !hint->formatted_node && TEST_OPTION(oid_groups, s)) { in determine_search_start()
1126 struct super_block *s = hint->th->t_super; in blocknrs_and_prealloc_arrays_from_search_start() local
1128 b_blocknr_t finish = SB_BLOCK_COUNT(s) - 1; in blocknrs_and_prealloc_arrays_from_search_start()
1136 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1146 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1162 finish = SB_BLOCK_COUNT(s) - 1; in blocknrs_and_prealloc_arrays_from_search_start()
1176 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1210 reiserfs_debug(s, REISERFS_DEBUG_CODE, in blocknrs_and_prealloc_arrays_from_search_start()
1257 struct super_block *s = hint->th->t_super; in reiserfs_allocate_blocknrs() local
1260 if (SB_FREE_BLOCKS(s) - REISERFS_SB(s)->reserved_blocks < in reiserfs_allocate_blocknrs()
1280 if (hint->search_start >= SB_BLOCK_COUNT(s)) in reiserfs_allocate_blocknrs()
1281 hint->search_start = SB_BLOCK_COUNT(s) - 1; in reiserfs_allocate_blocknrs()