Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932195AbVLAMjv (ORCPT ); Thu, 1 Dec 2005 07:39:51 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932193AbVLAMjv (ORCPT ); Thu, 1 Dec 2005 07:39:51 -0500 Received: from mail.fh-wedel.de ([213.39.232.198]:50118 "EHLO moskovskaya.fh-wedel.de") by vger.kernel.org with ESMTP id S932192AbVLAMju (ORCPT ); Thu, 1 Dec 2005 07:39:50 -0500 Date: Thu, 1 Dec 2005 13:39:53 +0100 From: =?iso-8859-1?Q?J=F6rn?= Engel To: Takashi Sato Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: stat64 for over 2TB file returned invalid st_blocks Message-ID: <20051201123953.GA24519@wohnheim.fh-wedel.de> References: <01e901c5f66e$d4551b70$4168010a@bsd.tnes.nec.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <01e901c5f66e$d4551b70$4168010a@bsd.tnes.nec.co.jp> User-Agent: Mutt/1.5.9i Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1108 Lines: 31 On Thu, 1 December 2005 21:00:26 +0900, Takashi Sato wrote: > > I found a problem at stat64 on 32bit architecture. > > When I called stat64 for a file which is larger than 2TB, stat64 > returned an invalid number of blocks at st_blocks on 32bit > architecture, although it returned a valid number of blocks on 64bit > architecture(ia64). My take was to simply hold a u64 in the fs-private inode structure and use ULONG_MAX for inode->i_blocks in case of an overflow. Also has the nice advantage of working with fs-sized blocks, not 512-byte ones: inode->i_blocks = ULONG_MAX; if (li->li_blocks<<3 < ULONG_MAX) inode->i_blocks = li->li_blocks<<3; That said, your solution appears to be much better, as long as it doesnt subtly break binary compatibility. J?rn -- ticks = jiffies; while (ticks == jiffies); ticks = jiffies; -- /usr/src/linux/init/main.c - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/