Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Jun 2009
plan to implement prefetch technq
I am planning to implement a prefetch strategy in an experimental file system. We have developed an experimental file system using a reference UXFS CODE.
And also I have developed Network Block Device (NBD) driver which can read and write block over the network.
Using uxfs fs, I can create UXFS file system and read/write to the device. However, I am now planning to implement Prefetching technique. I was wondering what is the best way to go ahead. . .
I am planning to write a multiread function in NBD which can accept list of sectors that need to be read and will export the multiread function, so that I can call it directly from the experimental fs.
Reading the article on the web Linux Kernel 2.4 Internals: Linux Page Cache, I am trying to understand the working of FS:
FOR READING A BLOCK FROM A FILE:
1) First, the generic methods will test whether the page actually exists using below two functions:
hash = page_hash(inode->i_mapping, index); page = __find_page_nolock(inode->i_mapping, index, *hash);
2) When it does not exist, we allocate a new free page, and add it to the page- cache hash.
page = page_cache_alloc(); __add_to_page_cache(page, mapping, index, hash);
3) After the page is hashed we use the ->readpage address_space operation to actually fill the page with data. (file is an open instance of inode).
error = mapping->a_ops->readpage(file, page);
This in turn will call readpage function which is in my experimental file system. Can anyone please suggest me if this is a right point of insertion.
From above, I understand the readpage function will be called, having Page allocated and file pointer. using int block_read_full_page(struct page *page, get_block_t *get_block) which is now used in readpage function, I have to understand which sectors I need to read and where need to be copied in the page (which in itself bit tricky) and then call multiread of NBD.
Further, I would be doing prefetching; therefore may have to allocate more pages and then will add it to page cache using: page = page_cache_alloc(); __add_to_page_cache(page, mapping, index, hash);
Do you guys think: this is the way to go about . . . ? I personally think there must be a better way .....
Look forward for your views.
Thank you Dhawal