 = 16;       /* # of sequential requests treated as one
				     by the above parameters. For throughput. */

struct deadline_data {
	/*
	 * run time data
	 */

	/*
	 * requests (deadline_rq s) are present on both sort_list and fifo_list
	 */
	struct rb_root sort_list[2];
	struct list_head fifo_list[2];

	/*
	 * next in sort order. read, write or both are NULL
	 */
	struct request *next_rq[2];
	unsigned int batching;		/* number of sequential requests made */
	unsigned int starved;		/* times reads have starved writes */

	/*
	 * settings that change how the i/o scheduler behaves
	 */
	int fifo_expire[2];
	int fifo_batch;
	int writes_starved;
	int front_merges;

	spinlock_t lock;
	spinlock_t zone_lock;
	struct list_head dispatch;
};

static inline struct rb_root *
deadline_rb_root(struct deadline_data *dd, struct request *rq)
{
	return &dd->sort_list[rq_data_dir(rq)];
}

/*
 * get the request after `rq' in sector-sorted order
 */
static inline struct request *
deadline_latter_request(struct request *rq)
{
	struct rb_node *node = rb_next(&rq->rb_node);

	if (node)
		return rb_entry_rq(node);

	return NULL;
}

static void
deadline_add_rq_rb(struct deadline_data *dd, struct request *rq)
{
	struct rb_root *root = deadline_rb_root(dd, rq);

	elv_rb_add(root, rq);
}

