Lines Matching refs:ta
438 vdev_trim_calculate_rate(trim_args_t *ta) in vdev_trim_calculate_rate() argument
440 return (ta->trim_bytes_done * 1000 / in vdev_trim_calculate_rate()
441 (NSEC2MSEC(gethrtime() - ta->trim_start_time) + 1)); in vdev_trim_calculate_rate()
449 vdev_trim_range(trim_args_t *ta, uint64_t start, uint64_t size) in vdev_trim_range() argument
451 vdev_t *vd = ta->trim_vdev; in vdev_trim_range()
460 if (ta->trim_type == TRIM_TYPE_MANUAL) { in vdev_trim_range()
462 vdev_trim_calculate_rate(ta) > vd->vdev_trim_rate) { in vdev_trim_range()
468 ta->trim_bytes_done += size; in vdev_trim_range()
475 vd->vdev_trim_inflight[ta->trim_type]++; in vdev_trim_range()
485 if (ta->trim_type == TRIM_TYPE_MANUAL && in vdev_trim_range()
500 if ((ta->trim_type == TRIM_TYPE_MANUAL && in vdev_trim_range()
502 (ta->trim_type == TRIM_TYPE_AUTO && in vdev_trim_range()
505 vd->vdev_trim_inflight[ta->trim_type]--; in vdev_trim_range()
514 if (ta->trim_type == TRIM_TYPE_MANUAL) in vdev_trim_range()
518 start, size, ta->trim_type == TRIM_TYPE_MANUAL ? in vdev_trim_range()
520 ZIO_PRIORITY_TRIM, ZIO_FLAG_CANFAIL, ta->trim_flags)); in vdev_trim_range()
535 vdev_trim_ranges(trim_args_t *ta) in vdev_trim_ranges() argument
537 vdev_t *vd = ta->trim_vdev; in vdev_trim_ranges()
538 zfs_btree_t *t = &ta->trim_tree->rt_root; in vdev_trim_ranges()
540 uint64_t extent_bytes_max = ta->trim_extent_bytes_max; in vdev_trim_ranges()
541 uint64_t extent_bytes_min = ta->trim_extent_bytes_min; in vdev_trim_ranges()
545 ta->trim_start_time = gethrtime(); in vdev_trim_ranges()
546 ta->trim_bytes_done = 0; in vdev_trim_ranges()
550 uint64_t size = rs_get_end(rs, ta->trim_tree) - rs_get_start(rs, in vdev_trim_ranges()
551 ta->trim_tree); in vdev_trim_ranges()
565 error = vdev_trim_range(ta, VDEV_LABEL_START_SIZE + in vdev_trim_ranges()
566 rs_get_start(rs, ta->trim_tree) + in vdev_trim_ranges()
740 trim_args_t *ta = arg; in vdev_trim_range_add() local
741 vdev_t *vd = ta->trim_vdev; in vdev_trim_range_add()
752 metaslab_t *msp = ta->trim_msp; in vdev_trim_range_add()
770 if (ta->trim_type == TRIM_TYPE_MANUAL) { in vdev_trim_range_add()
792 range_tree_add(ta->trim_tree, physical_rs.rs_start, in vdev_trim_range_add()
811 trim_args_t ta; in vdev_trim_thread() local
831 ta.trim_vdev = vd; in vdev_trim_thread()
832 ta.trim_extent_bytes_max = zfs_trim_extent_bytes_max; in vdev_trim_thread()
833 ta.trim_extent_bytes_min = zfs_trim_extent_bytes_min; in vdev_trim_thread()
834 ta.trim_tree = range_tree_create(NULL, RANGE_SEG64, NULL, 0, 0); in vdev_trim_thread()
835 ta.trim_type = TRIM_TYPE_MANUAL; in vdev_trim_thread()
836 ta.trim_flags = 0; in vdev_trim_thread()
844 ta.trim_flags |= ZIO_TRIM_SECURE; in vdev_trim_thread()
845 ta.trim_extent_bytes_min = SPA_MINBLOCKSIZE; in vdev_trim_thread()
879 ta.trim_msp = msp; in vdev_trim_thread()
880 range_tree_walk(msp->ms_allocatable, vdev_trim_range_add, &ta); in vdev_trim_thread()
884 error = vdev_trim_ranges(&ta); in vdev_trim_thread()
888 range_tree_vacate(ta.trim_tree, NULL, NULL); in vdev_trim_thread()
895 range_tree_destroy(ta.trim_tree); in vdev_trim_thread()
1106 trim_args_t *ta = arg; in vdev_trim_range_verify() local
1107 metaslab_t *msp = ta->trim_msp; in vdev_trim_range_verify()
1238 trim_args_t *ta = &tap[c]; in vdev_autotrim_thread() local
1239 vdev_t *cvd = ta->trim_vdev; in vdev_autotrim_thread()
1241 ta->trim_msp = msp; in vdev_autotrim_thread()
1242 ta->trim_extent_bytes_max = extent_bytes_max; in vdev_autotrim_thread()
1243 ta->trim_extent_bytes_min = extent_bytes_min; in vdev_autotrim_thread()
1244 ta->trim_type = TRIM_TYPE_AUTO; in vdev_autotrim_thread()
1245 ta->trim_flags = 0; in vdev_autotrim_thread()
1264 ta->trim_tree = range_tree_create(NULL, in vdev_autotrim_thread()
1267 vdev_trim_range_add, ta); in vdev_autotrim_thread()
1280 trim_args_t *ta = &tap[c]; in vdev_autotrim_thread() local
1286 if (ta->trim_tree == NULL || in vdev_autotrim_thread()
1287 ta->trim_vdev->vdev_trim_thread != NULL) { in vdev_autotrim_thread()
1300 int error = vdev_trim_ranges(ta); in vdev_autotrim_thread()
1325 trim_args_t *ta = &tap[c]; in vdev_autotrim_thread() local
1327 if (ta->trim_tree == NULL) in vdev_autotrim_thread()
1330 range_tree_vacate(ta->trim_tree, NULL, NULL); in vdev_autotrim_thread()
1331 range_tree_destroy(ta->trim_tree); in vdev_autotrim_thread()