From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andreas Dilger Subject: Re: Read/write counts Date: Mon, 4 Jun 2007 10:33:27 -0600 Message-ID: <20070604163327.GR5181@schatzie.adilger.int> References: <4663E77A.9040802@comcast.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org To: "David H. Lynch Jr." Return-path: Received: from mail.clusterfs.com ([206.168.112.78]:45672 "EHLO mail.clusterfs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756693AbXFDQd3 (ORCPT ); Mon, 4 Jun 2007 12:33:29 -0400 Content-Disposition: inline In-Reply-To: <4663E77A.9040802@comcast.net> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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.