From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Chinner Subject: Re: fallocate vs ENOSPC Date: Tue, 29 Nov 2011 11:26:29 +1100 Message-ID: <20111129002629.GB2386@dastard> References: <4ECF6D41.2040801@draigBrady.com> <20111125104050.GA26729@infradead.org> <20111127031455.GK5167@thunk.org> <20111127234331.GW2386@dastard> <20111128051054.GZ2386@dastard> <4ED34C66.8050300@draigBrady.com> <20111128184940.GA5170@samba2> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Theodore Tso , =?iso-8859-1?Q?P=E1draig?= Brady , Christoph Hellwig , linux-fsdevel@vger.kernel.org To: Jeremy Allison Return-path: Received: from ipmail05.adl6.internode.on.net ([150.101.137.143]:54751 "EHLO ipmail05.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750963Ab1K2A0c (ORCPT ); Mon, 28 Nov 2011 19:26:32 -0500 Content-Disposition: inline In-Reply-To: <20111128184940.GA5170@samba2> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Nov 28, 2011 at 10:49:40AM -0800, Jeremy Allison wrote: > On Mon, Nov 28, 2011 at 09:36:18AM -0500, Theodore Tso wrote: > >=20 > > On Nov 28, 2011, at 3:55 AM, P=E1draig Brady wrote: > >=20 > > >=20 > > > You lucidly detailed issues with 1. which I suppose could be some= what > > > mitigated by not fallocating < say 1MB, though I suppose file sys= tems > > > could be smarter here and not preallocate small chunks (or when > > > otherwise not appropriate). We can already get ENOSPC from a writ= e() > > > after an fallocate() in certain edge cases, so it would probably = make > > > sense to expand those cases. > >=20 > > I'm curious -- why are you so worried about ENOSPC? > >=20 > > You need to check the error returns on write(2) anyway (and it's go= od > > programming practice anyways --- don't forget to check on close bec= ause > > some network file systems only push to the network on close, and in > > some cases they might only get quota errors on the close), so I don= 't see > > why using fallocate() to get an early ENOSPC is so interesting for = you. >=20 > Unfortunately for Samba, Windows clients will *only* report ENOSPC > to the userspace apps if the initial fallocation fails. Most of > the Windows apps don't bother to check for write() fails after > the initial allocation succeeds. >=20 > We check for and report them back to the Windows client anyway of > course, but most Windows apps just silently corrupt their data in > this case. >=20 > That's why we use fallocate() in Samba :-(. IOWs, what you really want is a space reservation mechanism. You've only got this preallocate hammer, so you use it, yes? Cheers, Dave. --=20 Dave Chinner david@fromorbit.com -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html