public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Staubach <staubach@redhat.com>
To: Kenny Simpson <theonetruekenny@yahoo.com>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: nfs question - ftruncate vs pwrite
Date: Wed, 07 Dec 2005 16:14:11 -0500	[thread overview]
Message-ID: <439750A3.2030805@redhat.com> (raw)
In-Reply-To: <20051207204612.70808.qmail@web34114.mail.mud.yahoo.com>

Kenny Simpson wrote:

>Sorry about the previous partial message...
>
>If a file is extended via ftruncate, the new empty pages are read in before the the ftruncate
>returns (taking 64mS on my machine), but if the file is extended via pwrite, nothing is read in
>and the system call is very quick (34uS).
>
>Why is there such a difference?  Is there another cheap way to grow a file and map in its new
>pages?  Am I missing some other semantic difference between ftruncate and a pwrite past the end of
>the file?
>

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.

       ps

  reply	other threads:[~2005-12-07 21:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-07 20:46 nfs question - ftruncate vs pwrite Kenny Simpson
2005-12-07 21:14 ` Peter Staubach [this message]
2005-12-07 21:50   ` Kenny Simpson
2005-12-08  4:53     ` Trond Myklebust
2005-12-08  5:00       ` Trond Myklebust
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=439750A3.2030805@redhat.com \
    --to=staubach@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --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