Lines Matching refs:es

187 		struct extent_status *es;  in ext4_es_print_tree()  local
188 es = rb_entry(node, struct extent_status, rb_node); in ext4_es_print_tree()
190 es->es_lblk, es->es_len, in ext4_es_print_tree()
191 ext4_es_pblock(es), ext4_es_status(es)); in ext4_es_print_tree()
200 static inline ext4_lblk_t ext4_es_end(struct extent_status *es) in ext4_es_end() argument
202 BUG_ON(es->es_lblk + es->es_len < es->es_lblk); in ext4_es_end()
203 return es->es_lblk + es->es_len - 1; in ext4_es_end()
214 struct extent_status *es = NULL; in __es_tree_search() local
217 es = rb_entry(node, struct extent_status, rb_node); in __es_tree_search()
218 if (lblk < es->es_lblk) in __es_tree_search()
220 else if (lblk > ext4_es_end(es)) in __es_tree_search()
223 return es; in __es_tree_search()
226 if (es && lblk < es->es_lblk) in __es_tree_search()
227 return es; in __es_tree_search()
229 if (es && lblk > ext4_es_end(es)) { in __es_tree_search()
230 node = rb_next(&es->rb_node); in __es_tree_search()
257 int (*matching_fn)(struct extent_status *es), in __es_find_extent_range() argument
259 struct extent_status *es) in __es_find_extent_range()
265 WARN_ON(es == NULL); in __es_find_extent_range()
271 es->es_lblk = es->es_len = es->es_pblk = 0; in __es_find_extent_range()
299 es->es_lblk = es1->es_lblk; in __es_find_extent_range()
300 es->es_len = es1->es_len; in __es_find_extent_range()
301 es->es_pblk = es1->es_pblk; in __es_find_extent_range()
310 int (*matching_fn)(struct extent_status *es), in ext4_es_find_extent_range() argument
312 struct extent_status *es) in ext4_es_find_extent_range()
317 __es_find_extent_range(inode, matching_fn, lblk, end, es); in ext4_es_find_extent_range()
320 trace_ext4_es_find_extent_range_exit(inode, es); in ext4_es_find_extent_range()
339 int (*matching_fn)(struct extent_status *es), in __es_scan_range() argument
342 struct extent_status es; in __es_scan_range() local
344 __es_find_extent_range(inode, matching_fn, start, end, &es); in __es_scan_range()
345 if (es.es_len == 0) in __es_scan_range()
347 else if (es.es_lblk <= start && in __es_scan_range()
348 start < es.es_lblk + es.es_len) in __es_scan_range()
350 else if (start <= es.es_lblk && es.es_lblk <= end) in __es_scan_range()
359 int (*matching_fn)(struct extent_status *es), in ext4_es_scan_range() argument
386 int (*matching_fn)(struct extent_status *es), in __es_scan_clu() argument
402 int (*matching_fn)(struct extent_status *es), in ext4_es_scan_clu() argument
448 struct extent_status *es; in ext4_es_alloc_extent() local
449 es = kmem_cache_alloc(ext4_es_cachep, GFP_ATOMIC); in ext4_es_alloc_extent()
450 if (es == NULL) in ext4_es_alloc_extent()
452 es->es_lblk = lblk; in ext4_es_alloc_extent()
453 es->es_len = len; in ext4_es_alloc_extent()
454 es->es_pblk = pblk; in ext4_es_alloc_extent()
459 if (!ext4_es_is_delayed(es)) { in ext4_es_alloc_extent()
469 return es; in ext4_es_alloc_extent()
472 static void ext4_es_free_extent(struct inode *inode, struct extent_status *es) in ext4_es_free_extent() argument
478 if (!ext4_es_is_delayed(es)) { in ext4_es_free_extent()
486 kmem_cache_free(ext4_es_cachep, es); in ext4_es_free_extent()
529 ext4_es_try_to_merge_left(struct inode *inode, struct extent_status *es) in ext4_es_try_to_merge_left() argument
535 node = rb_prev(&es->rb_node); in ext4_es_try_to_merge_left()
537 return es; in ext4_es_try_to_merge_left()
540 if (ext4_es_can_be_merged(es1, es)) { in ext4_es_try_to_merge_left()
541 es1->es_len += es->es_len; in ext4_es_try_to_merge_left()
542 if (ext4_es_is_referenced(es)) in ext4_es_try_to_merge_left()
544 rb_erase(&es->rb_node, &tree->root); in ext4_es_try_to_merge_left()
545 ext4_es_free_extent(inode, es); in ext4_es_try_to_merge_left()
546 es = es1; in ext4_es_try_to_merge_left()
549 return es; in ext4_es_try_to_merge_left()
553 ext4_es_try_to_merge_right(struct inode *inode, struct extent_status *es) in ext4_es_try_to_merge_right() argument
559 node = rb_next(&es->rb_node); in ext4_es_try_to_merge_right()
561 return es; in ext4_es_try_to_merge_right()
564 if (ext4_es_can_be_merged(es, es1)) { in ext4_es_try_to_merge_right()
565 es->es_len += es1->es_len; in ext4_es_try_to_merge_right()
567 ext4_es_set_referenced(es); in ext4_es_try_to_merge_right()
572 return es; in ext4_es_try_to_merge_right()
579 struct extent_status *es) in ext4_es_insert_extent_ext_check() argument
588 path = ext4_find_extent(inode, es->es_lblk, NULL, EXT4_EX_NOCACHE); in ext4_es_insert_extent_ext_check()
602 es_status = ext4_es_is_unwritten(es) ? 1 : 0; in ext4_es_insert_extent_ext_check()
608 if (!ext4_es_is_written(es) && !ext4_es_is_unwritten(es)) { in ext4_es_insert_extent_ext_check()
609 if (in_range(es->es_lblk, ee_block, ee_len)) { in ext4_es_insert_extent_ext_check()
617 es->es_lblk, es->es_len, in ext4_es_insert_extent_ext_check()
618 ext4_es_pblock(es), ext4_es_status(es)); in ext4_es_insert_extent_ext_check()
627 if (es->es_lblk < ee_block || in ext4_es_insert_extent_ext_check()
628 ext4_es_pblock(es) != ee_start + es->es_lblk - ee_block) { in ext4_es_insert_extent_ext_check()
633 ee_status ? 'u' : 'w', es->es_lblk, es->es_len, in ext4_es_insert_extent_ext_check()
634 ext4_es_pblock(es), es_status ? 'u' : 'w'); in ext4_es_insert_extent_ext_check()
643 ee_status ? 'u' : 'w', es->es_lblk, es->es_len, in ext4_es_insert_extent_ext_check()
644 ext4_es_pblock(es), es_status ? 'u' : 'w'); in ext4_es_insert_extent_ext_check()
651 if (!ext4_es_is_delayed(es) && !ext4_es_is_hole(es)) { in ext4_es_insert_extent_ext_check()
656 es->es_lblk, es->es_lblk, es->es_len, in ext4_es_insert_extent_ext_check()
657 ext4_es_pblock(es), ext4_es_status(es)); in ext4_es_insert_extent_ext_check()
666 struct extent_status *es) in ext4_es_insert_extent_ind_check() argument
678 map.m_lblk = es->es_lblk; in ext4_es_insert_extent_ind_check()
679 map.m_len = es->es_len; in ext4_es_insert_extent_ind_check()
683 if (ext4_es_is_delayed(es) || ext4_es_is_hole(es)) { in ext4_es_insert_extent_ind_check()
691 inode->i_ino, es->es_lblk, es->es_len, in ext4_es_insert_extent_ind_check()
692 ext4_es_pblock(es), ext4_es_status(es)); in ext4_es_insert_extent_ind_check()
694 } else if (ext4_es_is_written(es)) { in ext4_es_insert_extent_ind_check()
695 if (retval != es->es_len) { in ext4_es_insert_extent_ind_check()
698 inode->i_ino, retval, es->es_len); in ext4_es_insert_extent_ind_check()
701 if (map.m_pblk != ext4_es_pblock(es)) { in ext4_es_insert_extent_ind_check()
706 ext4_es_pblock(es)); in ext4_es_insert_extent_ind_check()
717 if (ext4_es_is_written(es)) { in ext4_es_insert_extent_ind_check()
721 inode->i_ino, es->es_lblk, es->es_len, in ext4_es_insert_extent_ind_check()
722 ext4_es_pblock(es), ext4_es_status(es)); in ext4_es_insert_extent_ind_check()
729 struct extent_status *es) in ext4_es_insert_extent_check() argument
737 ext4_es_insert_extent_ext_check(inode, es); in ext4_es_insert_extent_check()
739 ext4_es_insert_extent_ind_check(inode, es); in ext4_es_insert_extent_check()
743 struct extent_status *es) in ext4_es_insert_extent_check() argument
753 struct extent_status *es; in __es_insert_extent() local
757 es = rb_entry(parent, struct extent_status, rb_node); in __es_insert_extent()
759 if (newes->es_lblk < es->es_lblk) { in __es_insert_extent()
760 if (ext4_es_can_be_merged(newes, es)) { in __es_insert_extent()
765 es->es_lblk = newes->es_lblk; in __es_insert_extent()
766 es->es_len += newes->es_len; in __es_insert_extent()
767 if (ext4_es_is_written(es) || in __es_insert_extent()
768 ext4_es_is_unwritten(es)) in __es_insert_extent()
769 ext4_es_store_pblock(es, in __es_insert_extent()
771 es = ext4_es_try_to_merge_left(inode, es); in __es_insert_extent()
775 } else if (newes->es_lblk > ext4_es_end(es)) { in __es_insert_extent()
776 if (ext4_es_can_be_merged(es, newes)) { in __es_insert_extent()
777 es->es_len += newes->es_len; in __es_insert_extent()
778 es = ext4_es_try_to_merge_right(inode, es); in __es_insert_extent()
788 es = ext4_es_alloc_extent(inode, newes->es_lblk, newes->es_len, in __es_insert_extent()
790 if (!es) in __es_insert_extent()
792 rb_link_node(&es->rb_node, parent, p); in __es_insert_extent()
793 rb_insert_color(&es->rb_node, &tree->root); in __es_insert_extent()
796 tree->cache_es = es; in __es_insert_extent()
872 struct extent_status *es; in ext4_es_cache_extent() local
888 es = __es_tree_search(&EXT4_I(inode)->i_es_tree.root, lblk); in ext4_es_cache_extent()
889 if (!es || es->es_lblk > end) in ext4_es_cache_extent()
903 struct extent_status *es) in ext4_es_lookup_extent() argument
918 es->es_lblk = es->es_len = es->es_pblk = 0; in ext4_es_lookup_extent()
946 es->es_lblk = es1->es_lblk; in ext4_es_lookup_extent()
947 es->es_len = es1->es_len; in ext4_es_lookup_extent()
948 es->es_pblk = es1->es_pblk; in ext4_es_lookup_extent()
967 trace_ext4_es_lookup_extent_exit(inode, es, found); in ext4_es_lookup_extent()
993 struct extent_status *es, struct rsvd_count *rc) in init_rsvd() argument
1008 if (lblk > es->es_lblk) { in init_rsvd()
1009 rc->left_es = es; in init_rsvd()
1011 node = rb_prev(&es->rb_node); in init_rsvd()
1035 struct extent_status *es, struct rsvd_count *rc) in count_rsvd() argument
1040 if (!ext4_es_is_delonly(es)) in count_rsvd()
1052 i = (lblk < es->es_lblk) ? es->es_lblk : lblk; in count_rsvd()
1054 end = (end > ext4_es_end(es)) ? ext4_es_end(es) : end; in count_rsvd()
1167 struct extent_status *es; in get_rsvd() local
1187 es = rc->left_es; in get_rsvd()
1188 while (es && ext4_es_end(es) >= in get_rsvd()
1190 if (ext4_es_is_delonly(es)) { in get_rsvd()
1195 node = rb_prev(&es->rb_node); in get_rsvd()
1198 es = rb_entry(node, struct extent_status, rb_node); in get_rsvd()
1202 es = right_es; in get_rsvd()
1205 es = node ? rb_entry(node, struct extent_status, in get_rsvd()
1208 while (es && es->es_lblk <= in get_rsvd()
1210 if (ext4_es_is_delonly(es)) { in get_rsvd()
1215 node = rb_next(&es->rb_node); in get_rsvd()
1218 es = rb_entry(node, struct extent_status, in get_rsvd()
1290 struct extent_status *es; in __es_remove_extent() local
1303 es = __es_tree_search(&tree->root, lblk); in __es_remove_extent()
1304 if (!es) in __es_remove_extent()
1306 if (es->es_lblk > end) in __es_remove_extent()
1312 init_rsvd(inode, lblk, es, &rc); in __es_remove_extent()
1314 orig_es.es_lblk = es->es_lblk; in __es_remove_extent()
1315 orig_es.es_len = es->es_len; in __es_remove_extent()
1316 orig_es.es_pblk = es->es_pblk; in __es_remove_extent()
1318 len1 = lblk > es->es_lblk ? lblk - es->es_lblk : 0; in __es_remove_extent()
1319 len2 = ext4_es_end(es) > end ? ext4_es_end(es) - end : 0; in __es_remove_extent()
1321 es->es_len = len1; in __es_remove_extent()
1337 es->es_lblk = orig_es.es_lblk; in __es_remove_extent()
1338 es->es_len = orig_es.es_len; in __es_remove_extent()
1346 es->es_lblk = end + 1; in __es_remove_extent()
1347 es->es_len = len2; in __es_remove_extent()
1348 if (ext4_es_is_written(es) || in __es_remove_extent()
1349 ext4_es_is_unwritten(es)) { in __es_remove_extent()
1351 ext4_es_store_pblock(es, block); in __es_remove_extent()
1364 node = rb_next(&es->rb_node); in __es_remove_extent()
1366 es = rb_entry(node, struct extent_status, rb_node); in __es_remove_extent()
1368 es = NULL; in __es_remove_extent()
1371 while (es && ext4_es_end(es) <= end) { in __es_remove_extent()
1373 count_rsvd(inode, es->es_lblk, es->es_len, es, &rc); in __es_remove_extent()
1374 node = rb_next(&es->rb_node); in __es_remove_extent()
1375 rb_erase(&es->rb_node, &tree->root); in __es_remove_extent()
1376 ext4_es_free_extent(inode, es); in __es_remove_extent()
1378 es = NULL; in __es_remove_extent()
1381 es = rb_entry(node, struct extent_status, rb_node); in __es_remove_extent()
1384 if (es && es->es_lblk < end + 1) { in __es_remove_extent()
1385 ext4_lblk_t orig_len = es->es_len; in __es_remove_extent()
1387 len1 = ext4_es_end(es) - end; in __es_remove_extent()
1389 count_rsvd(inode, es->es_lblk, orig_len - len1, in __es_remove_extent()
1390 es, &rc); in __es_remove_extent()
1391 es->es_lblk = end + 1; in __es_remove_extent()
1392 es->es_len = len1; in __es_remove_extent()
1393 if (ext4_es_is_written(es) || ext4_es_is_unwritten(es)) { in __es_remove_extent()
1394 block = es->es_pblk + orig_len - len1; in __es_remove_extent()
1395 ext4_es_store_pblock(es, block); in __es_remove_extent()
1400 *reserved = get_rsvd(inode, end, es, &rc); in __es_remove_extent()
1676 struct extent_status *es; in es_do_reclaim_extents() local
1679 es = __es_tree_search(&tree->root, ei->i_es_shrink_lblk); in es_do_reclaim_extents()
1680 if (!es) in es_do_reclaim_extents()
1684 if (es->es_lblk > end) { in es_do_reclaim_extents()
1690 node = rb_next(&es->rb_node); in es_do_reclaim_extents()
1695 if (ext4_es_is_delayed(es)) in es_do_reclaim_extents()
1697 if (ext4_es_is_referenced(es)) { in es_do_reclaim_extents()
1698 ext4_es_clear_referenced(es); in es_do_reclaim_extents()
1702 rb_erase(&es->rb_node, &tree->root); in es_do_reclaim_extents()
1703 ext4_es_free_extent(inode, es); in es_do_reclaim_extents()
1708 es = rb_entry(node, struct extent_status, rb_node); in es_do_reclaim_extents()
1710 ei->i_es_shrink_lblk = es->es_lblk; in es_do_reclaim_extents()
1748 struct extent_status *es; in ext4_clear_inode_es() local
1757 es = rb_entry(node, struct extent_status, rb_node); in ext4_clear_inode_es()
1759 if (!ext4_es_is_delayed(es)) { in ext4_clear_inode_es()
1760 rb_erase(&es->rb_node, &tree->root); in ext4_clear_inode_es()
1761 ext4_es_free_extent(inode, es); in ext4_clear_inode_es()
2024 struct extent_status *es; in __es_delayed_clu() local
2034 es = __es_tree_search(&tree->root, start); in __es_delayed_clu()
2036 while (es && (es->es_lblk <= end)) { in __es_delayed_clu()
2037 if (ext4_es_is_delonly(es)) { in __es_delayed_clu()
2038 if (es->es_lblk <= start) in __es_delayed_clu()
2041 first_lclu = EXT4_B2C(sbi, es->es_lblk); in __es_delayed_clu()
2043 if (ext4_es_end(es) >= end) in __es_delayed_clu()
2046 last_lclu = EXT4_B2C(sbi, ext4_es_end(es)); in __es_delayed_clu()
2054 node = rb_next(&es->rb_node); in __es_delayed_clu()
2057 es = rb_entry(node, struct extent_status, rb_node); in __es_delayed_clu()