linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@clusterfs.com>
To: "David H. Lynch Jr." <dhlii@comcast.net>
Cc: linux-fsdevel@vger.kernel.org
Subject: Re: Read/write counts
Date: Mon, 4 Jun 2007 10:33:27 -0600	[thread overview]
Message-ID: <20070604163327.GR5181@schatzie.adilger.int> (raw)
In-Reply-To: <4663E77A.9040802@comcast.net>

On Jun 04, 2007  06:20 -0400, David H. Lynch Jr. wrote:
> The net result is that implimentation would be simpler if I could
> just read/write, the amount of data that can be done with the least
> amount of work, even if that is less than was requested.
> 
> If I receive a request to read 512 bytes, and I return that I have read
> 486, is either the OS, libc, or something else going to treat that as an
> error, or are they coming back for the rest in a subsequent call ?
> 
> I though I recalled that read()/write() returning a cound less than
> requested is not an error.

It is not strictly an error to read/write less than the requested amount,
but you will find that a lot of applications don't handle this correctly.
They will assume that if the amount read/written is != amount requested
that this is an error.  Of course the opposite is also true - some
applications assume that the amount requested == amount read/written and
don't even check whether that is actually the case or not.

Cheers, Andreas
--
Andreas Dilger
Principal Software Engineer
Cluster File Systems, Inc.


  reply	other threads:[~2007-06-04 16:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-04 10:20 Read/write counts David H. Lynch Jr.
2007-06-04 16:33 ` Andreas Dilger [this message]
2007-06-04 16:56   ` Bryan Henderson
2007-06-04 17:02     ` Matthew Wilcox
2007-06-04 18:33       ` Theodore Tso
2007-06-04 18:57         ` Roman Zippel
2007-06-04 19:24           ` Joel Becker
2007-06-04 20:00           ` Theodore Tso

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=20070604163327.GR5181@schatzie.adilger.int \
    --to=adilger@clusterfs.com \
    --cc=dhlii@comcast.net \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).