linux/Documentation/filesystems/fiemap.txt
<<
>>
Prefs
   1============
   2Fiemap Ioctl
   3============
   4
   5The fiemap ioctl is an efficient method for userspace to get file
   6extent mappings. Instead of block-by-block mapping (such as bmap), fiemap
   7returns a list of extents.
   8
   9
  10Request Basics
  11--------------
  12
  13A fiemap request is encoded within struct fiemap:
  14
  15struct fiemap {
  16        __u64   fm_start;        /* logical offset (inclusive) at

  v2.6.2tion value="v2.1tems/fiemap.txt4p(inclusive) at
   8
   9
  10Request B2sics
20m_start;       32* logiflagsffset (incluFIEMAP_FLAG_* flags filethin strpin/out) */on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	2ne" name2"L11">  11---------2----
21m_start;       32* logi), fed_umentat;nclunumber"Documentat that werion/filesystems/fiemap.txt#L6" id="L6" class="lin2e" name=""L2">   2Fiemap IoctDocum22xt4p(inclusive) at
  13A fiemap 2eques23m_start;       32* logiumenta="dunt;nclusize"Docogiumentav arrayapin) */on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	2ne" name2"L14">  14
  15struct fi2map {25m_start;    ef="Documentaiumentacogiumentav[0];ncluarrayaDoc), fed umentav (out) */on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	2ne" name2"L16">  16        _2u64  2fm_st};on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	2 >
  v2.2.2tion value="v2.1tems/2iemap27tation/filesystems/fiemap.txt#L15" id="L15" class="l2e" name=2"L8">   8
   9
  10Request B3sics
30m_stohia hD efprocess wouldhreke block-by fil. Ementav ents.
ed mirroron/filesystems/fiemap.txt#L6" id="L6" class="lin3ne" name3"L11">  11---------3----
31m_st gese"Dn disk - that is, theusive) at
   2Fiemap Ioc3Docum32xt4pmayacal opbefile ogical o,fordltheurange:coverid by theusastrents.
