linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Harkes <jaharkes@cs.cmu.edu>
To: Jeff Layton <jlayton@redhat.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	David Howells <dhowells@redhat.com>,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: coda's use of file->f_mapping and inode->i_mapping
Date: Wed, 2 Aug 2017 16:43:43 -0400	[thread overview]
Message-ID: <20170802204343.GH7542@cs.cmu.edu> (raw)
In-Reply-To: <1501686331.4654.6.camel@redhat.com>

On Wed, Aug 02, 2017 at 11:05:31AM -0400, Jeff Layton wrote:
> The weird bit is that in coda_file_mmap, we then do this:
> 
>         coda_file->f_mapping = host_file->f_mapping;
>         if (coda_inode->i_mapping == &coda_inode->i_data)
>                 coda_inode->i_mapping = host_inode->i_mapping;
> 
> 
> What is the significance of mmap on coda files? If you want to monkey
> around with the i_mapping and f_mapping, wouldn't it make more sense to
> do so at open() time?

Normal read and write calls go through the Coda kernel module and are
passed along to the underlying 'host / container' file. However with
mmap you only get told that the mapping is created and the following
page faults are handled directly by following the file's
f_mapping/i_mapping pointer.  We don't need to set up this pointer if
the user never calls mmap.

It is possible that when different users open the same file object they
are given a different container file. Although Coda's userspace as far
as I know doesn't actually do this, this case was 'anticipated' as a
possibility.

By delaying the monkeying around to the point of mmap, open/read/write
for files works reliably and only if a second mmap is attempted where
the second coda_file handle for the same coda_inode happens to have a
different host_file associated with it do we return EBUSY.

Jan

      reply	other threads:[~2017-08-02 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-02 15:05 coda's use of file->f_mapping and inode->i_mapping Jeff Layton
2017-08-02 20:43 ` Jan Harkes [this message]

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=20170802204343.GH7542@cs.cmu.edu \
    --to=jaharkes@cs.cmu.edu \
    --cc=dhowells@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).