linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Anton Altaparmakov <aia21@cam.ac.uk>
To: Andrew Morton <akpm@osdl.org>
Cc: nathans@sgi.com, Al Viro <viro@parcelfarce.linux.theplanet.co.uk>,
	lkml <linux-kernel@vger.kernel.org>,
	fsdevel <linux-fsdevel@vger.kernel.org>
Subject: Re: RFC: [PATCH-2.6] Add helper function to lock multiple page cache pages.
Date: Thu, 03 Feb 2005 11:23:29 +0000	[thread overview]
Message-ID: <1107429809.9010.27.camel@imp.csi.cam.ac.uk> (raw)
In-Reply-To: <20050203024755.1792b6c0.akpm@osdl.org>

On Thu, 2005-02-03 at 02:47 -0800, Andrew Morton wrote:
> Anton Altaparmakov <aia21@cam.ac.uk> wrote:
> > On Wed, 2005-02-02 at 14:34 -0800, Andrew Morton wrote:
> > > Anton Altaparmakov <aia21@cam.ac.uk> wrote:
> > > >
> > > > Below is a patch which adds a function 
> > > >  mm/filemap.c::find_or_create_pages(), locks a range of pages.  Please see 
> > > >  the function description in the patch for details.
> > > 
> > > This isn't very nice, is it, really?  Kind of a square peg in a round hole.
> > 
> > Only followed your advice.  (-;  But yes, it is not very nice at all.
> > 
> > > If you took the approach of defining a custom file_operations.write() then
> > > I'd imagine that the write() side of things would fall out fairly neatly:
> > > no need for s_umount and i_sem needs to be taken anyway.  No trylocking.
> > 
> > But the write() side of things don't need s_umount or trylocking with
> > the proposed find_or_create_pages(), either...
> 
> i_sem nests outside lock_page, normally.  I guess that can be avoided though.

I meant that the write() side of things (i.e. ->{prepare,commit}_write)
already has i_sem held on entry.

> > Unfortunately it is not possible to do this since removing
> > ->{prepare,commit}_write() from NTFS would mean that we cannot use loop
> > devices on NTFS any more and this is a really important feature for
> > several Linux distributions (e.g. TopologiLinux) which install Linux on
> > a loopback mounted NTFS file which they then use to place an ext3 (or
> > whatever) fs on and use that as the root fs...
> > 
> > So we definitely need full blown prepare/commit write.  (Unless we
> > modify the loop device driver not to use ->{prepare,commit}_write
> > first.)
> > 
> > Any ideas how to solve that one?
> 
> I did a patch which switched loop to use the file_operations.read/write
> about a year ago.  Forget what happened to it.  It always seemed the right
> thing to do..

Yes, I remember seeing something like that on LKML.  I guess it would
enable readahead on the loop devices.  Whether this is a good or bad
thing is I guess entirely dependent on the usage scenario.

> > > And for the vmscan->writepage() side of things I wonder if it would be
> > > possible to overload the mapping's ->nopage handler.  If the target page
> > > lies in a hole, go off and allocate all the necessary pagecache pages, zero
> > > them, mark them dirty?
> > 
> > I guess it would be possible but ->nopage is used for the read case and
> > why would we want to then cause writes/allocations?
> 
> yup, we'd need to create a new handler for writes, or pass `write_access'
> into ->nopage.  I think others (dwdm2?) have seen a need for that.

That would work as long as all writable mappings are actually written to
everywhere.  Otherwise you still get that reading the whole mmap()ped
are but writing a small part of it would still instantiate all of it on
disk.  As far as I understand this there is no way to hook into the mmap
system such that we have a hook whenever a mmap()ped page gets written
to for the first time.  (I may well be wrong on that one so please
correct me if that is the case.)

> > At the moment I cannot see a way to solve my problem without the
> > proposed find_or_create_pages().  )-:
> 
> Unpleasant, isn't it.
> 
> I guess the path of least resistance is to do it within ntfs for now.

Ok, I will do that.  ntfs_find_or_create_pages() will be hitting
fs/ntfs/aops.c soon...

As always, thanks a lot for your help!

Best regards,

        Anton
-- 
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/


  reply	other threads:[~2005-02-03 11:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-02 15:12 RFC: [PATCH-2.6] Add helper function to lock multiple page cache pages Anton Altaparmakov
2005-02-02 15:43 ` Matthew Wilcox
2005-02-02 15:56   ` Anton Altaparmakov
2005-02-02 22:34 ` Andrew Morton
2005-02-03 10:37   ` Anton Altaparmakov
2005-02-03 10:47     ` Andrew Morton
2005-02-03 11:23       ` Anton Altaparmakov [this message]
2005-02-03 19:23         ` RFC: [PATCH-2.6] Add helper function to lock multiple page cache pages - nopage alternative Bryan Henderson
2005-02-04 15:36           ` Anton Altaparmakov
2005-02-04 17:17             ` Hugh Dickins
2005-02-04 23:09             ` Bryan Henderson
2005-02-03 19:03       ` RFC: [PATCH-2.6] Add helper function to lock multiple page cache pages - loop device Bryan Henderson
2005-02-06 19:42       ` RFC: [PATCH-2.6] Add helper function to lock multiple page cache pages Anton Altaparmakov
2005-02-06 20:42         ` Andrew Morton
2005-02-16 21:56           ` Anton Altaparmakov

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=1107429809.9010.27.camel@imp.csi.cam.ac.uk \
    --to=aia21@cam.ac.uk \
    --cc=akpm@osdl.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nathans@sgi.com \
    --cc=viro@parcelfarce.linux.theplanet.co.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).