From: Trond Myklebust <trond.myklebust@fys.uio.no>
To: Kenny Simpson <theonetruekenny@yahoo.com>
Cc: Peter Staubach <staubach@redhat.com>,
linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: nfs question - ftruncate vs pwrite
Date: Thu, 08 Dec 2005 00:00:00 -0500 [thread overview]
Message-ID: <1134018000.8002.58.camel@lade.trondhjem.org> (raw)
In-Reply-To: <1134017608.8002.55.camel@lade.trondhjem.org>
On Wed, 2005-12-07 at 23:53 -0500, Trond Myklebust wrote:
> On Wed, 2005-12-07 at 13:50 -0800, Kenny Simpson wrote:
> > --- Peter Staubach <staubach@redhat.com> wrote:
> > > You might use tcpdump or etherreal to see what the different traffic looks
> > > like. I suspect that ftruncate() leads a SETATTR operation while pwrite()
> > > leads to a WRITE operation.
> >
> > Ethereal results interpreted with wild speculation:
> > The pwrite case:
> > This does a bunch of reads, but the server always returns a short read responding with EOF. It
> > seems that a pwrite does cause a getattr call, but that's it.
> > Once memory is exhausted, the pages are written out.
> >
> > The ftruncate case:
> > This does a setattr, then does a read - this time the server responds with a large amount of
> > 0's.
>
> That is as expected. The ftruncate() causes an immediate change in
> length of the file on the server, and so reads will.
...Err...
...and so reads of the empty pages will succeed.
> In the case of
> pwrite(), that is cached on the client until you fsync/close, and so the
> server returns short reads.
>
> > Since this is using the buffer cache (not opened with O_DIRECT), and since we know we are
> > extending the file... is it strictly necessary to read in pages of 0's from the server?
>
> Possibly not, but is this a common case that is worth optimising for?
> Note that use of the standard write() syscall as opposed to mmap() will
> not trigger this avalanche of page-ins.
>
> Cheers,
> Trond
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
next prev parent reply other threads:[~2005-12-08 5:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-12-07 20:46 Kenny Simpson
2005-12-07 21:14 ` Peter Staubach
2005-12-07 21:50 ` Kenny Simpson
2005-12-08 4:53 ` Trond Myklebust
2005-12-08 5:00 ` Trond Myklebust [this message]
2005-12-08 16:15 ` Kenny Simpson
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=1134018000.8002.58.camel@lade.trondhjem.org \
--to=trond.myklebust@fys.uio.no \
--cc=linux-kernel@vger.kernel.org \
--cc=staubach@redhat.com \
--cc=theonetruekenny@yahoo.com \
/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
all inboxes | Powered by JetHome®