From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: NeilBrown <neilb@suse.de>
Cc: linux-nfs@vger.kernel.org
Subject: Re: Small O_SYNC writes are no longer NFS_DATA_SYNC
Date: Mon, 21 Mar 2011 17:02:00 -0400 [thread overview]
Message-ID: <1300741320.13307.50.camel@lade.trondhjem.org> (raw)
In-Reply-To: <20110318145232.7bbb4216@notabene.brown>
On Fri, 2011-03-18 at 14:52 +1100, NeilBrown wrote:
> On Thu, 17 Mar 2011 22:25:08 -0400 Trond Myklebust
> <Trond.Myklebust@netapp.com> wrote:
>
> > On Fri, 2011-03-18 at 13:12 +1100, NeilBrown wrote:
> > > On Thu, 17 Mar 2011 21:49:26 -0400 Trond Myklebust
> > > <Trond.Myklebust@netapp.com> wrote:
> > >
> > > > However we could adopt the Solaris convention of always starting
> > > > writebacks with a FILE_SYNC, and then falling back to UNSTABLE for the
> > > > second rpc call and all subsequent calls...
> > > >
> > >
> > > That approach certainly has merit.
> > >
> > > However, as we know from the wbc info whether the write is small and sync -
> > > which is the only case where I think a STABLE write is needed - I cannot see
> > > why you don't want to just use that information to guide the choice of
> > > 'stable' or not ???
> >
> > By far the most common case we would want to optimise for is the sync at
> > close() or fsync() when you have written a small file (<= wsize). If we
> > can't optimise for that case, then the optimisation isn't worth doing at
> > all.
>
> Fair point. I hadn't thought of that.
>
> >
> > The point is that in that particular case, the wbc doesn't help you at
> > all since the limits are set at 0 and LLONG_MAX (see nfs_wb_all(),
> > write_inode_now(),...)
> >
>
> I would be trivial to use min(wbc->range_end, i_size_read(inode)) as the
> upper bound when assessing the size of the range to compare with 'wsize'.
>
> However that wouldn't address the case of a small append to a large file
> which would also be good to optimise.
>
> If you can detect the 'first' RPC reliably at the same time that you still
> have access to the wbc information, then:
>
> if this is the first request in a writeback, and the difference beween
> the address of this page, and min(wbc->range_end, i_size_read(inode))
> is less than wsize, then make it a STABLE write
>
> might be a heuristic that catches most interesting cases.
> It might be a bit complex though.
>
> I think we should in general err on the size of not using a STABLE write
> when it might be useful rather than using a STABLE write when it is not
> necessary as, while there a costs each way, I think the cost of incorrectly
> using STABLE would be higher.
How about something like the following (as of yet untested) patch?
Cheers
Trond
8<-------------------------------------------------------------------------------
next prev parent reply other threads:[~2011-03-21 21:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-16 6:15 Small O_SYNC writes are no longer NFS_DATA_SYNC NeilBrown
2011-02-16 13:11 ` Jeff Layton
2011-02-16 20:26 ` NeilBrown
2011-02-16 20:50 ` Jeff Layton
2011-02-16 21:00 ` NeilBrown
2011-03-17 23:53 ` Trond Myklebust
2011-03-18 1:04 ` NeilBrown
2011-03-18 1:49 ` Trond Myklebust
2011-03-18 2:12 ` NeilBrown
2011-03-18 2:25 ` Trond Myklebust
2011-03-18 3:52 ` NeilBrown
2011-03-21 21:02 ` Trond Myklebust [this message]
2011-03-21 22:17 ` NeilBrown
2011-03-21 22:54 ` Trond Myklebust
2011-03-21 23:47 ` NeilBrown
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=1300741320.13307.50.camel@lade.trondhjem.org \
--to=trond.myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
/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).