1 /*- 2 * CAM IO Scheduler Interface 3 * 4 * Copyright (c) 2015 Netflix, Inc. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions, and the following disclaimer, 12 * without modification, immediately at the beginning of the file. 13 * 2. The name of the author may not be used to endorse or promote products 14 * derived from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 #ifndef _CAM_CAM_IOSCHED_H 32 #define _CAM_CAM_IOSCHED_H 33 34 /* No user-servicable parts in here. */ 35 #ifdef _KERNEL 36 37 /* Forward declare all structs to keep interface thin */ 38 struct cam_iosched_softc; 39 struct sysctl_ctx_list; 40 struct sysctl_oid; 41 union ccb; 42 struct bio; 43 44 int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph); 45 void cam_iosched_fini(struct cam_iosched_softc *); 46 void cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); 47 struct bio *cam_iosched_next_trim(struct cam_iosched_softc *isc); 48 struct bio *cam_iosched_get_trim(struct cam_iosched_softc *isc); 49 struct bio *cam_iosched_next_bio(struct cam_iosched_softc *isc); 50 void cam_iosched_queue_work(struct cam_iosched_softc *isc, struct bio *bp); 51 void cam_iosched_flush(struct cam_iosched_softc *isc, struct devstat *stp, int err); 52 void cam_iosched_schedule(struct cam_iosched_softc *isc, struct cam_periph *periph); 53 void cam_iosched_finish_trim(struct cam_iosched_softc *isc); 54 void cam_iosched_submit_trim(struct cam_iosched_softc *isc); 55 void cam_iosched_put_back_trim(struct cam_iosched_softc *isc, struct bio *bp); 56 void cam_iosched_set_sort_queue(struct cam_iosched_softc *isc, int val); 57 int cam_iosched_has_work_flags(struct cam_iosched_softc *isc, uint32_t flags); 58 void cam_iosched_set_work_flags(struct cam_iosched_softc *isc, uint32_t flags); 59 void cam_iosched_clr_work_flags(struct cam_iosched_softc *isc, uint32_t flags); 60 void cam_iosched_trim_done(struct cam_iosched_softc *isc); 61 int cam_iosched_bio_complete(struct cam_iosched_softc *isc, struct bio *bp, union ccb *done_ccb); 62 63 #endif 64 #endif 65