2235219b77
This is a patch that speeds up statfs. It is very simple - the "overhead" calculation, which takes a huge amount of time for large filesystems, never changes unless the size of the filesystem itself changes. That means we can store it in memory and only recalculate if the filesystem has been resized (almost never). It also fixes a minor problem that we never update the on-disk superblock free blocks/inodes counts until the filesystem is unmounted. While not fatal, we may as well update that on disk when we have the information, and it makes things like debugfs and dumpe2fs report a bit more accurate info. Signed-off-by: Badari Pulavarty <pbadari@us.ibm.com> Signed-off-by: Andreas Dilger <adilger@clusterfs.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
60 lines
2 KiB
C
60 lines
2 KiB
C
/*
|
|
* linux/include/linux/ext2_fs_sb.h
|
|
*
|
|
* Copyright (C) 1992, 1993, 1994, 1995
|
|
* Remy Card (card@masi.ibp.fr)
|
|
* Laboratoire MASI - Institut Blaise Pascal
|
|
* Universite Pierre et Marie Curie (Paris VI)
|
|
*
|
|
* from
|
|
*
|
|
* linux/include/linux/minix_fs_sb.h
|
|
*
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
*/
|
|
|
|
#ifndef _LINUX_EXT2_FS_SB
|
|
#define _LINUX_EXT2_FS_SB
|
|
|
|
#include <linux/blockgroup_lock.h>
|
|
#include <linux/percpu_counter.h>
|
|
|
|
/*
|
|
* second extended-fs super-block data in memory
|
|
*/
|
|
struct ext2_sb_info {
|
|
unsigned long s_frag_size; /* Size of a fragment in bytes */
|
|
unsigned long s_frags_per_block;/* Number of fragments per block */
|
|
unsigned long s_inodes_per_block;/* Number of inodes per block */
|
|
unsigned long s_frags_per_group;/* Number of fragments in a group */
|
|
unsigned long s_blocks_per_group;/* Number of blocks in a group */
|
|
unsigned long s_inodes_per_group;/* Number of inodes in a group */
|
|
unsigned long s_itb_per_group; /* Number of inode table blocks per group */
|
|
unsigned long s_gdb_count; /* Number of group descriptor blocks */
|
|
unsigned long s_desc_per_block; /* Number of group descriptors per block */
|
|
unsigned long s_groups_count; /* Number of groups in the fs */
|
|
unsigned long s_overhead_last; /* Last calculated overhead */
|
|
unsigned long s_blocks_last; /* Last seen block count */
|
|
struct buffer_head * s_sbh; /* Buffer containing the super block */
|
|
struct ext2_super_block * s_es; /* Pointer to the super block in the buffer */
|
|
struct buffer_head ** s_group_desc;
|
|
unsigned long s_mount_opt;
|
|
uid_t s_resuid;
|
|
gid_t s_resgid;
|
|
unsigned short s_mount_state;
|
|
unsigned short s_pad;
|
|
int s_addr_per_block_bits;
|
|
int s_desc_per_block_bits;
|
|
int s_inode_size;
|
|
int s_first_ino;
|
|
spinlock_t s_next_gen_lock;
|
|
u32 s_next_generation;
|
|
unsigned long s_dir_count;
|
|
u8 *s_debts;
|
|
struct percpu_counter s_freeblocks_counter;
|
|
struct percpu_counter s_freeinodes_counter;
|
|
struct percpu_counter s_dirs_counter;
|
|
struct blockgroup_lock s_blockgroup_lock;
|
|
};
|
|
|
|
#endif /* _LINUX_EXT2_FS_SB */
|