About the last page of file reading in the user space

Submitted by Anonymous
on June 7, 2009 - 7:29pm

1. If some file's size is 5000 Bytes, then the first 4096 Bytes are read by the first page, the remaining 4 Bytes are read by the second page. What is fetched in the left 4092 Bytes in the second page space?

2. How can I check the offset of the data (eg. the remaining 4 Bytes's location)
I found there is a macro named "bio_offset", but it's parameter is bio, not page.

3. When reading files, how can I check where each page is from (the file path and the file name)
Can the file name be found through struct file->f_dentry->d_name.name?

4. in function mpage_end_io_read,
struct bio_vec *bvec = bio->bi_io_vec + bio->bi_vcnt - 1;
so pointer bvec is pointed to the last "bio_vec",then "--bvec", and I don't why doing it reversely?

4.

on
June 12, 2009 - 6:31pm

it doesn't matter, it could be just personal style... the prefetchw() leads to the conclusion that the cpu caches play a role. the last entries are probably cache-hot while the first aren't and thrashing is to be avoided. there should be a checkin comment or lkml mail with the author's reasoning, you just have to use the SCM's features to find out when this particular line appeared.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.