edon/filesystems/fiemap.txt#L6" id="L6" class="lin3e" name=""L3">   3===========eques33Instead of blyt fd after"ogilength. Alat
  14
  15struct fi3map {35m_stCertahreflags Docmodify theuwlythreohia hblock-by are      16        _3u64  3fm_st hrehrefgiflags-bloctheuke.
el doesn't unda htordlsomefpl oicularon/filesystems/fiemap.txt#L6" id="L6" class="lin3 >
  v2.3.2tion value="v2.1tems/3iemap37tatiflags, it wilatut typeEBADRfordltheu"done" i"Docogiflags wilat"donahron/filesystems/fiemap.txt#L6" id="L6" class="lin3e" name=3"L8">   8
   9
  10Request B4sics
40m_stItructup"Doc
  11---------4----
41tatiflagructfat atDoci i"Dpermap.t. Thuctschemefuctione"map:Docalaowltheon/filesystems/fiemap.txt#L6" id="L6" class="lin4e" name=4"L2">   2Fiemap Ioc4Docum42xt4pficient onerfef="Docurowlhret effu tye but:
   3==========4eques43Instcompmapbility:
   4
  15struct fi4map {45xt4pogiumenta="dunt specifieset efnumber"Doculeme" i"hret effgiumentav[]uarrayon/filesystems/fiemap.txt#L15" id="L15" class="l4ne" name4"L16">  16        _4u64  46m_st gat carebi 
   8
   9
  10Request B5sics
50m_stnoa hrgutotprev of t eft#L6 from changhrgubetweenl) als DocFIEMAPion/filesystems/fiemap.txt#L8" id="L8" class="lin5ne" name5"L11">  11---------5----
51tation/filesystems/fiemap.txt#L5" id="L5" class="linee" name=5"L2">   2Fiemap Ioc5Docum52is an effolaowhrguflags carebi  hrehrefgiflagsion/filesystems/fiemap.txt#L14" id="L14" class="l5e" name=5"L3">   3==========5eques53tation/filesystems/fiemap.txt#L5" id="L5" class="linee" name=5"L4">   4
   5The fiemap map {55xt4plocthuctflagruct hr,ctheuke.
el wilatsync t eft#L6 befile ), fiemaumentation/filesystems/fiemap.txt#L8" id="L8" class="lin5ne" name5"L16">  16        _5u64  56tation/filesystems/fiemap.txt#L5" id="L5" class="line >
  v2.5.2tion value="v2.1tems/5iemap57tatiluFIEMAP_FLAG_XATTRon/filesystems/fiemap.txt#L5" id="L5" class="linee" name=5"L8">   8
   9
  10Request B6sics
60tation/filesystems/fiemap.txt#L5" id="L5" class="lin6ne" name6"L11">  11---------6----
61tation/filesystems/fiemap.txt#L5" id="L5" class="lin6e" name=6"L2">   2Fiemap Ioc6Docum62is aEmenta M, fiemon/filesystems/fiemap.txt#L5" id="L5" class="lin6e" name=6"L3">   3==========6eques63 href="Documentation/filesystems/fiemap.txt#L12" id="L12" class="l6e" name=6"L4">   4
   5The fiemap6map {65is aEmenta inss="map.tructents.
ed wia hret efembedmap:ogiumentav arrayon/filesystems/fiemap.txt#L15" id="L15" class="l6e" name=""L6">   6extent mappu64  66m_stohia h
   8
   9
  10Request B7sics
70tatialaocatedructless than wouldhbe enquiradltotienttheurhin stadlrange,on/filesystems/fiemap.txt#L7" id="L7" class="linene" name7"L11">  11---------7----
71m_st ge maximumunumber"Documentat that carebi ), fed hret effgiumenta[]on/filesystems/fiemap.txt#L7" id="L7" class="linee" name=7"L2">   2Fiemap Ioc7Docum72is aarrayfwilatbe ents.
edfordlogi), fed_umentat wilatbe hin atDoon/filesystems/fiemap.txt#L7" id="L7" class="linee" name=7"L3">   3==========7eques73xt4pogiumenta="dunt. In that case, theusastrementa in theuarrayfwilatnoaon/filesystems/fiemap.txt#L7" id="L7" class="linee" name=7"L4">   4
   5The fiemap7map {75tatiflagr hrefseettheunemer h="pos"Dpeumentauflags)ion/filesystems/fiemap.txt#L8" id="L8" class="lin7e" name=7"L6">   6extent map7u64  76tation/filesystems/fiemap.txt#L5" id="L5" class="lin7e" name=""L7">   7returns a liemap77tatiEaa hementa istdescribed byua sk-bleffmentaiumentatef="Dotye avon/filesystems/fiemap.txt#L7" id="L7" class="linee" name=7"L8">   8
   9
  10Request B8sics
80a href="Documentaiumentation/filesystems/fiemap.txt#L16" id="L16" class="l8ne" name8"L11">  11---------8----
81m_start;        /* loe_sive) a;inclusive) at
   2Fiemap Ioc8Docum82xt4p(inclusive) at
   3==========8eques83m_start;        /* loe_physe) a;icluphyse) at
   4
   5The fiemap8map {85m_start;        /* loe_sengthffseclusength hrebytet file ge ementa */on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	8e" name=8"L6">   6extent map8u64  8fm_start;        /* loeidiverved64[2];on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	8e" name=8"L7">   7returns a 8iemap87m_start;       32* loeiflagsffsetcluFIEMAP_EXTENT_* flags filethuctementa */on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	8e" name=""L8">   8
   9
  10Request B9sics
90tation/filesystems/fiemap.txt#L5" id="L5" class="lin9ne" name9"L11">  11---------9----
91m_stAlat
   2Fiemap Ioc9Docum92xt4pfor apeumentatusive) at
   3==========9eques93m_stsength to umentd p  t theurhin sti bUnless FIEMAP_EXTENT_NOT_ALIGNEDfucon/filesystems/fiemap.txt#L5" id="L5" class="lin9e" name=9"L4">   4
   5The fiemap9map {95m_sts bmapsize"Doct eft#L6 " id="i bW   6extent map9u64  9fm_stFIEMAP_EXTENT_MERGED,fodjacnta umentat wilatnoa bi )ergedion/filesystems/fiemap.txt#L8" id="L8" class="lin9e" name=9"L7">   7returns a 9iemap97tation/filesystems/fiemap.txt#L15" id="L15" class="l9e" name=9"L8">   8
   9
  10Request Bassicsassm_st ge t#L6 "o that thefprocess makhrguficient) als caredeterm/a> whentnoon/filesystems/fiemap.txt#L10" id="L10" class="linne" name=0"L11">  11----------01icsas1m_stmile umentav are available, 
  12
  13A fiemap r03icsas3m_stSomefflags are hrentap.t alytvaguefordlwilatolways bi  hrehretheon/filesystems/fiemap.txt#L6" id="L6" class="lin10ne" name=0"L14">  14
  15struct fie05icsas5m_sta generaatproperty doestnoa havetto know alatexisthrguordlou tye flagson/filesystems/fiemap.txt#L6" id="L6" class="lin10ne" name=0"L16">  16        __06icsas6m_stohia himply that propertyion/filesystems/fiemap.txt#L8" id="L8" class="lin10 >
  v2.60.2tion value="v2.1tems/f07icsas7tation/filesystems/fiemap.txt#L15" id="L15" class="l10e" name=10"L8">   8
   9
  10Request Baasics1 or nahl-pac  11-----------1icsa  12
  13A fiemap rreque1t is eworry"aboutaalatpdiventuordlou tye flagseohia hbt;">himply unalignadon/filesystems/fiemap.txt#L7" id="L7" class="lin1ine" name=="L14">  14
  15struct fieemap 1
  16        ___u64 116tation/filesystems/fiemap.txt#L5" id="L5" class="lin1  >
  v2.66.2tion value="v2.1tems/ffiema117tatiluFIEMAP_EXTENT_LASTon/filesystems/fiemap.txt#L7" id="L7" class="lin1 e" name=11"L8">   8
   9
  10Request B12sics120tation/filesystems/fiemap.txt#L5" id="L5" class="lin12ne" name12"L11">  11---------12----121m_stluFIEMAP_EXTENT_UNKNOWNon/filesystems/fiemap.txt#L5" id="L5" class="lin12ne" name=""L12">  12
  13A fiemap 12eque123m_sttheudat "uct torid os"areinaccesspbti vols/f or nhat not torage hacon/filesystems/fiemap.txt#L5" id="L5" class="lin12ne" name12"L14">  14
  15struct fi12map 125m_ston/filesystems/fiemap.txt#L5" id="L5" class="lin12ne" name=2"L16">  16        _12u64 12fm_stluFIEMAP_EXTENT_DELALLOCon/filesystems/fiemap.txt#L5" id="L5" class="lin12 >
  v2.12.2tion value="v2.1tems/12iema127m_star-bThuctwilatol"o  hreFIEMAP_EXTENT_UNKNOWN.on/filesystems/fiemap.txt#L5" id="L5" class="lin12e" name=12"L8">   8
   9
  10Request B13sics130tation/filesystems/fiemap.txt#L5" id="L5" class="lin13ne" name13"L11">  11---------13----131m_stluFIEMAP_EXTENT_ENCODEDon/filesystems/fiemap.txt#L5" id="L5" class="lin13ne" name=3"L2">   2Fiemap Ioc13Docu132is an uctementa doestnoa consef="Docplahref#L5" id="ng (sus but:ucon/filesystems/fiemap.txt#L5" id="L5" class="lin13ne" name=""L13">  13A fiemap reeque133Instefiemap:(e.g. efiryptedrilecompdivsed).  R      14


<.on/filesystems/fiemap.txt#L5" id="L5" class="lin13ne" name=3"L15">  15struct fi13map 135m_ston/filesystems/fiemap.txt#L5" id="L5" class="lin13ne" name13"L16">  16        _13u64 13fm_stNote that ia it *olways*tundafinadltottry"Doc
pdatettheudat on/filesystems/fiemap.txt#L5" id="L5" class="lin13 >
  v2.13.2tion value="v2.1tems/13iema137tatiin-place by writhrgutottheuindicatedtaocatpos"
   8
   9
  10Request B14sics140m_stuctmduntedi blncothelewords,h
  11---------14----141tatiementa dat "vialI/Oltottheng (su device while theft#L6" id=":ucon/filesystems/fiemap.txt#L5" id="L5" class="lin14e" name=14"L2">   2Fiemap Ioc14Docu142xt4punmounted,fordlthentonly ifttheuFIEMAP_EXTENT_ENCODEDtflagrucon/filesystems/fiemap.txt#L5" id="L5" class="lin14ne" name=4"L3">   3==========14eque143Instclear;h
  14
  15struct fi14map 145m_ston/filesystems/fiemap.txt#L5" id="L5" class="lin14ne" name14"L16">  16        _14u64 14fm_stluFIEMAP_EXTENT_DATA_ENCRYPTEDon/filesystems/fiemap.txt#L5" id="L5" class="lin14 >
  v2.14.2tion value="v2.1tems/14iema147m_star-bThuctwilatol"o  hreFIEMAP_EXTENT_ENCODEDon/filesystems/fiemap.txt#L5" id="L5" class="lin14e" name=14"L8">   8
   9
  10Request B15sics150m_stluFIEMAP_EXTENT_NOT_ALIGNEDon/filesystems/fiemap.txt#L10" id="L10" class="liene" name15"L11">  11---------15----151tatiEmenta 
   2Fiemap Ioc15Docu15ntation/filesystems/fiemap.txt#L13" id="L13" class="li5e" name=15"L3">   3==========15eque153tatiluFIEMAP_EXTENT_DATA_INLINEon/filesystems/fiemap.txt#L13" id="L13" class="li5ne" name=5"L4">   4
   5The fiemap1 map 155xt4pDat "uctaocatedrwia hrea to afdat "g (suion/filesystems/fiemap.txt#L5" id="L5" class="lin1ene" name15"L16">  16        _15u64 156tation/filesystems/fiemap.txt#L5" id="L5" class="lin1e >
  v2.15.2tion value="v2.1tems/15iema157tatiluFIEMAP_EXTENT_DATA_TAILon/filesystems/fiemap.txt#L15" id="L15" class="l1ee" name=15"L8">   8
   9
  10Request B16sics160tation/filesystems/fiemap.txt#L5" id="L5" class="lin16ne" name16"L11">  11---------16----161m_stluFIEMAP_EXTENT_UNWRITTENon/filesystems/fiemap.txt#L5" id="L5" class="lin16e" name=16"L2">   2Fiemap Ioc16Docu162is aUnwrittepeumentau-ctheuementa d folaocatedrbut:u i"dat "hactnoa bienon/filesystems/fiemap.txt#L5" id="L5" class="lin16e" name=16"L3">   3==========16eque163 hreinithalizedi bn uctindicatesctheuementa't dat "wilatbe alltzero iftr maon/filesystems/fiemap.txt#L5" id="L5" class="lin16ne" name=6"L4">   4
   5The fiemap16map 165is atheudeviceion/filesystems/fiemap.txt#L5" id="L5" class="lin16ne" name=""L16">  16        __uu64 166tation/filesystems/fiemap.txt#L5" id="L5" class="lin1e >
  v2.16.2tion value="v2.1tems/16iema167tatiluFIEMAP_EXTENT_MERGEDon/filesystems/fiemap.txt#L5" id="L5" class="lin1ee" name=16"L8">   8
   9
  10Request B17sics170tati
  11---------17----171m_stodjacnta g (sus  onoc'umentat'ion/filesystems/fiemap.txt#L5" id="L5" class="lin1ee" name=17"L2">   2Fiemap Ioc17Docu17ntation/filesystems/fiemap.txt#L13" id="L13" class="liee" name=17"L3">   3==========17eque173tation/filesystems/fiemap.txt#L5" id="L5" class="lin1ee" name=17"L4">   4
   5The fiemap17map 175tati---------------------------------on/filesystems/fiemap.txt#L5" id="L5" class="lin1ene" name=7"L6">   6extent map17u64 176tation/filesystems/fiemap.txt#L5" id="L5" class="lin17 >
  v2.6..2tion value="v2.1tems/fiiema177tatiF#L6 " id="ctwis hrgutotsuppora ficientmustcimple/fiecan-	   8
   9
  10Request B18sics180a hreaa hdiscoverid umentaion/filesystems/fiemap.txt#L14" id="L14" class="li8ne" name18"L11">  11---------18----181tation/filesystems/fiemap.txt#L5" id="L5" class="lin18e" name=18"L2">   2Fiemap Ioc18Docu182xt4pef="Docinode_Dpermap.tstion/filesystems/fiemap.txt#L16" id="L16" class="li8e" name=18"L3">   3==========18eque183m_start;   ..ion/filesystems/fiemap.txt#L5" id="L5" class="lin18e" name=18"L4">   4
   5The fiemap18map 185m_start;    on (*15" cl)(ef="Docinode *, ef="Documentaiumenta_inss *,   /*cal o,on/filesystems/fiemap.txt#L15" id="L15" class="li8ne" name=8"L6">   6extent map18u64 18fm_start;                   /*len);on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	18e" name=18"L7">   7returns a 18iema187tation/filesystems/fiemap.txt#L15" id="L15" class="l18e" name=1""L8">   8
   9
  10Request B19sics190tation/filesystems/fiemap.txt#L5" id="L5" class="lin19ne" name19"L11">  11---------19----191m_stef="Documentaiumenta_inss ion/filesystems/fiemap.txt#L16" id="L16" class="li9e" name=19"L2">   2Fiemap Ioc19Docu192xt4p(inclusiunseg
ed hrocumiflagsffset (inetcluFlags as p   ed from 
   3==========19eque193xt4p(inclusiunseg
ed hrocumiumentati), fed;icluNumber"Docm, fed umentav */on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	 9e" name=19"L4">   4
   5The fiemap19map 195m_start;    ef="Documentaiumentac*umiumentatical offcluSal opofcomentaiumentatarrayf*/on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	 9ne" name=9"L6">   6extent map19u64 19fm_st};on/filesystems/fiemap.txt#L17" id="L1"v2.6.25"
	19e" name=19"L7">   7returns a 19iema197tation/filesystems/fiemap.txt#L15" id="L15" class="l19e" name=19"L8">   8
   9
  10Request B2ssics200tation/filesystems/fiemap.txt#L5" id="L5" class="lin2nne" name20"L11">  11---------201ics201tation/filesystems/fiemap.txt#L5" id="L5" class="lin20ne" name20"L12">  12
  13A fiemap 203ics2s3m_stomentaichec  14
  15struct fi205ics2s5m_sthrocumentaichec  16        _206ics206tation/filesystems/fiemap.txt#L5" id="L5" class="lin20 >
  v2.20.2tion value="v2.1tems/207ics2s7tatiTge  a="Documeinss shouldhbe p   ed hreactenceived from imeth_" clas(). Thion/filesystems/fiemap.txt#L6" id="L6" class="lin20e" name=20"L8">   8
   9


 s inon/filesystems/fiemap.txt#L10" id="L10" class="l2nne" name2="L10">  10Request B2asics2  11---------2-1ics2  12
  13A fiemap 2reque213tation/filesystems/fiemap.txt#L5" id="L5" class="lin2ine" name2="L14">  14
  15struct fi2emap 2
  16        _2_u64 216is atheuhelpeletun="posumentati_" ll_nemeiumenta()ion/filesystems/fiemap.txt#L14" id="L14" class="l2  >
  v2.26.2tion value="v2.1tems/2fiema217tation/filesystems/fiemap.txt#L15" id="L15" class="l2 e" name=21"L8">   8
   9
  10Request B22sics220tation/filesystems/fiemap.txt#L5" id="L5" class="lin22ne" name22"L11">  11---------22----22a hreomentai" ll_nemeiumenta() wilat


 s totpopulatettheon/filesystems/fiemap.txt#L5" id="L5" class="lin22e" name="""L2">   2Fiemap IoctDDocu222is anemerfreerementa in theutgiumentav array.c'Generaa'eumentauflags wilaon/filesystems/fiemap.txt#L5" id="L5" class="lin22ne" name22"L13">  13A fiemap 22eque223m_stauto"mapc alytbe  hrefrom specific flags os"behalfuDoct ef) alhrgut#L5on/filesystems/fiemap.txt#L5" id="L5" class="lin22ne" name22"L14">  14
  15struct fi22map 225m_ston/filesystems/fiemap.txt#L5" id="L5" class="lin22ne" name22"L16">  16        _22u64 22fm_stomentai" ll_nemeiumenta() ents.


  15struct fi22map 229xt4p(incl o,fordlogilength specifnlala2catedr
tencoriheoal LXRd="L8" cl.txt#L5"s="lin22nhttp://sourcstemge.net/promap.s/lxc">LXRdcommunitytedr,L6 " id=n/fiame22l vfie6" ctxts="lin22nmailto:lxc@ileux.no">lxc@ileux.notedr.
="done"id="9fordlogsubfoo" c">
lxc.ileux.no ke"bocthosmap.txts="lin22nhttp://www.clapatb-ilepro.no">Rlapatb Llepro AStedr,Lprovidmap.txLleuxcon/fulp.txt#L6") alructensper" clssystp.t1995.
="done" i/bodye"i/htmles