From: Christoph Hellwig Subject: Re: [BUG] copy file result with zero Date: Sun, 2 Oct 2011 07:54:38 -0400 Message-ID: <20111002115438.GA24073@infradead.org> References: <20111001143900.GH28234@thunk.org> <89E75765-AC24-4EF4-9547-6EE7A1A38B5A@dilger.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Jeff liu , Yongqiang Yang , Dave Young , Ted Ts'o , Linux Kernel Mailing List , linux-ext4@vger.kernel.org To: Andreas Dilger Return-path: Received: from 173-166-109-252-newengland.hfc.comcastbusiness.net ([173.166.109.252]:43262 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752196Ab1JBLyo (ORCPT ); Sun, 2 Oct 2011 07:54:44 -0400 Content-Disposition: inline In-Reply-To: <89E75765-AC24-4EF4-9547-6EE7A1A38B5A@dilger.ca> Sender: linux-ext4-owner@vger.kernel.org List-ID: On Sun, Oct 02, 2011 at 12:59:22AM -0700, Andreas Dilger wrote: > My understanding is that cp uses the blocks count to determine whether the file is sparse or not. In the case of delayed allocation (where blocks are not yet allocated, if they are not reflected in the i_blocks count) it might mistakenly think that the file is sparse. Ext4 fortunatley is smart enough to add the delalloc blocks to st_blocks for state, just like all other filesystems implementing delayed allocations.