Lines Matching refs:oz

33 	struct xfs_open_zone	*oz = container_of(cb, typeof(*oz), oz_rcu);  in xfs_open_zone_free_rcu()  local
35 xfs_rtgroup_rele(oz->oz_rtg); in xfs_open_zone_free_rcu()
36 kfree(oz); in xfs_open_zone_free_rcu()
41 struct xfs_open_zone *oz) in xfs_open_zone_put() argument
43 if (atomic_dec_and_test(&oz->oz_ref)) in xfs_open_zone_put()
44 call_rcu(&oz->oz_rcu, xfs_open_zone_free_rcu); in xfs_open_zone_put()
165 struct xfs_open_zone *oz) in xfs_open_zone_mark_full() argument
167 struct xfs_rtgroup *rtg = oz->oz_rtg; in xfs_open_zone_mark_full()
177 if (oz->oz_is_gc) in xfs_open_zone_mark_full()
181 list_del_init(&oz->oz_entry); in xfs_open_zone_mark_full()
184 if (oz->oz_is_gc) in xfs_open_zone_mark_full()
191 xfs_open_zone_put(oz); in xfs_open_zone_mark_full()
196 struct xfs_open_zone *oz, in xfs_zone_inc_written() argument
199 xfs_assert_ilocked(rtg_rmap(oz->oz_rtg), XFS_ILOCK_EXCL); in xfs_zone_inc_written()
201 oz->oz_written += len; in xfs_zone_inc_written()
202 if (oz->oz_written == rtg_blocks(oz->oz_rtg)) in xfs_zone_inc_written()
203 xfs_open_zone_mark_full(oz); in xfs_zone_inc_written()
213 struct xfs_open_zone *oz, in xfs_zone_skip_blocks() argument
216 struct xfs_rtgroup *rtg = oz->oz_rtg; in xfs_zone_skip_blocks()
218 trace_xfs_zone_skip_blocks(oz, 0, len); in xfs_zone_skip_blocks()
221 xfs_zone_inc_written(oz, len); in xfs_zone_skip_blocks()
232 struct xfs_open_zone *oz, in xfs_zoned_map_extent() argument
236 struct xfs_rtgroup *rtg = oz->oz_rtg; in xfs_zoned_map_extent()
296 trace_xfs_zone_record_blocks(oz, in xfs_zoned_map_extent()
303 xfs_zone_inc_written(oz, new->br_blockcount); in xfs_zoned_map_extent()
312 xfs_zone_skip_blocks(oz, new->br_blockcount); in xfs_zoned_map_extent()
322 struct xfs_open_zone *oz, in xfs_zoned_end_io() argument
350 error = xfs_zoned_map_extent(tp, ip, &new, oz, old_startblock); in xfs_zoned_end_io()
417 struct xfs_open_zone *oz; in xfs_init_open_zone() local
419 oz = kzalloc_obj(*oz, GFP_NOFS | __GFP_NOFAIL); in xfs_init_open_zone()
420 spin_lock_init(&oz->oz_alloc_lock); in xfs_init_open_zone()
421 atomic_set(&oz->oz_ref, 1); in xfs_init_open_zone()
422 oz->oz_rtg = rtg; in xfs_init_open_zone()
423 oz->oz_allocated = write_pointer; in xfs_init_open_zone()
424 oz->oz_written = write_pointer; in xfs_init_open_zone()
425 oz->oz_write_hint = write_hint; in xfs_init_open_zone()
426 oz->oz_is_gc = is_gc; in xfs_init_open_zone()
435 WRITE_ONCE(rtg->rtg_open_zone, oz); in xfs_init_open_zone()
436 return oz; in xfs_init_open_zone()
479 struct xfs_open_zone *oz; in xfs_try_open_zone() local
493 oz = xfs_open_zone(mp, write_hint, false); in xfs_try_open_zone()
495 if (!oz) { in xfs_try_open_zone()
500 atomic_inc(&oz->oz_ref); in xfs_try_open_zone()
501 list_add_tail(&oz->oz_entry, &zi->zi_open_zones); in xfs_try_open_zone()
512 trace_xfs_zone_opened(oz->oz_rtg); in xfs_try_open_zone()
513 return oz; in xfs_try_open_zone()
559 struct xfs_open_zone *oz, in xfs_try_use_zone() argument
562 if (oz->oz_is_gc) in xfs_try_use_zone()
565 if (oz->oz_allocated == rtg_blocks(oz->oz_rtg)) in xfs_try_use_zone()
568 if (xfs_zoned_hint_score[oz->oz_write_hint][file_hint] < goodness) in xfs_try_use_zone()
571 if (!atomic_inc_not_zero(&oz->oz_ref)) in xfs_try_use_zone()
582 oz->oz_write_hint == WRITE_LIFE_NOT_SET) in xfs_try_use_zone()
583 oz->oz_write_hint = file_hint; in xfs_try_use_zone()
592 if (!list_is_last(&oz->oz_entry, &zi->zi_open_zones)) in xfs_try_use_zone()
593 list_move_tail(&oz->oz_entry, &zi->zi_open_zones); in xfs_try_use_zone()
603 struct xfs_open_zone *oz; in xfs_select_open_zone_lru() local
607 list_for_each_entry(oz, &zi->zi_open_zones, oz_entry) in xfs_select_open_zone_lru()
608 if (xfs_try_use_zone(zi, file_hint, oz, goodness)) in xfs_select_open_zone_lru()
609 return oz; in xfs_select_open_zone_lru()
620 struct xfs_open_zone *oz; in xfs_select_open_zone_mru() local
624 list_for_each_entry_reverse(oz, &zi->zi_open_zones, oz_entry) in xfs_select_open_zone_mru()
625 if (xfs_try_use_zone(zi, file_hint, oz, XFS_ZONE_ALLOC_OK)) in xfs_select_open_zone_mru()
626 return oz; in xfs_select_open_zone_mru()
670 struct xfs_open_zone *oz = NULL; in xfs_select_zone_nowait() local
682 oz = xfs_select_open_zone_lru(zi, write_hint, XFS_ZONE_ALLOC_GOOD); in xfs_select_zone_nowait()
683 if (oz) in xfs_select_zone_nowait()
687 oz = xfs_select_open_zone_mru(zi, write_hint); in xfs_select_zone_nowait()
688 if (oz) in xfs_select_zone_nowait()
696 oz = xfs_try_open_zone(mp, write_hint); in xfs_select_zone_nowait()
697 if (oz) in xfs_select_zone_nowait()
703 oz = xfs_select_open_zone_lru(zi, write_hint, XFS_ZONE_ALLOC_OK); in xfs_select_zone_nowait()
704 if (oz) in xfs_select_zone_nowait()
710 oz = xfs_select_open_zone_lru(zi, write_hint, XFS_ZONE_ALLOC_ANY); in xfs_select_zone_nowait()
713 return oz; in xfs_select_zone_nowait()
724 struct xfs_open_zone *oz; in xfs_select_zone() local
726 oz = xfs_select_zone_nowait(mp, write_hint, pack_tight); in xfs_select_zone()
727 if (oz) in xfs_select_zone()
728 return oz; in xfs_select_zone()
732 oz = xfs_select_zone_nowait(mp, write_hint, pack_tight); in xfs_select_zone()
733 if (oz || xfs_is_shutdown(mp)) in xfs_select_zone()
738 return oz; in xfs_select_zone()
743 struct xfs_open_zone *oz, in xfs_zone_alloc_blocks() argument
748 struct xfs_rtgroup *rtg = oz->oz_rtg; in xfs_zone_alloc_blocks()
752 spin_lock(&oz->oz_alloc_lock); in xfs_zone_alloc_blocks()
754 (xfs_filblks_t)rtg_blocks(rtg) - oz->oz_allocated); in xfs_zone_alloc_blocks()
756 spin_unlock(&oz->oz_alloc_lock); in xfs_zone_alloc_blocks()
759 allocated = oz->oz_allocated; in xfs_zone_alloc_blocks()
760 oz->oz_allocated += count_fsb; in xfs_zone_alloc_blocks()
761 spin_unlock(&oz->oz_alloc_lock); in xfs_zone_alloc_blocks()
763 trace_xfs_zone_alloc_blocks(oz, allocated, count_fsb); in xfs_zone_alloc_blocks()
791 struct xfs_open_zone *oz; in xfs_get_cached_zone() local
794 oz = VFS_I(ip)->i_private; in xfs_get_cached_zone()
795 if (oz) { in xfs_get_cached_zone()
800 ASSERT(!oz->oz_is_gc); in xfs_get_cached_zone()
801 if (!atomic_inc_not_zero(&oz->oz_ref)) in xfs_get_cached_zone()
802 oz = NULL; in xfs_get_cached_zone()
806 return oz; in xfs_get_cached_zone()
824 struct xfs_open_zone *oz) in xfs_set_cached_zone() argument
828 atomic_inc(&oz->oz_ref); in xfs_set_cached_zone()
829 old_oz = xchg(&VFS_I(ip)->i_private, oz); in xfs_set_cached_zone()
837 struct xfs_open_zone *oz, in xfs_submit_zoned_bio() argument
841 ioend->io_private = oz; in xfs_submit_zoned_bio()
842 atomic_inc(&oz->oz_ref); /* for xfs_zoned_end_io */ in xfs_submit_zoned_bio()
857 struct xfs_open_zone **oz) in xfs_zone_alloc_and_submit() argument
874 if (!*oz) in xfs_zone_alloc_and_submit()
875 *oz = xfs_get_cached_zone(ip); in xfs_zone_alloc_and_submit()
877 if (!*oz) { in xfs_zone_alloc_and_submit()
879 *oz = xfs_select_zone(mp, write_hint, pack_tight); in xfs_zone_alloc_and_submit()
880 if (!*oz) in xfs_zone_alloc_and_submit()
882 xfs_set_cached_zone(ip, *oz); in xfs_zone_alloc_and_submit()
885 alloc_len = xfs_zone_alloc_blocks(*oz, XFS_B_TO_FSB(mp, ioend->io_size), in xfs_zone_alloc_and_submit()
888 xfs_open_zone_put(*oz); in xfs_zone_alloc_and_submit()
896 xfs_submit_zoned_bio(split, *oz, is_seq); in xfs_zone_alloc_and_submit()
898 xfs_open_zone_put(*oz); in xfs_zone_alloc_and_submit()
903 xfs_submit_zoned_bio(ioend, *oz, is_seq); in xfs_zone_alloc_and_submit()
951 struct xfs_open_zone *oz; in xfs_free_open_zones() local
954 while ((oz = list_first_entry_or_null(&zi->zi_open_zones, in xfs_free_open_zones()
956 list_del(&oz->oz_entry); in xfs_free_open_zones()
957 xfs_open_zone_put(oz); in xfs_free_open_zones()
1090 struct xfs_open_zone *oz; in xfs_init_zone() local
1093 oz = xfs_init_open_zone(rtg, write_pointer, WRITE_LIFE_NOT_SET, in xfs_init_zone()
1095 list_add_tail(&oz->oz_entry, &zi->zi_open_zones); in xfs_init_zone()
1274 struct xfs_open_zone *found = NULL, *oz; in xfs_find_fullest_conventional_open_zone() local
1277 list_for_each_entry(oz, &zi->zi_open_zones, oz_entry) { in xfs_find_fullest_conventional_open_zone()
1278 if (!xfs_zone_is_conv(oz->oz_rtg)) in xfs_find_fullest_conventional_open_zone()
1280 if (!found || oz->oz_allocated > found->oz_allocated) in xfs_find_fullest_conventional_open_zone()
1281 found = oz; in xfs_find_fullest_conventional_open_zone()
1308 struct xfs_open_zone *oz; in xfs_finish_spurious_open_zones() local
1311 oz = xfs_find_fullest_conventional_open_zone(mp); in xfs_finish_spurious_open_zones()
1312 if (!oz) { in xfs_finish_spurious_open_zones()
1319 xfs_rtgroup_lock(oz->oz_rtg, XFS_RTGLOCK_RMAP); in xfs_finish_spurious_open_zones()
1320 adjust = rtg_blocks(oz->oz_rtg) - oz->oz_written; in xfs_finish_spurious_open_zones()
1321 trace_xfs_zone_spurious_open(oz, oz->oz_written, adjust); in xfs_finish_spurious_open_zones()
1322 oz->oz_written = rtg_blocks(oz->oz_rtg); in xfs_finish_spurious_open_zones()
1323 xfs_open_zone_mark_full(oz); in xfs_finish_spurious_open_zones()
1324 xfs_rtgroup_unlock(oz->oz_rtg, XFS_RTGLOCK_RMAP); in xfs_finish_spurious_open_zones()