9
22
2014
68

address_space, 页高速缓存

address_space对象是文件系统中关于内存中页高速缓存的核心数据结构。这篇博客以address_space对象为切入点,分析文件系统的页高速缓存。

1背景

在文件系统中,内存中存在着dentry和inode结构,其中其分别的作用可以见我另一篇博客《dentry与inode》。由于这些结构要反复使用,所以内存里开辟了目录项高速缓存以及索引结点高速缓存,提高其访问速度。但这里要提到的是另一种高速缓存:页高速缓存,它是一种对完整的数据页进行操作的磁盘高速缓存,即把磁盘的数据块缓存在页高速缓存中。而address_space对页高速缓存进行管理。

2页高速缓存介绍

linux中几乎所有文件的读和写操作都依赖于页高速缓存。只有在O_DIRECT标志置为才会出现意外:此时,I/O数据的传送绕过了页高速缓存而使用了进程用户态地址空间的缓冲区;另外,少量的数据库软件为了采用自己的磁盘高速缓存算法而使用了O_DIRECT标志。

why设计页高速缓存?

答:1.快速定位所有者相关数据页的位置(基树)。2.区分不同所有者页的不同读写操作,如普通文件、块设备文件、交换区文件读一个数据页必须使用不同的方式实现,故内核根据页的不同所有者进行不同的操作。

3address_space对象

每一个所有者(可以理解为一个具体的文件,一个inode指向的文件)对应着一个address_space对象,页高速缓存的多个页可能属于一个所有者,从而可以链接到一个address_space对象。那么一个页(page)怎么和一个address_space产生关联的呢?

page中有两个字段:mapping和index。其中mapping指向该页所有者的address_mapping(内存inode结构有一个i_mapping指向对应address_space对象),index字段表示所有者地址空间中以页大小为单位的偏移量。用这两个字段就能在页高速缓存中查找也。(这里注意一点,一个页中所包含的磁盘块在物理上不一定是相邻的)

address_space中有一个host字段,该字段指向其所属的inode,也就是address_space中的host字段 与 对应inode中的 i_data字段形成互相指向的关系。若为普通文件,那么inode结点和address_space结构的相应指针的指向关系如下图:

 

4基树

linux支持TB级的文件,ext4甚至支持到了PB级文件,访问大文件时,高速缓存中存在着有关该文件太多的页,故设计了基树这个结构来加快查找。一个address_space对象对应一个基树。

address_space中有一个字段(page_tree)指向是基树的根(radix_tree_node)。基树根中的rnode指向基树的最高层节点(radix_tree_node),基树节点都是radix_tree_node结构,节点中存放的都是指针,叶子节点的指针指向页描述符,上层节点指向存放其他节点的指针。一般一个radix_tree_node最多可以有64个指针,字段count表示该radix_tree_node已用节点数。

怎么快速找到所需页在基树中的位置呢?

回顾本科所学知识:分页系统如何利用页表实现线性地址到物理地址的转换?线性地址的最高20位分为两个10为的字段:第一个字段是页目录的偏移,第二个字段是页目录所指向也表的偏移。

在基树中,类比此方法。若基树深度为1,则只能表示从0至63的索引,则页索引(上文提高的index字段)的低6位进行解析,从而对应成radix_tree_node结构中的slot下标,找到对应的页;若基树深度为2,则页索引的低12位分成0~5,6~11两个字段进行解析。分别找到第一层slot字段和第二层slot字段的值。

Category: 文件系统 | Tags: | Read Count: 9386
Avatar_small
Website 说:
2022年8月28日 19:03

Buy Gmail PVA Accounts
This is the first time I am visiting here and I found so much interesting stuff in your blog, especially its discussion. Thank you.

Avatar_small
Website 说:
2022年8月29日 19:13

Buy Twitter PVA Accounts
The website is looking a bit flashy and it catches the visitor's eyes. The design is pretty simple and has a good user-friendly interface.

Avatar_small
>UK Board Question P 说:
2022年8月29日 21:19

