csc cache win7
|-May-03|-May-03
网络文件系统的机制
,()ningthestateoftheI/ORequestPacket(IRP).TheIRP_NOCACHEbitintheFlagsfieldwilltellthefilesystem(and,ofcourse,thefilter)thatthefileI/Oinquestionisnottobecached.Normally,thisisthecluetothefilesystemdriverthatthisdatashouldnotbecached.
对于文件系统过滤驱动程序来说确定本地文件系统NTFS或者FAT的cache策略是相当容易的只要检查一下I/O请求包IRP的状态就可以了。如果发现IRP的flag域带有IRP_NOCACHE标志就说明文件系统不允许文件cache。
Networkfilesystemsareabitmorecomplexthanthis.WhiletheyalsousetheIRP_NOCACHEbit,theymayalsoneedtodisablecachingasaresultoftheirowninternalpolicy-perhapsdirectedbythestateoftheremotefileonthefiles
erver,aswellasotherclientsinthenetworkthatmightbeusingthefile.Therdbss.sys,whichimplementspartoftheminiredirectormodelallowstheredirector(forexamplemrxsmb.sys,whichisthedriverthatimplementsCIFSorLan
ManagerfunctionalityinWindows2000andmorerecent)tochangethecachingpolicyonaper-filebasis.Inthiscase,anormalIRP_MJ_READIRP,whichwouldnormallybecached,maybetreatedasnon-cached.
而网络文件系统在cache策略方面则有点复杂。虽然它们也使用IPR_NOCACHE标志它们也需要在它们的内部策略当中禁止使用文件cache这些内部的cache策略是由文件服务器上的远程文件的状态决定的而网络上其它的客户端都会使用这些文件。rdbss.sys驱动程序实现了被称为“miniredirector”模型的一部分功能它能够允许每一个重定向器redirector基于每一个文件来改变其缓冲策略。在这种情况下一个普通的IRP_MJ_READ类型的IRP可能被当作可被缓冲的也可以被当作非缓冲来处理。
Forafilterdriverthatismodifyingthedata,theusualtechniqueistolookforandoperateonnon-cachedI/Ooperations.ThiswillcapturebothpagingI/Ooperationsaswellasuserlevelnon-cachedI/Ooperations.However,ifthefilterwishestoalsofilteranyofthemini-redirectors(therearetwoshippedinWindowsXPforexample)itneedstolookatthefieldsoftheFileControlBlock(FCB).
对于一个正在修改文件读数据的过滤驱动程序来说例如对文件内容做透明加解密的驱动程序通常是通过检查和拦截非缓冲I/O请求来实现自己的功能。这样它们就会捕获分页I/O操作或者用户层的非缓冲I/O操作。但是如果过滤驱动程序如果也想拦截mini-redirector的话它就必须检查文件控制块FCB的相关域。
Formostfilesystems,theformatofthisstructureismostlyunderthecontrolofthefilesystem(exceptforthecommonheaderstructure)butformini-redirectorstheformatofthefilecontrolblockisdefinedbythemini-redirectormode
l.Seemrxfcb.hintheIFSKitforthefulldefinition.Thekeydatastructurehere(forafilter)istheMRX_FCB.TheFcbStatefieldwillindicateifthecurrentstateofthefileiscachedornon-cached.Ifthefileallowscachingthe
FCB_STATE_READCACHING_ENABLEDbitwillbeset.Otherwise,I/Otothegivenfilewillbetreatedasnon-cached.
对于大多数文件系统来说FCB结构的格式主要由文件系统来决定除了通用的头结构以外但是mini-redirector的FCB结构的格式由mini-redirector模式定义完整的FCB定义可以参考mrxfcb.h。对过滤驱动程序来说最关键的数据结构是MRX_FCB。该结构的FcbState域描述了该文件是否需要cache或者非cache。如果文件可以被cache则FCB_STATE_READCACHING_ENABLED标志将置位。否则对于指定的文件将被视为非cached。值得注意的是在WindowsServer2003IFSKit中这个标志的拼写已经发生了变化现在的拼写是FCB_STATE_READCACHING_ENABLED。
Note:IntheWindowsServer2003IFSKitthespellingofthisflaghasbeenchan
gedsothatitisnowFCB_STATE_READCACHING_ENABLED.
Whilethisallowsafiltertodeterminethecurrentstateofthefile,theredoesnotappeartobeanysimplewayforafiltertoensurethatthestateofthisfielddoesnotchangebetweenthetimethefilterchecksitandthetimethecal
lisactuallyprocessedbythefilesystem.Thus,itispossiblethatthefilestatemightchangetodisallowcachingafterthischeckismade.Similarly,ifthecheckisdoneaftertheI/Ohasbeenprocessed,itispossiblethefilestat
emightchangetoindicatethatcachingisnowallowedonceagain.SamplecodeforthiscanbeseenintheIFSKit(seesmbmrx/wnet/sys/openclos.c)todemonstrateonepotentialimplementationmodel.
通过检查FCB结构的FcbStatus域的状态允许过滤驱动程序检查当前文件的状态但是却没有什么有效而简单的方法确保过滤驱动程序检查时的状态与文件系统真正处理这个文件之间该文件状态保持不变。因此这样的情况很可能发生文件过滤驱动程序检查文件状态时文件是允许cache的但是真正处理的时候变为不允许cache了。相反的情况也同样会出现。详细的示例请看IFS的例子代码smbmrx/wnet/sys/openclos.c。
Topreventthestatefromchanging,thecallermustacquiretheFCBresource;inordertoavoiddeadlockswhilecallingtheredirector,itmustbeownedexclusive(usingtheERESOURCEintheFCBitself).Again,todothisrequiesrelyingu
pontheimplementationandpublishedinterfaceavailableintheIFSKit.
为了防止这种状态的变化调用者必须获取FCB的资源。为了避免调用redirector其间出现死锁现象调用者必须排他的拥有FCB资源。
Note:thissynchronizationisonlyneededforuserlevelcachedrequests,sincepagingI/Ooruserlevelnon-cachedrequestswillalreadynotbecachedasamatterofcourse.ThisisimportantbecausethislockcannotbesafelyacquiredwhenprocessingpagingI/O-thiswouldviolatetheexistinglockhierarchyandintroducethepossibilityofdeadlocks.
EventuallyIfiguredoutthiswasbecausenetworkredirectorsliketosetaninternalflagcalledSRVOPEN_FLAG_DONTUSE_WRITE_CACHEINGwhenafileisopenedforwrite-only,whichcausestheredirectortosendallwritesacrossthenetworkassoonasitgetsthem,bypasstheNTcache.Thismeansanylayeredfilterwillseetheordinarywriterequest,butneveracorrespondingpaging-I/Orequest.Togetaroundthis,myfilternowhastoforciblyturneverywrite-onlynetworkfileopenintoaread/writeopen.
当一个文件以只写write-only方式打开时网络重定向器会设置一个内部标志SRVOPEN_FLAG_DONTUSE_WRITE_CACHEING这将导致重定向器发送所有的写请求到网络文件服务器上绕过了NTcache机制。这意味着所有的分层过滤驱动程序只能看到普通的写请求但是不会看到任何对应的分页I/O请求。为了能够过滤网络文件的读写分页请求我的过滤驱动程序不得不强迫将所有的以只写write-only方式打开网络文件变为读写方式打开。
下面是如何将write-only打开的文件转换为读写打开的文件的方式
ThereasonwhyImrantinginpublicisthatseemsthatIcanneverknowa-prioriwhetherIwillseeareadorwriterequestasbothpagingandnon-pagingI/O,oroneortheother,foragivenfilesystem.Instead,Imustscsc cache win7pecialcasemycodeforeachfilesystemandpraythatIvecoveredeveryscenariothatcanresultinmynothandlingaread/writeor
handlingittwice.TheonlyalternativeIcancomeupwithistoforceALLreads/writestoafilteredfiletobenon-cached,withthecorrespondingperformancepenalties.Isthereanelegantwayoutofthismess?
IthinkIsentamessageaboutthisbefore.ThelongandtheshortofitisthatyouCANNOTforcetheredirectortocachewritesforfilesthatareopenwrite-only.Youmustinsteadtweakthefilepermissionstoconvertawrite-onlyopenofanetworkfileintoaread/writeopen.Usecodelikethefollowingtodoso:
if((0(desiredAccess(FILE_EXECUTE|FILE_READ_DATA)))(0!(desiredAccess(FILE_WRITE_DATA|
FILE_APPEND_DATA))))
{
pIrpSp-Parameters.Create.SecurityContext-DesiredAccess|FILE_READ_DATA;
}
下面解释了为什么write-only类型的文件不能执行cache
writeonlyhandleinredirectordoesntcache
--------------------------------------------------------------------------------
Igotbittenbythisafewmonthsago,sohereismytakeonthesituation...
ThisisbecausetheNTcacheneedsreadaccesstothefileinordertowork.Thecacheworksonpage-sizedchunks.Ifyouopenafileandwrite1byteatlocation0,andcachingisenabled,theNTcachewillpage-inthememorypagerepresentingthefirst4096bytesofthefile,whichrequiresittoissueapagingI/Oreadforthefirst4096bytes.Thenitwillpasteinyournewbyteandmarkthepagedirty,whichcausesthepagetobewrittenoutlaterbythelazywriter.
Forlocalfiles,pagingI/Oisallowedtobypassallsecuritychecks(sinceonlytrustedkernelcomponentscanissuepagingI/Orequests),sothatpagingreadsareallowedonallopensforallfiles.Fornetworkfiles,thereisnoreasontheremotePCshouldtrustyourPCandgrantitreadaccessifyouonlyhavewrite-accesstothefile.ThereforetheNTcachecannotbeusedonwrite-onlyremotefiles.
推荐系统
雨林木风 winxp下载 纯净版 永久激活 winxp ghost系统 sp3 系统下载
系统大小:0MB系统类型:WinXP雨林木风在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业知名品牌,雨林木风WindowsXP其系统口碑得到许多人认可,积累了广大的用户群体,是一款稳定流畅的系统,雨林木风 winxp下载 纯净版 永久激活 winxp ghost系统 sp3 系统下载,有需要的朋友速度下载吧。
系统等级:进入下载 >萝卜家园win7纯净版 ghost系统下载 x64 联想电脑专用
系统大小:0MB系统类型:Win7萝卜家园win7纯净版是款非常纯净的win7系统,此版本优化更新了大量的驱动,帮助用户们进行舒适的使用,更加的适合家庭办公的使用,方便用户,有需要的用户们快来下载安装吧。
系统等级:进入下载 >雨林木风xp系统 xp系统纯净版 winXP ghost xp sp3 纯净版系统下载
系统大小:1.01GB系统类型:WinXP雨林木风xp系统 xp系统纯净版 winXP ghost xp sp3 纯净版系统下载,雨林木风WinXP系统技术积累雄厚深耕多年,采用了新的系统功能和硬件驱动,可以更好的发挥系统的性能,优化了系统、驱动对硬件的加速,加固了系统安全策略,运行环境安全可靠稳定。
系统等级:进入下载 >萝卜家园win10企业版 免激活密钥 激活工具 V2023 X64位系统下载
系统大小:0MB系统类型:Win10萝卜家园在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业的萝卜家园品牌,(win10企业版,win10 ghost,win10镜像),萝卜家园win10企业版 免激活密钥 激活工具 ghost镜像 X64位系统下载,其系统口碑得到许多人认可,积累了广大的用户群体,萝卜家园win10纯净版是一款稳定流畅的系统,一直以来都以用户为中心,是由萝卜家园win10团队推出的萝卜家园
系统等级:进入下载 >萝卜家园windows10游戏版 win10游戏专业版 V2023 X64位系统下载
系统大小:0MB系统类型:Win10萝卜家园windows10游戏版 win10游戏专业版 ghost X64位 系统下载,萝卜家园在系统方面技术积累雄厚深耕多年,打造了国内重装系统行业的萝卜家园品牌,其系统口碑得到许多人认可,积累了广大的用户群体,萝卜家园win10纯净版是一款稳定流畅的系统,一直以来都以用户为中心,是由萝卜家园win10团队推出的萝卜家园win10国内镜像版,基于国内用户的习惯,做
系统等级:进入下载 >windows11下载 萝卜家园win11专业版 X64位 V2023官网下载
系统大小:0MB系统类型:Win11萝卜家园在系统方面技术积累雄厚深耕多年,windows11下载 萝卜家园win11专业版 X64位 官网正式版可以更好的发挥系统的性能,优化了系统、驱动对硬件的加速,使得软件在WINDOWS11系统中运行得更加流畅,加固了系统安全策略,WINDOWS11系统在家用办公上跑分表现都是非常优秀,完美的兼容各种硬件和软件,运行环境安全可靠稳定。
系统等级:进入下载 >
相关文章
- 有什么电脑自动关机软件好用 电脑自动关机软件下载推荐
- 微信抽奖小程序怎么弄,教你微信转盘抽奖小程序制作方法
- 收集意见建议小程序怎么弄,教你制作匿名收集意见的小程序
- 扫码助力活动怎么弄,微信公众号助力活动的制作步骤
- 海报裂变活动怎么弄,微信公众号生成海报裂变活动的方法
- 公众号推广二维码怎么弄,微信公众号推广二维码生成方法
- 公众号裂变活动制作,微信公众号怎么做裂变活动
- 登记信息二维码制作,如何实现扫码登记填报信息
- 登记表怎么弄,教你微信登记表格怎么做
- 参数二维码怎么弄,微信公众号带参数二维码怎么生成
- 报名二维码怎么弄,微信公众号报名二维码制作步骤
- 设置电脑定时关机命令如何更改 电脑定时关机命令设置方法详解
- win7怎么自动关机 win7自动关机时间设置方法
- 设置定时关机命令在哪 电脑设置定时关机命令
热门系统
推荐软件
推荐应用
推荐游戏
热门文章
常用系统
- 1win11最新娱乐版下载 技术员联盟x64位 ghost系统 ISO镜像 v2023
- 2电脑公司windows7纯净版 ghost x64位 v2022.05 官网镜像下载
- 3外星人系统Win11稳定版系统下载 windows11 64位稳定版Ghost V2022
- 4win11一键装机小白版下载 外星人系统 x64位纯净版下载 笔记本专用
- 5萝卜家园Ghost win10 64位中文版专业版系统下载 windows10纯净专业版下载
- 6【国庆特别版】番茄花园Windows11高性能专业版ghost系统 ISO镜像下载
- 7青苹果系统 GHOST WIN7 SP1 X64 专业优化版 V2024
- 8深度技术ghost win7纯净版最新下载 大神装机版 ISO镜像下载
- 9雨林木风windows11中文版免激活 ghost镜像 V2022.04下载