linux/block/blk-iopoll.c
<<
>>
Prefs
   1/*
   2 * Functions related to interrupt-poll handling in the block layer. This
   3 * is similar to NAPI for network devices.
   4 */
   5#include <linux/kernel.h>
   6#include <linux/module.h>
   7#include <linux/init.h>
   8#include <linux/bio.h>
   9#include <linux/blkdev.h>
  10#include <linux/interrupt.h>
  11#include <linux/cpu.h>
  12#include <linux/blk-iopoll.h>
  13#include <linux/delay.h>
  14
  15#include "blk.h"
  16
  17int blk_iopoll_enabled = 1;
  18EXPORT_SYMBOL(blk_iopoll_enabled);
  19
  20static unsigned int blk_iopoll_budget __read_mostly = 256;
  21
  22static DEFINE_PER_CPU(struct list_head, blk_cpu_iopoll);
  23
  24/**
  25 * blk_iopoll_sched - Schedule a run of the iopoll handler
  26 * @iop:      The parent iopoll structure
  27 *
  28 * Description:
  29 *     Add this blk_iopoll structure to the pending poll list and trigger the
  30 *     raise of the blk iopoll softirq. The driver must already have gotten a
  31 *     successful return from blk_iopoll_sched_prep() before calling this.
  32 **/
  33void blk_iopoll_sched(struct blk_iopoll *iop)
  34{
  35        unsigned long flags;
  36
  37        local_irq_save(flags);
  38        list_add_tail(&iop->list, &__get_cpu_var(blk_cpu_iopoll));
  39        __raise_softirq_irqoff(BLOCK_IOPOLL_SOFTIRQ);
  40        local_irq_restore(flags);
  41}
  42EXPORT_SYMBOL(blk_iopoll_sched);
  43
  44/**
  45 * __blk_iopoll_complete - Mark this @iop as un-polled again
  46 * @iop:      The parent iopoll structure
  47 *
  48 * Description:
  49 *     See blk_iopoll_complete(). This function must be called with interrupts
  50 *     disabled.
  51 **/
  52void __blk_iopoll_complete(struct blk_iopoll *iop)
  53{
  54        list_del(&iop->list);
  55        smp_mb__before_clear_bit();
  56        clear_bit_unlock(IOPOLL_F_SCHED, &iop->state);
  57}
  58EXPORT_SYMBOL(__blk_iopoll_complete);
  59
  60/**
  61 * blk_iopoll_complete - Mark this @iop as un-polled again
  62 * @iop:      The parent iopoll structure
  63 *
  64 * Description:
  65 *     If a driver consumes less than the assigned budget in its run of the
  66 *     iopoll handler, it'll ="comment">/**
#L50" id=L31"  66 *     io58" id="658" class="line" name="658"> 648" class="line" name="L48"> omrt" id4
 s="line"ll.c#L32" id="L32" clas 66 *     iolass="sr6f">EXPORT_SYMBOL( **/  6must be called with interrupt>  52void  *iop)
  39  36
/**
io"sref">flags);
  38        blk_iopoll *  39        /**7(flags);
  41}
linux/in58"> 758EXPORT_SYMBOL(blk_iopoll_enabled);
 *  70/**
iIOPOLL_Sn" nam"line" name="L57OPOLL_Sn" nam#L53" id="L53" class=h"line" name="L5h 39blk_cpu_iopoll);
  55blk_cpu_iopoll));
  39__read_most6;
__read_mostly = 256;
rt_tim= href=ef="+code=__readjiffie="line" name="L4jiffie= hrenclude </**/**8();
        linux/i858"> 87/**linux/biohref=8amp;  55          8ftirq_irqoff<="block/=blk_cpu_iopoll" classop)
  53ame=e" claf="+code=__readae actne" name="L53">ae act3   2 * Function9
>>>>>>>>>>>>>>>>*>
 **/
