mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Question about invalidate_inode_pages2_range()
@ 2009-10-19  8:16 Peng Tao
  2009-10-19  8:26 ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Peng Tao @ 2009-10-19  8:16 UTC (permalink / raw)
  To: linux-kernel

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about invalidate_inode_pages2_range()
  2009-10-19  8:16 Question about invalidate_inode_pages2_range() Peng Tao
@ 2009-10-19  8:26 ` Trond Myklebust
  2009-10-19  8:38   ` Peng Tao
  0 siblings, 1 reply; 6+ messages in thread
From: Trond Myklebust @ 2009-10-19  8:26 UTC (permalink / raw)
  To: Peng Tao; +Cc: linux-kernel

On Mon, 2009-10-19 at 16:16 +0800, Peng Tao wrote:
> 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?

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about invalidate_inode_pages2_range()
  2009-10-19  8:26 ` Trond Myklebust
@ 2009-10-19  8:38   ` Peng Tao
  2009-10-20  5:25     ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Peng Tao @ 2009-10-19  8:38 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel

On Mon, Oct 19, 2009 at 4:26 PM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Mon, 2009-10-19 at 16:16 +0800, Peng Tao wrote:
>> 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?
>
> 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.
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about invalidate_inode_pages2_range()
  2009-10-19  8:38   ` Peng Tao
@ 2009-10-20  5:25     ` Trond Myklebust
  2009-10-21  4:08       ` Peng Tao
  0 siblings, 1 reply; 6+ messages in thread
From: Trond Myklebust @ 2009-10-20  5:25 UTC (permalink / raw)
  To: Peng Tao; +Cc: linux-kernel

On Mon, 2009-10-19 at 16:38 +0800, Peng Tao wrote:
> On Mon, Oct 19, 2009 at 4:26 PM, Trond Myklebust
> <trond.myklebust@fys.uio.no> wrote:
> > On Mon, 2009-10-19 at 16:16 +0800, Peng Tao wrote:
> >> 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?
> >
> > 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.
> 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?

No. It just waits for any outstanding writeback activity on that page to
finish.

> 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...



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about invalidate_inode_pages2_range()
  2009-10-20  5:25     ` Trond Myklebust
@ 2009-10-21  4:08       ` Peng Tao
  2009-10-22  0:33         ` Trond Myklebust
  0 siblings, 1 reply; 6+ messages in thread
From: Peng Tao @ 2009-10-21  4:08 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-kernel

On Tue, Oct 20, 2009 at 1:25 PM, Trond Myklebust
<trond.myklebust@fys.uio.no> wrote:
> On Mon, 2009-10-19 at 16:38 +0800, Peng Tao wrote:
>> On Mon, Oct 19, 2009 at 4:26 PM, Trond Myklebust
>> <trond.myklebust@fys.uio.no> wrote:
>> > On Mon, 2009-10-19 at 16:16 +0800, Peng Tao wrote:
>> >> 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?
>> >
>> > 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.
>> 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?
>
> No. It just waits for any outstanding writeback activity on that page to
> finish.
Got it. Thank you.
>
>> 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.

>
>
>



-- 
Cheers,
Peng Tao
State Key Laboratory of Networking and Switching Technology
Beijing Univ. of Posts and Telecoms.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Question about invalidate_inode_pages2_range()
  2009-10-21  4:08       ` Peng Tao
@ 2009-10-22  0:33         ` Trond Myklebust
  0 siblings, 0 replies; 6+ messages in thread
From: Trond Myklebust @ 2009-10-22  0:33 UTC (permalink / raw)
  To: Peng Tao; +Cc: linux-kernel

On Wed, 2009-10-21 at 12:08 +0800, Peng Tao wrote:
> On Tue, Oct 20, 2009 at 1:25 PM, Trond Myklebust
> <trond.myklebust@fys.uio.no> wrote:
> > On Mon, 2009-10-19 at 16:38 +0800, Peng Tao wrote:
> >> 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-10-22  0:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-19  8:16 Question about invalidate_inode_pages2_range() Peng Tao
2009-10-19  8:26 ` Trond Myklebust
2009-10-19  8:38   ` Peng Tao
2009-10-20  5:25     ` Trond Myklebust
2009-10-21  4:08       ` Peng Tao
2009-10-22  0:33         ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®