UK Board 10th Previous Question Paper are very important for the Preparation of Public Exam of UBSE for the Students. 10th Students of can easily get their Latest and most valuable Mock Test Paper from this website. UK Board Question Paper Students only have to Download the UBSE 10th Mock Test Paper 2023 for all the important subjects are available Including the Hindi, English, Social Science, Mathematics, Science, Home Science, Sanskrit, Painting etc. Boardmodelpaper.com Provide UBSE Board 10th Class Latest and Last Year Exam Study Material for Syllabus , Question Paper etc, Hindi, English Medium Pdf Format.

Avatar_small
vector logo 说:
2022年8月30日 02:09

Very useful post. This is the first time I am visiting here. I found so much interesting stuff in your blog, especially its discussion. Really it's a great article. Keep it up.

Avatar_small
Website 说:
2022年8月30日 03:32

Buy Instagram PVA Accounts
Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have.

Avatar_small
Website 说:
2022年8月30日 16:29

buy gmail PVA accounts
Thank you very much for sharing these links. Will definitely check this out.

Avatar_small
Website 说:
2022年8月30日 17:36

Instagram pva accounts
Very useful post. This is the first time I am visiting here. I found so much interesting stuff in your blog, especially its discussion. Really it's a great article. Keep it up.

Avatar_small
halal fish oil 说:
2022年9月02日 03:08

Buy YouTube Pva Accounts
The information you have posted is very useful. The sites you have referred were good. Thanks for sharing this.

Avatar_small
Website 说:
2022年9月02日 03:08

Buy YouTube Pva Accounts
The information you have posted is very useful. The sites you have referred were good. Thanks for sharing this.

Avatar_small
Website 说:
2022年9月06日 17:49

Buy pva instagram accounts
Wonderful illustrated information. I thank you for that. No doubt it will be very useful for my future projects. Would like to see some other posts on the same subject!

Avatar_small
Website 说:
2022年9月14日 13:05

Buy Twitter pva accounts
Great info! I recently came across your blog and have been reading along. I thought I would leave my first comment. I don’t know what to say except that I have.

Avatar_small
Website 说:
2022年9月14日 13:29

Buy Instagram pva accounts
You know your projects stand out from the herd. There is something special about them. It seems to me all of them are really brilliant!

Avatar_small
Website 说:
2022年9月14日 14:00

afro hair and beauty store
I love this blog! The flash up the top is awesome!

Avatar_small
New Metro City 说:
2022年9月20日 14:46

Buy instagram pva accounts
Thanks for the post and great tips. Even, I also think that hard work is the most important aspect of getting success.

Avatar_small
Website 说:
2022年9月20日 19:11

Buy Bulk Gmail Accounts
I highly appreciate this post. It’s hard to find the good from the bad sometimes. but I think you’ve nailed it! would you mind updating your blog with more information?

Avatar_small
halal fish oil 说:
2022年9月26日 01:18

Buy Gmail PVA Accounts
Thanks for the post and great tips. Even, I also think that hard work is the most important aspect of getting success.

Avatar_small
Website 说:
2022年9月26日 01:19

Buy Gmail PVA Accounts
Thanks for the tips and information. I really appreciate it.

Avatar_small
Website 说:
2022年9月27日 19:45

hair beauty products online
This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information.

Avatar_small
Website 说:
2022年10月02日 18:00

buy gmail pva accounts
Wow-what Great Information about World Day is a very nice informative post. Thanks for the post.

Avatar_small
Website 说:
2022年10月02日 21:20

Instagram pva accounts
Great survey. I'm sure you're getting a great response.

Avatar_small
Website 说:
2022年10月14日 00:41

Rail Road Safety in Nevada
Excellent and very exciting site. Love to watch. Keep Rocking.

Avatar_small
Oldsmar dentist 说:
2022年10月16日 00:23

I am very happy to discover your post as it will become on top of my collection of favorite blogs to visit.

Avatar_small
Website 说:
2022年10月28日 20:48

all you can eat baden baden
I read that Post and got it fine and informative. Please share more like that.

Avatar_small
SEO 说:
2022年10月31日 00:41

