aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext2/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext2/super.c')
-rw-r--r--fs/ext2/super.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index d8b9abd95d07..6347c2dbdd81 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -135,12 +135,12 @@ static void ext2_put_super (struct super_block * sb)
135 return; 135 return;
136} 136}
137 137
138static kmem_cache_t * ext2_inode_cachep; 138static struct kmem_cache * ext2_inode_cachep;
139 139
140static struct inode *ext2_alloc_inode(struct super_block *sb) 140static struct inode *ext2_alloc_inode(struct super_block *sb)
141{ 141{
142 struct ext2_inode_info *ei; 142 struct ext2_inode_info *ei;
143 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, SLAB_KERNEL); 143 ei = (struct ext2_inode_info *)kmem_cache_alloc(ext2_inode_cachep, GFP_KERNEL);
144 if (!ei) 144 if (!ei)
145 return NULL; 145 return NULL;
146#ifdef CONFIG_EXT2_FS_POSIX_ACL 146#ifdef CONFIG_EXT2_FS_POSIX_ACL
@@ -156,7 +156,7 @@ static void ext2_destroy_inode(struct inode *inode)
156 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode)); 156 kmem_cache_free(ext2_inode_cachep, EXT2_I(inode));
157} 157}
158 158
159static void init_once(void * foo, kmem_cache_t * cachep, unsigned long flags) 159static void init_once(void * foo, struct kmem_cache * cachep, unsigned long flags)
160{ 160{
161 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo; 161 struct ext2_inode_info *ei = (struct ext2_inode_info *) foo;
162 162
@@ -597,8 +597,6 @@ static int ext2_check_descriptors (struct super_block * sb)
597 return 1; 597 return 1;
598} 598}
599 599
600#define log2(n) ffz(~(n))
601
602/* 600/*
603 * Maximal file size. There is a direct, and {,double-,triple-}indirect 601 * Maximal file size. There is a direct, and {,double-,triple-}indirect
604 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks. 602 * block limit, and also a limit of (2^32 - 1) 512-byte sectors in i_blocks.
@@ -834,9 +832,9 @@ static int ext2_fill_super(struct super_block *sb, void *data, int silent)
834 sbi->s_sbh = bh; 832 sbi->s_sbh = bh;
835 sbi->s_mount_state = le16_to_cpu(es->s_state); 833 sbi->s_mount_state = le16_to_cpu(es->s_state);
836 sbi->s_addr_per_block_bits = 834 sbi->s_addr_per_block_bits =
837 log2 (EXT2_ADDR_PER_BLOCK(sb)); 835 ilog2 (EXT2_ADDR_PER_BLOCK(sb));
838 sbi->s_desc_per_block_bits = 836 sbi->s_desc_per_block_bits =
839 log2 (EXT2_DESC_PER_BLOCK(sb)); 837 ilog2 (EXT2_DESC_PER_BLOCK(sb));
840 838
841 if (sb->s_magic != EXT2_SUPER_MAGIC) 839 if (sb->s_magic != EXT2_SUPER_MAGIC)
842 goto cantfind_ext2; 840 goto cantfind_ext2;
@@ -1090,8 +1088,10 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1090{ 1088{
1091 struct super_block *sb = dentry->d_sb; 1089 struct super_block *sb = dentry->d_sb;
1092 struct ext2_sb_info *sbi = EXT2_SB(sb); 1090 struct ext2_sb_info *sbi = EXT2_SB(sb);
1091 struct ext2_super_block *es = sbi->s_es;
1093 unsigned long overhead; 1092 unsigned long overhead;
1094 int i; 1093 int i;
1094 u64 fsid;
1095 1095
1096 if (test_opt (sb, MINIX_DF)) 1096 if (test_opt (sb, MINIX_DF))
1097 overhead = 0; 1097 overhead = 0;
@@ -1104,7 +1104,7 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1104 * All of the blocks before first_data_block are 1104 * All of the blocks before first_data_block are
1105 * overhead 1105 * overhead
1106 */ 1106 */
1107 overhead = le32_to_cpu(sbi->s_es->s_first_data_block); 1107 overhead = le32_to_cpu(es->s_first_data_block);
1108 1108
1109 /* 1109 /*
1110 * Add the overhead attributed to the superblock and 1110 * Add the overhead attributed to the superblock and
@@ -1125,14 +1125,18 @@ static int ext2_statfs (struct dentry * dentry, struct kstatfs * buf)
1125 1125
1126 buf->f_type = EXT2_SUPER_MAGIC; 1126 buf->f_type = EXT2_SUPER_MAGIC;
1127 buf->f_bsize = sb->s_blocksize; 1127 buf->f_bsize = sb->s_blocksize;
1128 buf->f_blocks = le32_to_cpu(sbi->s_es->s_blocks_count) - overhead; 1128 buf->f_blocks = le32_to_cpu(es->s_blocks_count) - overhead;
1129 buf->f_bfree = ext2_count_free_blocks(sb); 1129 buf->f_bfree = ext2_count_free_blocks(sb);
1130 buf->f_bavail = buf->f_bfree - le32_to_cpu(sbi->s_es->s_r_blocks_count); 1130 buf->f_bavail = buf->f_bfree - le32_to_cpu(es->s_r_blocks_count);
1131 if (buf->f_bfree < le32_to_cpu(sbi->s_es->s_r_blocks_count)) 1131 if (buf->f_bfree < le32_to_cpu(es->s_r_blocks_count))
1132 buf->f_bavail = 0; 1132 buf->f_bavail = 0;
1133 buf->f_files = le32_to_cpu(sbi->s_es->s_inodes_count); 1133 buf->f_files = le32_to_cpu(es->s_inodes_count);
1134 buf->f_ffree = ext2_count_free_inodes (sb); 1134 buf->f_ffree = ext2_count_free_inodes(sb);
1135 buf->f_namelen = EXT2_NAME_LEN; 1135 buf->f_namelen = EXT2_NAME_LEN;
1136 fsid = le64_to_cpup((void *)es->s_uuid) ^
1137 le64_to_cpup((void *)es->s_uuid + sizeof(u64));
1138 buf->f_fsid.val[0] = fsid & 0xFFFFFFFFUL;
1139 buf->f_fsid.val[1] = (fsid >> 32) & 0xFFFFFFFFUL;
1136 return 0; 1140 return 0;
1137} 1141}
1138 1142