1 1.7 oster /* $NetBSD: rf_cvscan.h,v 1.7 2021/07/27 03:09:26 oster Exp $ */ 2 1.1 oster /* 3 1.1 oster * Copyright (c) 1995 Carnegie-Mellon University. 4 1.1 oster * All rights reserved. 5 1.1 oster * 6 1.1 oster * Author: Mark Holland 7 1.1 oster * 8 1.1 oster * Permission to use, copy, modify and distribute this software and 9 1.1 oster * its documentation is hereby granted, provided that both the copyright 10 1.1 oster * notice and this permission notice appear in all copies of the 11 1.1 oster * software, derivative works or modified versions, and any portions 12 1.1 oster * thereof, and that both notices appear in supporting documentation. 13 1.1 oster * 14 1.1 oster * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" 15 1.1 oster * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND 16 1.1 oster * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. 17 1.1 oster * 18 1.1 oster * Carnegie Mellon requests users of this software to return to 19 1.1 oster * 20 1.1 oster * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU 21 1.1 oster * School of Computer Science 22 1.1 oster * Carnegie Mellon University 23 1.1 oster * Pittsburgh PA 15213-3890 24 1.1 oster * 25 1.1 oster * any improvements or extensions that they make and grant Carnegie the 26 1.1 oster * rights to redistribute these changes. 27 1.1 oster */ 28 1.1 oster 29 1.1 oster /* 30 1.1 oster ** Disk scheduling by CVSCAN( N, r ) 31 1.1 oster ** 32 1.1 oster ** Given a set of requests, partition them into one set on each 33 1.1 oster ** side of the current arm position. The trick is to pick which 34 1.1 oster ** side you are going to service next; once a side is picked you will 35 1.1 oster ** service the closest request. 36 1.1 oster ** Let there be n1 requests on one side and n2 requests on the other 37 1.1 oster ** side. If one of n1 or n2 is zero, select the other side. 38 1.1 oster ** If both n1 and n2 are nonzero, select a "range" for examination 39 1.1 oster ** that is N' = min( n1, n2, N ). Average the distance from the 40 1.1 oster ** current position to the nearest N' requests on each side giving 41 1.1 oster ** d1 and d2. 42 1.1 oster ** Suppose the last decision was to move toward set 2, then the 43 1.1 oster ** current direction is toward set 2, and you will only switch to set 44 1.1 oster ** 1 if d1+R < d2 where R is r*(total number of cylinders), r in [0,1]. 45 1.1 oster ** 46 1.1 oster ** I extend this by applying only to the set of requests that all 47 1.1 oster ** share the same, highest priority level. 48 1.1 oster */ 49 1.1 oster 50 1.1 oster #ifndef _RF__RF_CVSCAN_H_ 51 1.1 oster #define _RF__RF_CVSCAN_H_ 52 1.1 oster 53 1.1 oster #include "rf_diskqueue.h" 54 1.1 oster 55 1.1 oster typedef enum RF_CvscanArmDir_e { 56 1.3 oster rf_cvscan_LEFT, 57 1.3 oster rf_cvscan_RIGHT 58 1.3 oster } RF_CvscanArmDir_t; 59 1.1 oster 60 1.1 oster typedef struct RF_CvscanHeader_s { 61 1.3 oster long range_for_avg; /* CVSCAN param N */ 62 1.3 oster long change_penalty; /* CVSCAN param R */ 63 1.3 oster RF_CvscanArmDir_t direction; 64 1.3 oster RF_SectorNum_t cur_block; 65 1.3 oster int nxt_priority; 66 1.3 oster RF_DiskQueueData_t *left; 67 1.3 oster int left_cnt; 68 1.3 oster RF_DiskQueueData_t *right; 69 1.3 oster int right_cnt; 70 1.3 oster RF_DiskQueueData_t *burner; 71 1.3 oster } RF_CvscanHeader_t; 72 1.3 oster 73 1.3 oster void * 74 1.3 oster rf_CvscanCreate(RF_SectorCount_t sect_per_disk, 75 1.3 oster RF_AllocListElem_t * cl_list, RF_ShutdownList_t ** listp); 76 1.3 oster void rf_CvscanEnqueue(void *qptr, RF_DiskQueueData_t * req, int priority); 77 1.1 oster RF_DiskQueueData_t *rf_CvscanDequeue(void *qptr); 78 1.5 perry int 79 1.3 oster rf_CvscanPromote(void *qptr, RF_StripeNum_t parityStripeID, 80 1.3 oster RF_ReconUnitNum_t which_ru); 81 1.1 oster 82 1.3 oster #endif /* !_RF__RF_CVSCAN_H_ */ 83