From: Nick Piggin <nickpiggin@yahoo.com.au>
To: David Howells <dhowells@redhat.com>
Cc: akpm@osdl.org, linux-kernel@vger.kernel.org,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] AFS: Implement shared-writable mmap [try #2]
Date: Wed, 16 May 2007 22:07:15 +1000 [thread overview]
Message-ID: <464AF3F3.30204@yahoo.com.au> (raw)
In-Reply-To: <20070516100225.18685.51699.stgit@warthog.cambridge.redhat.com>
David Howells wrote:
> Implement shared-writable mmap for AFS.
>
> The key with which to access the file is obtained from the VMA at the point
> where the PTE is made writable by the page_mkwrite() VMA op and cached in the
> affected page.
>
> If there's an outstanding write on the page made with a different key, then
> page_mkwrite() will flush it before attaching a record of the new key.
>
> [try #2] Only flush the page if the page is still part of the mapping (truncate
> may have discarded it).
Couple more issues...
> Signed-off-by: David Howells <dhowells@redhat.com>
> +/*
> + * notification that a previously read-only page is about to become writable
> + * - if it returns an error, the caller will deliver a bus error signal
> + *
> + * we use this to make a record of the key with which the writeback should be
> + * performed and to flush any outstanding writes made with a different key
> + *
> + * the key to be used is attached to the file pinned by the VMA
> + */
> +int afs_page_mkwrite(struct vm_area_struct *vma, struct page *page)
> +{
> + struct afs_vnode *vnode = AFS_FS_I(vma->vm_file->f_mapping->host);
> + struct key *key = vma->vm_file->private_data;
> + int ret;
> +
> + _enter("{{%x:%u},%x},{%lx}",
> + vnode->fid.vid, vnode->fid.vnode, key_serial(key), page->index);
> +
> + lock_page(page);
> + if (page->mapping == vma->vm_file->f_mapping)
> + ret = afs_prepare_write(vma->vm_file, page, 0, 0);
I would strongly suggest you used (0, PAGE_CACHE_SIZE) for the range, and
have your nopage function DTRT.
Minor issue: you can just check for `if (!page->mapping)` for truncation,
which is the usual signal to tell the reader you're checking for truncate.
Then you can remove the comment...
> + else
> + ret = 0; /* seems truncate interfered - let the caller deal
> + * with it (presumably the PTE changed too) */
Rather than add this (not always correct) comment about the VM workings, I'd
just add a directive in the page_mkwrite API documentation that the filesystem
is to return 0 if the page has been truncated.
> + unlock_page(page);
> +
> + _leave(" = %d", ret);
> + return ret;
> +}
--
SUSE Labs, Novell Inc.
next prev parent reply other threads:[~2007-05-16 12:07 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-16 10:02 [PATCH] AFS: Implement shared-writable mmap [try #2] David Howells
2007-05-16 12:07 ` Nick Piggin [this message]
2007-05-16 13:16 ` David Howells
2007-05-16 13:32 ` Nick Piggin
2007-05-16 16:12 ` David Howells
2007-05-16 16:32 ` Nick Piggin
2007-05-16 16:56 ` David Howells
2007-05-16 17:28 ` Nick Piggin
2007-05-16 17:46 ` David Howells
2007-05-16 17:59 ` Nick Piggin
2007-05-16 18:45 ` David Howells
2007-05-17 6:39 ` Nick Piggin
2007-05-17 12:30 ` David Howells
2007-05-17 17:46 ` David Howells
2007-05-18 2:29 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=464AF3F3.30204@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.