It's a great pleasure reading your post. It's full of information I am looking for and I love to post a comment that "The content of your post is awesome" Great work.

Avatar_small
UPI Registration Fai 说:
2022年10月31日 23:32

Digital transaction facilities are gaining popularity in India and the whole world. The online money transfer methods allow users to send and receive money fast and on inconvenient platforms. UPI Registration Failed BHIM app is a significant money transfer platform that provides ease in transacting funds between various bank accounts. The app is available on mobile devices, making it a suitable banking method for many Indian residents.

Avatar_small
foglightpi 说:
2022年11月03日 04:56

Great to have you here, Here you will find more information about a private detective. Foglight PI is #1 private detective agency in the world.

Avatar_small
Website 说:
2022年11月06日 18:40

LG Refrigerator Repair
I am no expert. But I believe you just made an excellent point. You certainly fully understand what you are speaking about. and I can truly get behind that.

Avatar_small
Versions Global 说:
2022年11月25日 13:26

Superbly written article. If only all bloggers offered the same content as you. the internet would be a far better place.

Avatar_small
Website 说:
2022年11月25日 23:55

Digital Design Agency
You know your projects stand out from the herd. There is something special about them. It seems to me all of them are really brilliant!

Avatar_small
Website 说:
2022年12月01日 16:04

office space for rent
Yes, I am totally agreed with this article and I just want to say that this article is a very nice and very informative article. I will make sure to be reading your blog more. You made a good point but I can't help but wonder. what about the other side? Thanks!

Avatar_small
Website 说:
2022年12月11日 15:36

eichler roof construction
I would like to say that this blog really convinced me to do it! Thanks. Very good post.

Avatar_small
gm web solution 说:
2022年12月24日 05:23

GM Web Solutions have a highly
the skilled team of developers. We
take care of your business with
the proper tools and modern
techniques.

Avatar_small
gmblogger 说:
2022年12月24日 05:24

Publish your passions your way.
Whether you''d like to share your
knowledge, experiences or the
latest news, create a unique and
beautiful blog.

Avatar_small
foglight 说:
2022年12月24日 05:25

Great to have you here, Here you
will find more information about
a private detective. Foglight PI
is #1 private detective agency
in the world

Avatar_small
Fox Hills Realty 说:
2023年3月08日 17:34

Foxhills Realty offers a wide variety of real estate services including buying, selling, and leasing properties. We have experts in every field to help you with all of your needs. Fox Hills Realty

Avatar_small
Website 说:
2023年4月27日 03:48

Instagram pva accounts
This is very educational content and written well for a change. It's nice to see that some people still understand how to write a quality post!

Avatar_small
Website 说:
2023年4月27日 04:04

Instagram pva accounts
Positive site. Where did you come up with the information on this posting? I'm pleased I discovered it though. I will be checking back soon to find out what additional posts you include.

Avatar_small
Contract Packing 说:
2023年4月28日 08:34

I think that thanks for the valuable information and insights you have so provided here.

Avatar_small
Website 说:
2023年5月25日 00:31

Buy bulk gmail accounts
I have read your article. It is very informative and helpful for me. I admire the valuable information you offer in your articles. Thanks for posting it.

Avatar_small
Website 说:
2023年5月25日 01:56

buy Facebook pva accounts
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.

Avatar_small
Website 说:
2023年6月13日 01:48

Buy Instagram PVA Accounts in bulk from us. Our Old Instagram PVA accounts are great for the Growth of Business Profiles.

Avatar_small
Website 说:
2023年7月06日 03:13

Boost your social media strategy with our buy bulk Instagram accounts. Reach a wider audience and effortlessly expand your online presence.

Avatar_small
Website 说:
2023年8月20日 15:27

Buy Instagram pva accounts
This is a great inspiring article. I am pretty much pleased with your good work. You put really very helpful information. Keep it up. Keep blogging. Looking to reading your next post.

Avatar_small
Website 说:
2023年8月20日 15:54

Buy twitter pva accounts
Nice to be visiting your blog again. It has been months for me. Well, this article that I've been waiting for so long. I need this article to complete my assignment in college and it has the same topic as your article. Thanks. Great share.