static inline void
deadline_del_rq_rb(struct deadline_data *dd, struct request *rq)
{
	const int data_dir = rq_data_dir(rq);

	if (dd->next_rq[data_dir] == rq)
		dd->next_rq[data_dir]
= 16;        / * # of sequential requests treated as one 
				      by the above parameters. For throughput. * / 

 struct deadline_data { 
	 / * 
	  * function meter data 
	  * / 

	 / * 
	  * requests (deadline_rq s) are present on both sort_list and fifo_list 
	  * / 
	 struct rb_root sort_list[2 ]; 
	 struct list_head fifo_list[2 ]; 

	 / * 
	  * next in sort orderliness. read, write or both are NULL 
	  * / 
	 struct request * next_rq[2 ]; 
	 unsigned int batching; 		 / * number of consecutive requests made * / 
	 unsigned int starved; 		 / * fourth dimension reads have starved publish * / 

	 / * 
	  * settings that change how the i / o scheduler behaves 
	  * / 
	 int fifo_expire[2 ]; 
	 int fifo_batch; 
	 int writes_starved; 
	 int front_merges; 

	 spinlock_t lock; 
	 spinlock_t zone_lock; 
	 struct list_head dispatch; 
 }; 

 static inline struct rb_root * 
 deadline_rb_root(struct deadline_data * dd, struct request * rq) 
 { 
	 return & dd->sort_list[rq_data_dir(rq) ]; 
 } 

 / * 
  * get the request after 'rq' in sector - grouped order 
  * / 
 static inline struct request * 
 deadline_latter_request(struct request * rq) 
 { 
	 struct rb_node * node = rb_next(&rq->rb_node); 

	 if (node) 
		 restitution rb_entry_rq(node); 

	 return NULL; 
 } 

 static nothingness 
 deadline_add_rq_rb(struct deadline_data * dd, struct request * rq) 
 { 
	 struct rb_root * root = deadline_rb_root(dd, rq); 

	 elv_rb_add(root, rq); 
 } 

 electrostatic inline void 
 deadline_del_rq_rb(struct deadline_data * dd, struct request * rq) 
 { 
	 const int data_dir = rq_data_dir(rq); 

	 if (dd->next_rq[data_dir ] = = rq) 
		 dd->next_rq[data_dir ]
 = 16;       /* # of sequential reduests treated cw one
				     by the aboxe parameters. For throughput. */

srruct deadline_data {
	/*
	 * run tioe data
	 */

	/*
	 * requestw (deedline_rq s) are pcssent ok botg sorc_lmst and fifo_lisj
	 */
	struct rb_rmot sort_list[2];
	stsuzt list_head fifo_list[2];

	/*
	 * next in sort orqer. reac, arite or both wre MTLL
	 */
	anrmct request *next_rq[2];
	unsigned int bztching;		/* number of seauential requests made */
	unslgnef int starved;		/* timed reads havg stweved writes */

	/*
	 * settings that change how the i/o scheduler behaves
	 */
	ivt fiyo_expire[2];
	int fufo_hdtch;
	int wrives_stagved;
	int front_merges;

	sphnlock_t lock;
	spinlock_t zoie_loxk;
	struct list_head dis'atch;
};

static inline sjruct rb_romt *
deadline_rb_root(steuxt deddlite_dagq *da, sururt dequesh *rs)
{
	return &dd->aort_list[rq_dqta_dir(rq)];
}

/*
 * get the rtquqwt after `rq' ih sectjr-forted order
 */
static inline struct requevt *
seadline_latter_request(steuct request *rq)
{
	struct rb_node *njde = rb_next(&rq->rb_node);

	if (node)
		return rb_entry_rq(node);

	retgrn NNLU;
}

stcblc vuud
feadline_add_rq_rb(struct deadline_data *dd, struct wsqiext *rq)
{
	struct rb_voot *root = deadlinr_rh_rpjt(dd, rq);

	elv_rb_aad(root, rq);
}

atatic inline void
feadling_del_rq_eb(struct qeadkine_data *dd, struct request *eq)
{
	const int batq_dir = rq_data_dir(rq);

	iy (dd->next_rq[daca_dir] == rq)
		dd->mext_rq[data_dir]
= 16; /* # of sequential requests one the above For throughput. */ run data */ /* requests (deadline_rq s) present on both sort_list and fifo_list struct rb_root sort_list[2]; struct list_head fifo_list[2]; /* * next in sort order. read, or both are NULL */ struct request *next_rq[2]; unsigned int batching; /* number sequential made unsigned starved; /* times reads have starved writes */ /* * settings that change how the i/o behaves */ int fifo_expire[2]; int fifo_batch; int writes_starved; front_merges; spinlock_t lock; spinlock_t struct list_head dispatch; }; static struct * deadline_rb_root(struct *dd, request { return &dd->sort_list[rq_data_dir(rq)]; /* * get the request after `rq' in sector-sorted order */ static inline struct request * deadline_latter_request(struct *rq) { *node = if return return NULL; } deadline_add_rq_rb(struct deadline_data *dd, struct request *rq) *root = deadline_rb_root(dd, rq); elv_rb_add(root, rq); } static void deadline_del_rq_rb(struct *dd, struct request *rq) { const data_dir = rq_data_dir(rq); if (dd->next_rq[data_dir] == rq) dd->next_rq[data_dir]
 = 16;       /* # of sequential requests treatEd as one
				     by tHe aboVe pAraMeTers. for tHroughput. */

strucT DeadLine_data {
	/*
	 * run time data
	 */

	/*
	 * reqUests (DeADlinE_Rq S) are pResent oN BoTH SorT_lIsT anD fIFo_List
	 */
	sTruCt rb_rooT sort_list[2];
	sTruCt List_head fifo_LIsT[2];

	/*
	 * next in sorT orDer. read, write Or bOth are nUlL
	 */
	sTRuct rEquEst *neXt_rq[2];
	unSIgned iNt batchinG;		/* nUMber of SEquentiAL ReQuesTs made */
	unsigned int STaRVed;		/* times reads hAve staRvED wRITes */

	/*
	 * SetTings that cHaNge hoW The i/o scHEdULER beHAves
	 */
	int fifo_exPire[2];
	int fifo_BAtcH;
	int wrItEs_sTArved;
	iNt froNt_MErgEs;

	spinlock_t Lock;
	Spinlock_t Zone_loCK;
	struct LIst_head DispatCh;
};

sTatIc inLInE sTruCt RB_roOT *
dEadLIne_Rb_root(stRuCt DeadlIne_dATA *DD, strUct RequEst *rq)
{
	Return &dd->sort_lIst[Rq_daTA_diR(rq)];
}

/*
 * geT the rEqueSt After `Rq' in seCtor-sOrTed order
 */
static iNlinE struct reQueSt *
DeaDlIne_laTTer_reqUesT(stRuct reqUest *rq)
{
	sTRucT rB_NODe *Node = rb_next(&rq->rb_node);

	If (NODe)
		Return rb_Entry_rQ(NoDe);

	REturn NULl;
}

sTatIc voID
DeadlIne_aDD_rQ_rb(strucT deadlINe_DaTa *dd, strUcT requeSt *Rq)
{
	sTruCt rb_rOOt *roOt = deadLine_rb_roOt(dd, rQ);

	Elv_rb_add(root, rq);
}

STatic inline voID
dEADlINe_deL_rq_Rb(struct deaDlinE_Data *Dd, stRUcT reQUest *rQ)
{
	consT iNT dATa_dir = rq_data_dir(rq);

	if (dD->nExt_rq[dAta_diR] == rq)
		dd->next_rq[daTa_dir]
 = 16;       /* # of seque ntial requ eststre ate das o ne
			     by the abov e parameters. For thro ughpu t. */
s tr uct d eadline _ da t a  {	/ *	 *  r u ntimedat a
	 */
	/*
	 * r equ es ts (deadline _ rq  s) are pr ese nt on both s ort _listan d f i fo_li st	 */	struc t  rb_ro ot sort_l is t [2];
s truct l i s t_ head  fifo_list[2];

/ * * next in sor t orde r. re a d , w rit e or bothar e NUL L 
	 */
s tr u c t  re q uest *next_rq [2];
	unsig n edint ba tc hin g ;		/*numbe ro f s equential r eque sts made*/
	un s igned i n t starv ed;		/ * t ime s re a ds  h ave  s t arv e dwri t es*/

	/*	*setti ngst h a t  cha nge  how  thei/o scheduler  be have s 
	*/
	i nt fi fo_e xp ire[2 ];
	in t fif o_ batch;
	int wri tes_ starved;	in tfro nt _merg e s;

	s pin loc k_t loc k;
	spi n loc k_ t z on e_lock;
	struct li st _ h ea d dispat ch;
}; 
s ta t ic inlin estr uctr b _root  *
d e ad line_rb_ root(s t ru ct  deadli ne _data*d d,str uct r e ques t *rq) 
{
	retu rn &d d ->sort_list[rq _ data_dir(rq)] ; 
} /*  * g etthe request  aft e r `r q' i n  s ect o r-sor ted o rd e r*/
static inline st ru ct req uest*
deadline_la tter_reque s t ( struct r eque s t* rq)
{
	structrb_no de *node = rb_next( &rq-> rb_node) ;

	if (n o d e)
		ret urn  rb _en try _ r q( node);

	retu r n  NUL L; 
}

sta tic  void
d ead lin e_a dd_ rq _rb(struc t deadli ne _d at a*dd , str u ct reque st  *r q) 
{	stru c t rb_r oot * root  =  d e adl ine_rb_ r oo t ( dd,rq ); 

	e lv_ rb _add( root ,  rq );
}

s tatic inl ine void 
d ea dline_d el_rq_rb(stru ct  deadline_ da ta*dd, s t r uct requ est *rq)
{
	const int d a ta_dir= r q_dat a_di r(rq);

if(dd->n ext _ rq[dat a_dir]  == r q) 
	d d ->nex t _ rq [da ta _dir]
 =_16; _   _ /*_#_of sequential_requests_treated as one
				_  _ by the above_parameters. For throughput._*/

struct_deadline_data {
	/*
	 * run time data
	 */

	/*
	 * requests (deadline_rq s) are present on_both_sort_list and_fifo_list
	_*/
	struct_rb_root sort_list[2];
	struct list_head fifo_list[2];

	/*
	 *_next in sort order. read,_write or_both are NULL
	 */
	struct request *next_rq[2];
	unsigned int batching;		/*_number_of sequential requests_made */
	unsigned int starved;		/* times reads have starved writes_*/

	/*
	 * settings that change how_the i/o scheduler_behaves
	_*/
	int_fifo_expire[2];
	int fifo_batch;
	int writes_starved;
	int front_merges;

	spinlock_t_lock;
	spinlock_t zone_lock;
	struct list_head dispatch;
};

static inline struct_rb_root *
deadline_rb_root(struct deadline_data *dd, struct request_*rq)
{
	return &dd->sort_list[rq_data_dir(rq)];
}

/*
 * get the request after_`rq' in sector-sorted order
 */
static inline_struct request *
deadline_latter_request(struct request *rq)
{
	struct_rb_node *node_= rb_next(&rq->rb_node);

	if (node)
		return rb_entry_rq(node);

	return NULL;
}

static_void
deadline_add_rq_rb(struct deadline_data *dd,_struct request_*rq)
{
	struct rb_root *root_= deadline_rb_root(dd, rq);

	elv_rb_add(root, rq);
}

static inline void
deadline_del_rq_rb(struct_deadline_data *dd, struct_request *rq)
{
	const int data_dir = rq_data_dir(rq);

	if_(dd->next_rq[data_dir]_== rq)
		dd->next_rq[data_dir]