Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75332 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10803 invoked from network); 8 Jul 2014 07:37:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Jul 2014 07:37:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=unknown Received-SPF: error (pb1.pair.com: domain hoa-project.net from 95.130.10.56 cause and error) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 95.130.10.56 host1.ip6-networks.net Received: from [95.130.10.56] ([95.130.10.56:50460] helo=host1.ip6-networks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 78/20-09773-4AF9BB35 for ; Tue, 08 Jul 2014 03:37:09 -0400 Received: from host1.ip6-networks.net (localhost [127.0.0.1]) by host1.ip6-networks.net (Postfix) with ESMTP id 4EB9B60C20 for ; Tue, 8 Jul 2014 09:37:04 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=hoa-project.net; h= message-id:date:from:mime-version:to:subject:references :in-reply-to:content-type:content-transfer-encoding; s=dkim; bh= nrvJDN4z08goANpqCP5vDYrEoSNSj27ojr+ob9AXv7g=; b=Npztbm6475e20wnr fr/LWNCyg9+Y2KcCCjP24BLYRtSKhuz+4gFCAh0FKHxZz4CJqtTGKWh4WWYVvIRR RAU51EbOEv+DgA/FuQ1l8qdk/PaQM7Lb9tCiP6FdfD05AsnO9G4Qh9FFVSHE/8CM QwtDLGwYTVJ+c3Ujr5MUnEdkiDw= Received: from Hwhost2.local (5-40.0-85.cust.bluewin.ch [85.0.40.5]) by host1.ip6-networks.net (Postfix) with ESMTPSA id 6AFD36084D for ; Tue, 8 Jul 2014 09:37:01 +0200 (CEST) Message-ID: <53BB9F9C.20308@hoa-project.net> Date: Tue, 08 Jul 2014 09:37:00 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: internals@lists.php.net References: In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Implemented fallocate() syscall in streams From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 13/06/2014 16:20, Julien Pauli wrote: > Hi, Hello :-), > I just wrote a patch to add fallocate() syscall support for streams. > It relies on posix_fallocate(), so that it should support many Unixes. > Linux's got a specification with a fallocate() function, more powerful > than the posix call. > > fallocate() does write blocks to the underlying filesystem (not so > many are supported, but the ones not supported should proxy to > ftruncate()) and prevents sparse file creation whereas ftruncate() > just updates inode information, leading to possible future out of > space errors. > > I got a POC showing the diffs between both calls here : > https://gist.github.com/jpauli/8afec7c4fc2b38f8ff27 > > I propose two APIs for PHP : > - One that adds a function : fallocate() > https://github.com/jpauli/php-src/tree/fallocate I prefer this one. > - One that relies on ftruncate() , and adds a $use_fallocate > flag https://github.com/jpauli/php-src/tree/fallocate_flag > > Please, note that the latest proposal requires patches in different > extensions, as I changed a PHP_API function signature. > > I don't know if Windows can support that. Pierre, Anatol ? :-) > > Tests are beeing written at the moment. > > I didn't implement this is user stream handlers, as this really is a > low level implementation design that is kind of useless for usage in > user streams. > > Thoughts ? If the first one is used, please, consider exposing it on the user-land of stream wrappers (exemple: `stream_allocate`) if possible. Cheers. -- Ivan Enderlin Developer of Hoa http://hoa-project.net/ PhD. student at DISC/Femto-ST (Vesontio) and INRIA (Cassis) http://disc.univ-fcomte.fr/ and http://www.inria.fr/ Member of HTML and WebApps Working Group of W3C http://w3.org/