Question about invalidate_inode_pages2_range()
Hi,
I've a question about invalidate_inode_pages2_range().
When does invalidate_inode_pages2_range() returns -EBUSY? It locks and writes back the page. Why invalidate_complete_page2() still may fail due to page dirtiness?
TIA.
Quoted 7 lines · Peng Tao
Hi,
I've a question about
invalidate_inode_pages2_range().When does
invalidate_inode_pages2_range()returns-EBUSY? It locks and writes back the page. Whyinvalidate_complete_page2()still may fail due to page dirtiness?
A lot of those requirements were set by NFS, which uses invalidate_inode_pages2() in order to invalidate the page cache when it detects that a file has been changed on the server (either due to an O_DIRECT write, or due to another client modifying the file).
In such cases, you want to try to keep the dirty data by writing it out instead of discarding it.
Cheers
Trond
Quoted 9 lines · Trond Myklebust
Quoted 7 lines · Peng Tao
Hi,
I've a question about
invalidate_inode_pages2_range().When does
invalidate_inode_pages2_range()returns-EBUSY? It locks and writes back the page. Whyinvalidate_complete_page2()still may fail due to page dirtiness?
Quoted 7 lines
A lot of those requirements were set by NFS, which uses
invalidate_inode_pages2()in order to invalidate the page cache when it detects that a file has been changed on the server (either due to anO_DIRECTwrite, or due to another client modifying the file).In such cases, you want to try to keep the dirty data by writing it out instead of discarding it.
Thanks for your quick response. But I have two more questions about this.
1. invalidate_inode_pages2_range() calls wait_on_page_writeback(). Does the latter actually write out the dirty page?
2. Is there any interface in the mm subsystem forces discarding a page cache?
Cheers,
Peng Tao
Quoted 16 lines · Peng Tao
Quoted 14 lines · Trond Myklebust
Quoted 7 lines · Peng Tao
Hi,
I've a question about
invalidate_inode_pages2_range().When does
invalidate_inode_pages2_range()returns-EBUSY? It locks and writes back the page. Whyinvalidate_complete_page2()still may fail due to page dirtiness?A lot of those requirements were set by NFS, which uses
invalidate_inode_pages2()in order to invalidate the page cache when it detects that a file has been changed on the server (either due to anO_DIRECTwrite, or due to another client modifying the file).
Quoted 5 lines
Quoted 2 lines
In such cases, you want to try to keep the dirty data by writing it out instead of discarding it.
Thanks for your quick response. But I have two more questions about this.
1.invalidate_inode_pages2_range()callswait_on_page_writeback(). Does the latter actually write out the dirty page?
No. It just waits for any outstanding writeback activity on that page to finish.
Quoted 1 line
2. Is there any interface in the mm subsystem forces discarding a page cache?
You mean that also discards dirty pages? Yes. That is what truncate_inode_pages() does...
Quoted 17 lines · Trond Myklebust
Quoted 16 lines · Peng Tao
Quoted 14 lines · Trond Myklebust
Quoted 7 lines · Peng Tao
Hi,
I've a question about
invalidate_inode_pages2_range().When does
invalidate_inode_pages2_range()returns-EBUSY? It locks and writes back the page. Whyinvalidate_complete_page2()still may fail due to page dirtiness?A lot of those requirements were set by NFS, which uses
invalidate_inode_pages2()in order to invalidate the page cache when it detects that a file has been changed on the server (either due to anO_DIRECTwrite, or due to another client modifying the file).
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
In such cases, you want to try to keep the dirty data by writing it out instead of discarding it.
Thanks for your quick response. But I have two more questions about this.
1.invalidate_inode_pages2_range()callswait_on_page_writeback(). Does the latter actually write out the dirty page?No. It just waits for any outstanding writeback activity on that page to finish.
Got it. Thank you.
Quoted 5 lines
Quoted 2 lines
2. Is there any interface in the mm subsystem forces discarding a page cache?
You mean that also discards dirty pages? Yes. That is what
truncate_inode_pages()does...
But truncate_inode_pages() truncates all pages beyond lstart.
Is there any way to discard a single page?truncate_inode_page() seems to be able to do the magic. But it is not exported.
Quoted 3 lines
Signature · 4 lines
Cheers, Peng Tao State Key Laboratory of Networking and Switching Technology Beijing Univ. of Posts and Telecoms.
Quoted 10 lines · Peng Tao
Quoted 5 lines · Trond Myklebust
Quoted 1 line · Peng Tao
2. Is there any interface in the mm subsystem forces discarding a page cache?
You mean that also discards dirty pages? Yes. That is what
truncate_inode_pages()does...But
truncate_inode_pages()truncates all pages beyond lstart.
Is there any way to discard a single page?truncate_inode_page()seems to be able to do the magic. But it is not exported.
truncate_inode_pages_range() is your friend...
Cheers
Trond