Re: Q: generic_file_write sets PG_locked???

Eric W. Biederman (ebiederm+eric@ccr.net)
23 Apr 1999 20:03:58 -0500


>>>>> "LT" == Linus Torvalds <torvalds@transmeta.com> writes:

LT> In article <14111.40097.154796.570022@dukat.scot.redhat.com>,
LT> Stephen C. Tweedie <sct@redhat.com> wrote:
>>
>> Yes and no. PageLocked may just indicate a background writeback in
>> progress. That definitely happens in the swap cache right now, but the
>> vfs code doesn't use it for the page cache (yet). It will do.

LT> In fact, it already does for NFS, which uses PageLocked for exactly that
LT> reason (to serialize read and write requests to the same page).

As I understand the NFS code it also tries using PageLocked to
synchronize writes _to_ a page from user space.

>> However,
>> if a given filesystem provides its own write-page strategy functions
>> which have their own locking semantics, there's no real reason to
>> prevent it from doing so as long as the page mapping functions continue
>> to block on a non-uptodate page.

LT> For "valid to read", you only check Uptodate. For any actual IO
LT> (whether it's because you're going to actually _do_ the read or set up
LT> some write), PageLocked should be used to synchronize. NFS already does
LT> this, and generic_file_read() already understands about it.

generic_file_read is quite close but it always does wait_on_page.
Not wrong, but not necessary if the page is Uptodate.

Eric

P.S. I'm looking at 2.2.5 so I may be a hair behind.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/