__read_most6;
blk_cpu_iopoltim=_aftefref="block/blk-iopoljiffie="line" name="L4jiffie= hrelaf="+code=__readll_rt_tim="line" name="L57">rt_tim= hrea) >        /**96tirq_irqoff<="block/linux/i958"> 97tirq_irqoff<="block/linux/bi9href=98tirq_irqoff<="block/>linux/0">  90/**lin" idin"tirq_irqoff<="block/s+code=IOPOLL_F class="srL19"> gs);
  56        linux/cp01 idin2static l02 idin2tirq_irqoff<="block/ss="line" name="L2">   2 EveL66"ougname="L50"> " namebeeL6re-L19">  ,L32"> 52void linux/03 idin64" class="line" name="L64">>>>>>>>>>>>>>>>>*>a href#L4" afmebecauseame="L50"> "cs="only add new 52void L4"">  ,ne" nonly ll.c#blk_as 66 *     i10lk.h" cla0ss="fref">blk.h"05 idined budget in its run of the<>>>>>>>>>>>>>>>>* ss=" "cs="remoame">L4"    51 **/blk_iopoll_e07 idin7tirq_irqoff<="block/id="L53" class="line" name="L53">  53  55)
  55        EXPORT_SYMBOL(static ae act3ae act3liinux/11"tirq_irqoff<="block/s+code=IOPOLL_Fame=ne" name="L53">ame=e" c ="0nclude <linux/cpu1 idia>>_irqoff<="block/ f "block/blk-iopoltesre.c#L56" id="L56" ctesre.c#a href="+code=iop" class="sref">iop->state);
  57llinux112tirq_irqoff<="block/="block/s+code=IOPOLL_Fame=ne" name="L53">ame=e" c ="ref">state);
ae act3        linux//dela114/** 114tirq_irqoff<="block/s+code=IOPOLL_Flss="sref">__read_most6;
state)ame=ne" name="L53">ame=e" c>        blk.h"t;
/** 116tirq_irqoff<="block/"+code=IOPOLL_F class="sre="L51"gs);
        blk_iopoll_eenabl117/**EXPORT_SYMBOL(   2 * Function120" id="L220" class="line" name="L220"> 11must be called with interruppppppppppppppppp* Def="bs"L50" no" modify"line" name=7">  ,/ f liny * Function1code=blk_1iopoll_budget" class="sr1ef">b12l.c#L51" id="L51" class="linpppppppppppppppp* ock/blk linirid="L66" cae act (or mor ,/som id="L31 "cs=.25"lt * Function1cinux/cpu.22" class="line" name="L122"> 12lled again
 * @iop:12inux/blk-iiopoll.h" class="fref">liinux12
L4"OLL_ 62 * @iop:12inux/dela24" class="line" name="L124"> 1264" class="line" name="L64">>>>>>>>>>>>>>>>>*>st"
owns16"line" name=in7">ncene" naher"line" n  62 * @iop:125" id="L1f="block/blk-iopoll.c#L215" id1"L25" class="line" name="L25>>>>>>>>>>>>>>>>>*>moame">e=in7">ncenerou" nono0" i">   at-e"
<  51 **/
ame=e" c l.c#="ref">state)ae actne" name="L53">ae act3         = 2e="L51"_d="L30"ref">__read_mostly = 2e="L51"_d="L30"#L53oid="L53" class="lia href="block/blk-iopoa/void blk_iopoll *#include <iop->list, &__get_cpu_var(  55        
linux/d4"> 134/**134tirq_irqoff< f "block/blk-iopolrearm39" class="linerearm55flags<1/a>;
135tirq_irqoff<="block/bit();
BLOCK_IOPOLL_SOFTIRQ);
  40         137        local_irq_s1ave(flL19"> gs);
  56        list_add_tai1l1&<>__r1aise_130/**local_ir1q_res14L61" class="line" name="L61">  61 * blk_i1L42" id="1L42" class="line" name="1L42">14lled again
 * blk_i1Ln>
EXPORT_SYMBOL(  63 * 1464" class="line" name="L64">  64 * Descr1n>
  65 *     I1_iopoll_c1omplete - Mark this @iop1 as u1-polled again
 **/

);
iop)
  53{
        state);
  57        iop->state);
  57>_irqoff<="block/L57" id="L57" cmslee
__blk_i1opoll152tirq_irqoff(  56state);
  57        1 54list_del(&1;blk_iopoll_enabled);
);
        s1mp_mb155/**clear_bit1_unlo15
  61 * blk_i1L58" id="1L58" class="line" name="1L58">1548" class="line" name="L48"> olk_iopoll" L19">  - EnL51" " name=ono0" class= 61 * blk_i1class="sr1ef">EXPORT_SYMBOL(  63 * 15must be called with interrupt 63 *
  65 *     I1opoll_com1plete - Mark this @iop a1s un-1olled again
ato0" i href="nme="e"
 *     I1on>

 **/
 *  52void  gs);
 ="+code=iop" class="sref">iop)
  53{
iop->state);
  57
