Re: stat64 for over 2TB file returned invalid st_blocks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux