Zbr's days.
December
Sun Mon Tue Wed Thu Fri Sat
           
21
         
2007
Months
Dec

About :: TODO :: Blog :: RSS :: Old blog :: Projects :: GIT :: Gallery :: Notes

Fri, 21 Dec 2007

Anatomy of the filesystem ->readpage() callback.

This callback is used to read page from the storage to RAM. It has following prototype:

static int pohmelfs_readpage(struct file *file, struct page *page)
Where file is an object associated with opened in userspace file, and page is a page where filesystem has to put data.
On-disk filesystems usually use VFS helpers (like mpage_readpage() or block_read_full_page()), which maps page into set of buffer_head objects, which are then submitted to block layer, where next level of reading from the disk happens. This mapping is implemented via per-filesystem get_block() callback.

Pohmelfs does not follow this standard, since it does not know, which filesystem is on the remote side, and since there is no block device under it. So it just uses request/reply protocol to get given page from the remote host. Page structure already contains its offset from the begining of the file (from the beginning of the address space actually), and it is locked, so simultaneous access is not possible, so we only need to fetch data and mark page (if copy was successful) is uptodate.
Simple.

Here is the result:
server $ md5sum /tmp/ltp-full-20071130.tgz
77bf4032c10c03e858512a5a90c05015  /tmp/ltp-full-20071130.tgz

client # md5sum /mnt/tmp/ltp-full-20071130.tgz
77bf4032c10c03e858512a5a90c05015  /mnt/tmp/ltp-full-20071130.tgz

/devel/fs :: Link / Comments (0)

Please solve this captcha to be allowed to post (need to reload in a minute): 71 * 67

Comments are closed for this story.