16(  56        EXPORT_SYMBOL(IOPOLL_F_SCHED, &iop->state);
  57}
 16must >
blk_iopoll_enabled);
 gs);
 ="+ca>}
  61 * blk_i17

  - I"> ializeo0" class= 61 * blk_i17ption:
  63 *
 *     i17poll han17ler, it'll ="commen17">/*17
 *     i17nabled" cllass="sref">blk_iopoll_en58">1748" class="line" name="L48">  48 * Descr17lass="sr17f">EXPORT_SYMBOL(  49 *     S170" id="L170" class="line" name="L170"> 17must be called with interrupts ializeo0" cllk_iopoll"me="L63"> . B"line"lee="Le" nvely us  ,L32= 66 *     i18>
 ()  51 **/  52void  gs);
 ="+code=iop" class="sref">iop)
  53ae act3{
        __read_mosmems"s="+coid="L53" class="lia href="block/blk-iopo,"0"bsizeof( id="L53" class="line" name="L53">  53a>}
list, &__get_cpu_var(}
/*18(ae act3ae act3linux/i1858">18(EXPORT_SYMBOL(iop->state);
  57}
 18must >
blk_iopoll_enabled);
 gs);
 ="+ca>
 gs);
 mp;inotifier_bs="sref">IOPOLL_F_Snotifier_bs="s#L53" id="L53" class=selIRQ" class="srefselIe" clstatic 
   2 * Function19poll han19ler, it'll ="commen19">/*19/span>
 * Function19ux/init.19h" class="fref">linux/i1958">1948" class="line" name="L48">>>>>>>>>*>e" name="L30" class="line3OPOLL_="a> * Function19lass="sre9" class="fref">linux/bi19href19.c#L49" id="L49" class="line>>>>>>>>*  52void linux1/0"> 19ftirq_irqoff< f "block/blk-iopoln" nam"line" name="L5n" nam#L53 ==ef="+code=__readf="_DEAop-> >        l2n" id2n"tirq_irqoff<="block/ href="+code=__readme="line" name="L5me=#L53f=e(blk-iopoll.c#)ef="+code=__readhme="line" name="L5hme=#L53>
linux/c201 id2n2static 202 id2n2tirq_irqoff<="block/sr" class="sref"class="sre="L51"gs);
        linux203 id203href="block/////////ar" class="sref">___splice#8"> gs);
___splice#8"> ="+cos="sref">list, &per_me="line" name="L5per_me=);
  39<"block/blk-iopollme="line" name="L5me=#L53)lstatic blk_cpu_iopoll));
  39        ();
BLOCK_IOPOLL_SOFTIRQ);
  40         gs);
  56        blk_iopoll_207 id2n7tirq_irqoff<>EXPORT_SYMBOL(static );

l2inux/21"tirq>linux/c2u1 id212static 2linux21struct inotifier_bs="sref">IOPOLL_F_Snotifier_bs="s#L53"f="+code=__read_ame=8"> datags);
 datamp;blk_cpu_iopolk-iopoll.c#me="notifief#L53f=e>        linux2/dela213href="block/. class="sref">inotifier_ss="ref">IOPOLL_F_Snotifier_ss="href="=ef="+code=__read_mostly" clme="notify="L21" class="lk-iopoll.c#me="notify="+clstatic  214tirq}>
blk.h&quo2t;
/** 216tirqt  gs);
 ="+ca href="+code=__read_mostly" clsck/{
blk_iopoll_2enabl217>        EXPORT_SYMBOL(
 220static unsigned int b22re({
 22>>_irqoff<="block/L57" id="L57" cINIT_LIST_HEAop->list, &per_me="line" name="L5per_me=);
  39<"block/blk-iopoll"a href="block/bl#L53>a>        2iinux22
 223e(  40        __er_hotme="notifief">blk_cpu_iopolreg>__er_hotme="notifief="+cos="sref">list, &k-iopoll.c#me="notifief">blk_cpu_iopolk-iopoll.c#me="notifief#L53a>        
 ss="ref">IOPOLL_F_Ssubsys#8"> ss=");
        

" cloriginal LXRe3OPOwarline"line       LXRelassu"> y="+clo0" clexperis="lal L31 id="tye       


fxf.ef=ux.no kindly hosck/btye