Lines Matching full:section
175 const struct pt_section *section; in pt_iscache_find_locked() local
184 section = entry->section; in pt_iscache_find_locked()
185 sec_filename = pt_section_filename(section); in pt_iscache_find_locked()
186 sec_offset = pt_section_offset(section); in pt_iscache_find_locked()
187 sec_size = pt_section_size(section); in pt_iscache_find_locked()
198 /* We should not have a section without a filename. */ in pt_iscache_find_locked()
220 errcode = pt_section_unmap(trash->section); in pt_iscache_lru_free()
261 /* Add @section to the front of @iscache->lru.
268 struct pt_section *section) in pt_isache_lru_new() argument
277 errcode = pt_section_memsize(section, &memsize); in pt_isache_lru_new()
281 /* Don't try to add the section if it is too big. We'd prune it again in pt_isache_lru_new()
288 errcode = pt_section_map_share(section); in pt_isache_lru_new()
294 (void) pt_section_unmap(section); in pt_isache_lru_new()
298 lru->section = section; in pt_isache_lru_new()
314 /* Add or move @section to the front of @iscache->lru.
321 struct pt_section *section) in pt_iscache_lru_add() argument
331 if (lru->section != section) in pt_iscache_lru_add()
343 return pt_isache_lru_new(iscache, section); in pt_iscache_lru_add()
347 /* Remove @section from @iscache->lru.
352 const struct pt_section *section) in pt_iscache_lru_remove() argument
362 if (lru->section != section) in pt_iscache_lru_remove()
375 /* Add or move @section to the front of @iscache->lru and update its size.
382 struct pt_section *section, uint64_t memsize) in pt_iscache_lru_resize() argument
391 status = pt_iscache_lru_add(iscache, section); in pt_iscache_lru_resize()
402 /* If @section is cached, it must be first. in pt_iscache_lru_resize()
406 if (lru->section != section) { in pt_iscache_lru_resize()
455 /* Search @iscache for a partial or exact match of @section loaded at @laddr and
467 const struct pt_section *section; in pt_iscache_find_section_locked() local
474 section = NULL; in pt_iscache_find_section_locked()
485 sec = entry->section; in pt_iscache_find_section_locked()
488 if (sec != section) { in pt_iscache_find_section_locked()
492 if (section) in pt_iscache_find_section_locked()
508 /* Use the cached section instead. */ in pt_iscache_find_section_locked()
509 section = sec; in pt_iscache_find_section_locked()
513 /* If we didn't continue, @section == @sec and we have a match. in pt_iscache_find_section_locked()
525 struct pt_section *section, uint64_t laddr) in pt_iscache_add() argument
532 if (!iscache || !section) in pt_iscache_add()
535 /* We must have a filename for @section. */ in pt_iscache_add()
536 filename = pt_section_filename(section); in pt_iscache_add()
540 offset = pt_section_offset(section); in pt_iscache_add()
541 size = pt_section_size(section); in pt_iscache_add()
543 /* Adding a section is slightly complicated by a potential deadlock in pt_iscache_add()
546 * - in order to add a section, we need to attach to it, which in pt_iscache_add()
547 * requires taking the section's attach lock. in pt_iscache_add()
553 * Hence we can't attach to a section while holding the iscache lock. in pt_iscache_add()
556 * We therefore attach to @section first and then lock @iscache. in pt_iscache_add()
558 * This opens a small window where an existing @section may be removed in pt_iscache_add()
559 * from @iscache and replaced by a new matching section. We would want in pt_iscache_add()
560 * to share that new section rather than adding a duplicate @section. in pt_iscache_add()
563 * sections and, if one is found, update @section. This involves in pt_iscache_add()
564 * detaching from @section and attaching to the existing section. in pt_iscache_add()
568 errcode = pt_section_get(section); in pt_iscache_add()
572 errcode = pt_section_attach(section, iscache); in pt_iscache_add()
583 * scenario where we do repeat this is when adding a section with an in pt_iscache_add()
586 * We will not find a matching section in pt_iscache_add_file() so we in pt_iscache_add()
587 * create a new section. This will have its size reduced to match the in pt_iscache_add()
590 * For this reduced size, we may now find an existing section, and we in pt_iscache_add()
598 /* Find an existing section matching @section that we'd share in pt_iscache_add()
599 * rather than adding @section. in pt_iscache_add()
608 /* We're done if we have not found a matching section. */ in pt_iscache_add()
614 /* We're also done if we found the same section again. in pt_iscache_add()
619 sec = entry->section; in pt_iscache_add()
620 if (sec == section) { in pt_iscache_add()
626 errcode = pt_section_detach(section, iscache); in pt_iscache_add()
630 errcode = pt_section_put(section); in pt_iscache_add()
640 /* We update @section to share the existing @sec. in pt_iscache_add()
642 * This requires detaching from @section, which, in turn, in pt_iscache_add()
645 * We further need to remove @section from @iscache->lru. in pt_iscache_add()
657 errcode = pt_section_detach(section, iscache); in pt_iscache_add()
671 (void) pt_section_put(section); in pt_iscache_add()
673 section = sec; in pt_iscache_add()
677 /* We may have received on-map notifications for @section and we in pt_iscache_add()
678 * may have added @section to @iscache->lru. in pt_iscache_add()
683 errcode = pt_iscache_lru_remove(iscache, section); in pt_iscache_add()
685 (void) pt_section_put(section); in pt_iscache_add()
687 section = sec; in pt_iscache_add()
691 /* Drop the reference to @section. */ in pt_iscache_add()
692 errcode = pt_section_put(section); in pt_iscache_add()
695 section = sec; in pt_iscache_add()
703 section = sec; in pt_iscache_add()
725 /* Insert a new entry for @section at @laddr. in pt_iscache_add()
732 iscache->entries[idx].section = section; in pt_iscache_add()
745 (void) pt_section_detach(section, iscache); in pt_iscache_add()
751 (void) pt_section_put(section); in pt_iscache_add()
776 struct pt_section **section, uint64_t *laddr, int isid) in pt_iscache_lookup() argument
781 if (!iscache || !section || !laddr) in pt_iscache_lookup()
803 *section = entry->section; in pt_iscache_lookup()
806 status = pt_section_get(*section); in pt_iscache_lookup()
849 struct pt_section *section; in pt_iscache_clear() local
851 section = entries[idx].section; in pt_iscache_clear()
856 errcode = pt_section_detach(section, iscache); in pt_iscache_clear()
860 errcode = pt_section_put(section); in pt_iscache_clear()
928 struct pt_section *section; in pt_iscache_add_file() local
947 * If we found a section, we need to grab a reference before we unlock. in pt_iscache_add_file()
949 * If we didn't find a matching section, we create a new section, which in pt_iscache_add_file()
964 section = entry->section; in pt_iscache_add_file()
966 errcode = pt_section_get(section); in pt_iscache_add_file()
974 (void) pt_section_put(section); in pt_iscache_add_file()
982 section = NULL; in pt_iscache_add_file()
983 errcode = pt_mk_section(§ion, filename, offset, size); in pt_iscache_add_file()
988 /* We unlocked @iscache and hold a reference to @section. */ in pt_iscache_add_file()
989 isid = pt_iscache_add(iscache, section, vaddr); in pt_iscache_add_file()
991 /* We grab a reference when we add the section. Drop the one we in pt_iscache_add_file()
994 errcode = pt_section_put(section); in pt_iscache_add_file()
1005 struct pt_section *section; in pt_iscache_read() local
1012 errcode = pt_iscache_lookup(iscache, §ion, &laddr, isid); in pt_iscache_read()
1017 (void) pt_section_put(section); in pt_iscache_read()
1023 errcode = pt_section_map(section); in pt_iscache_read()
1025 (void) pt_section_put(section); in pt_iscache_read()
1035 status = pt_section_read(section, buffer, (uint16_t) size, vaddr); in pt_iscache_read()
1037 errcode = pt_section_unmap(section); in pt_iscache_read()
1039 (void) pt_section_put(section); in pt_iscache_read()
1043 errcode = pt_section_put(section); in pt_iscache_read()
1051 struct pt_section *section) in pt_iscache_notify_map() argument
1062 status = pt_iscache_lru_add(iscache, section); in pt_iscache_notify_map()
1075 struct pt_section *section, uint64_t memsize) in pt_iscache_notify_resize() argument
1086 status = pt_iscache_lru_resize(iscache, section, memsize); in pt_iscache_notify_resize()