Avatar_small
Website 说:
2023年8月20日 16:20

Gmail pva accounts
I think this is an informative post and it is very useful and knowledgeable. Therefore, I would like to thank you for the efforts you have made in writing this article.

Avatar_small
Website 说:
2023年8月20日 17:14

Tiktok pva accounts
Hi! Thanks for the great information you have provided! You have touched on crucial points!

Avatar_small
storepva 说:
2023年8月31日 12:08

I'm able to see that you are an professional at your discipline! I am happy to study this text. I assume this may beneficial and informative subject matter for everyone. That is such a nice post. I have been impressed with the aid of the specific content. I loved your put up and were given a few top ideas for it.
<a href="https://storepva.com/buy-instagram-pva-accounts/">Buy Instagram pva accounts</a>

Avatar_small
Website 说:
2023年10月16日 14:19

Roofing repairing, and maintaining
What a fabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more posts like these. Thank you very much.

Avatar_small
civaget 说:
2024年1月17日 21:16

I always leave 오피타임 feeling rejuvenated and stress-free. Highly recommended!

Avatar_small
civaget 说:
2024年1月18日 04:29

I've experienced many massages, but 제주출장마사지 stands out.

Avatar_small
civaget 说:
2024年1月30日 18:20

마곡가라오케 is a karaoke gem! Fantastic song selection, top-notch facilities, and great service. Can't wait to visit again!

Avatar_small
civaget 说:
2024年1月30日 20:17

강남출장마사지: Where relaxation knows no bounds. Expert therapists and a tranquil atmosphere combine to create an unparalleled experience.

Avatar_small
SEO 说:
2024年1月30日 20:19

The community around 툰코단행본 is amazing. It's refreshing to connect with fellow comic enthusiasts.

Avatar_small
civaget 说:
2024年1月30日 20:35

My stress vanishes the moment I step into 대전출장마사지's soothing haven.

Avatar_small
civaget 说:
2024年1月30日 20:45

부천출장마사지: Your oasis for tranquility and relief.

Avatar_small
civaget 说:
2024年1月30日 20:54

The hot stone massage at 수원출장마사지 left me feeling rejuvenated and stress-free. Exceptional experience!

Avatar_small
civaget 说:
2024年1月30日 21:01

Relaxation redefined at 인천출장마사지. Their skilled therapists and extensive massage options make it a top choice for unwinding and rejuvenation.

Avatar_small
SEO 说:
2024年1月30日 21:07

With 툰코만화, I never miss a chapter update, and the vibrant community discussions enhance my reading experience.

Avatar_small
civaget 说:
2024年1月30日 21:09

천안출장마사지 is my trusted destination for massages. Their tailored approach ensures a memorable experience. Highly recommended for anyone seeking relaxation and rejuvenation.

Avatar_small
SEO 说:
2024年1月30日 21:50

The user-friendly interface on 툰코애니 makes navigating their vast library a breeze.

Avatar_small
seo 说:
2024年1月30日 23:04

I love how 툰코웹툰 transcends language barriers with translations, making it accessible to a global audience.

Avatar_small
seo 说:
2024年1月30日 23:24

Traditional comics lack 툰코포토툰's innovation and interactive storytelling, making it a clear favorite for modern readers.

Avatar_small
civaget 说:
2024年2月14日 19:12

 

User reviews provide valuable insights into the quality of playgrounds on 슈어맨.

Avatar_small
civaget 说:
2024年2月14日 19:23

Stress reduction through massage therapy is something we all need.

Avatar_small
civaget 说:
2024年2月14日 19:24

I had no idea there were so many techniques in 일본인안마. It's impressive!

Avatar_small
civaget 说:
2024年2月14日 19:33

Booking in advance for 천안오피 is a game-changer; no more waiting in line!

Avatar_small
civaget 说:
2024年2月14日 19:41

The hot stone massage sounds heavenly. I could use some relaxation at 포항오피!

Avatar_small
civaget 说:
2024年2月14日 19:50

제주오피 provides a variety of relaxation services.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com