lkml.org 
[lkml]   [2001]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch] make tmpfs_statfs more user friendly
From
Date
Hi Andreas,

On Mon, 5 Feb 2001, Andreas Dilger wrote:
>> diff -uNr 2.4.1-tmpfs/mm/shmem.c 2.4.1-tmpfs-fstat/mm/shmem.c
>> --- 2.4.1-tmpfs/mm/shmem.c Sun Feb 4 16:08:57 2001
>> +++ 2.4.1-tmpfs-fstat/mm/shmem.c Sun Feb 4 16:09:50 2001
>> @@ -696,13 +696,20 @@
>> buf->f_type = TMPFS_MAGIC;
>> buf->f_bsize = PAGE_CACHE_SIZE;
>> spin_lock (&sb->u.shmem_sb.stat_lock);
>> - if (sb->u.shmem_sb.max_blocks != ULONG_MAX ||
>> - sb->u.shmem_sb.max_inodes != ULONG_MAX) {
>> + if (sb->u.shmem_sb.max_blocks == ULONG_MAX) {
>> + /*
>> + * This is only a guestimate and not honoured.
>> + * We need it to make some programs happy which like to
>> + * test the free space of a file system.
>> + */
>> + buf->f_bavail = buf->f_bfree = nr_free_pages() + nr_swap_pages + atomic_read(&buffermem_pages);
>
> Should f_bavail be reduced by freepages.min or freepages.low?

Is it still used? If yes, good idea.

>> + buf->f_blocks = buf->f_bfree + ULONG_MAX - sb->u.shmem_sb.free_blocks;
>
> It's not really clear what you are trying to calculate here...

(ULONG_MAX - sb->u.shmem_sb.free_blocks) is the number of occupied
blocks by this instance. So the size of the instance should be clearly
buf->f_bfree + ULONG_MAX - sb->u.shmem_sb.free_blocks

> Since f_blocks is a long, adding ULONG_MAX == subtracting 1. Maybe
> it should just hold the total amount of VM in the system,
> (i.e. totalram_pages)?

Nope, see above

Greetings
Christoph

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:57    [W:0.096 / U:0.060 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site