aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/ialloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ext4/ialloc.c')
-rw-r--r--fs/ext4/ialloc.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index 45c66a03f182..5e66a2feef09 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -154,17 +154,17 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)
154 * though), and then we'd have two inodes sharing the 154 * though), and then we'd have two inodes sharing the
155 * same inode number and space on the harddisk. 155 * same inode number and space on the harddisk.
156 */ 156 */
157void ext4_free_inode (handle_t *handle, struct inode * inode) 157void ext4_free_inode(handle_t *handle, struct inode *inode)
158{ 158{
159 struct super_block * sb = inode->i_sb; 159 struct super_block *sb = inode->i_sb;
160 int is_directory; 160 int is_directory;
161 unsigned long ino; 161 unsigned long ino;
162 struct buffer_head *bitmap_bh = NULL; 162 struct buffer_head *bitmap_bh = NULL;
163 struct buffer_head *bh2; 163 struct buffer_head *bh2;
164 ext4_group_t block_group; 164 ext4_group_t block_group;
165 unsigned long bit; 165 unsigned long bit;
166 struct ext4_group_desc * gdp; 166 struct ext4_group_desc *gdp;
167 struct ext4_super_block * es; 167 struct ext4_super_block *es;
168 struct ext4_sb_info *sbi; 168 struct ext4_sb_info *sbi;
169 int fatal = 0, err; 169 int fatal = 0, err;
170 ext4_group_t flex_group; 170 ext4_group_t flex_group;
@@ -187,7 +187,7 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
187 sbi = EXT4_SB(sb); 187 sbi = EXT4_SB(sb);
188 188
189 ino = inode->i_ino; 189 ino = inode->i_ino;
190 ext4_debug ("freeing inode %lu\n", ino); 190 ext4_debug("freeing inode %lu\n", ino);
191 191
192 /* 192 /*
193 * Note: we must free any quota before locking the superblock, 193 * Note: we must free any quota before locking the superblock,
@@ -201,12 +201,12 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
201 is_directory = S_ISDIR(inode->i_mode); 201 is_directory = S_ISDIR(inode->i_mode);
202 202
203 /* Do this BEFORE marking the inode not in use or returning an error */ 203 /* Do this BEFORE marking the inode not in use or returning an error */
204 clear_inode (inode); 204 clear_inode(inode);
205 205
206 es = EXT4_SB(sb)->s_es; 206 es = EXT4_SB(sb)->s_es;
207 if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) { 207 if (ino < EXT4_FIRST_INO(sb) || ino > le32_to_cpu(es->s_inodes_count)) {
208 ext4_error (sb, "ext4_free_inode", 208 ext4_error(sb, "ext4_free_inode",
209 "reserved or nonexistent inode %lu", ino); 209 "reserved or nonexistent inode %lu", ino);
210 goto error_return; 210 goto error_return;
211 } 211 }
212 block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb); 212 block_group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
@@ -223,10 +223,10 @@ void ext4_free_inode (handle_t *handle, struct inode * inode)
223 /* Ok, now we can actually update the inode bitmaps.. */ 223 /* Ok, now we can actually update the inode bitmaps.. */
224 if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group), 224 if (!ext4_clear_bit_atomic(sb_bgl_lock(sbi, block_group),
225 bit, bitmap_bh->b_data)) 225 bit, bitmap_bh->b_data))
226 ext4_error (sb, "ext4_free_inode", 226 ext4_error(sb, "ext4_free_inode",
227 "bit already cleared for inode %lu", ino); 227 "bit already cleared for inode %lu", ino);
228 else { 228 else {
229 gdp = ext4_get_group_desc (sb, block_group, &bh2); 229 gdp = ext4_get_group_desc(sb, block_group, &bh2);
230 230
231 BUFFER_TRACE(bh2, "get_write_access"); 231 BUFFER_TRACE(bh2, "get_write_access");
232 fatal = ext4_journal_get_write_access(handle, bh2); 232 fatal = ext4_journal_get_write_access(handle, bh2);
@@ -288,7 +288,7 @@ static int find_group_dir(struct super_block *sb, struct inode *parent,
288 avefreei = freei / ngroups; 288 avefreei = freei / ngroups;
289 289
290 for (group = 0; group < ngroups; group++) { 290 for (group = 0; group < ngroups; group++) {
291 desc = ext4_get_group_desc (sb, group, NULL); 291 desc = ext4_get_group_desc(sb, group, NULL);
292 if (!desc || !desc->bg_free_inodes_count) 292 if (!desc || !desc->bg_free_inodes_count)
293 continue; 293 continue;
294 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) 294 if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei)
@@ -577,16 +577,16 @@ static int find_group_other(struct super_block *sb, struct inode *parent,
577 * For other inodes, search forward from the parent directory's block 577 * For other inodes, search forward from the parent directory's block
578 * group to find a free inode. 578 * group to find a free inode.
579 */ 579 */
580struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode) 580struct inode *ext4_new_inode(handle_t *handle, struct inode *dir, int mode)
581{ 581{
582 struct super_block *sb; 582 struct super_block *sb;
583 struct buffer_head *bitmap_bh = NULL; 583 struct buffer_head *bitmap_bh = NULL;
584 struct buffer_head *bh2; 584 struct buffer_head *bh2;
585 ext4_group_t group = 0; 585 ext4_group_t group = 0;
586 unsigned long ino = 0; 586 unsigned long ino = 0;
587 struct inode * inode; 587 struct inode *inode;
588 struct ext4_group_desc * gdp = NULL; 588 struct ext4_group_desc *gdp = NULL;
589 struct ext4_super_block * es; 589 struct ext4_super_block *es;
590 struct ext4_inode_info *ei; 590 struct ext4_inode_info *ei;
591 struct ext4_sb_info *sbi; 591 struct ext4_sb_info *sbi;
592 int ret2, err = 0; 592 int ret2, err = 0;
@@ -614,7 +614,7 @@ struct inode *ext4_new_inode(handle_t *handle, struct inode * dir, int mode)
614 } 614 }
615 615
616 if (S_ISDIR(mode)) { 616 if (S_ISDIR(mode)) {
617 if (test_opt (sb, OLDALLOC)) 617 if (test_opt(sb, OLDALLOC))
618 ret2 = find_group_dir(sb, dir, &group); 618 ret2 = find_group_dir(sb, dir, &group);
619 else 619 else
620 ret2 = find_group_orlov(sb, dir, &group); 620 ret2 = find_group_orlov(sb, dir, &group);
@@ -784,7 +784,7 @@ got:
784 } 784 }
785 785
786 inode->i_uid = current->fsuid; 786 inode->i_uid = current->fsuid;
787 if (test_opt (sb, GRPID)) 787 if (test_opt(sb, GRPID))
788 inode->i_gid = dir->i_gid; 788 inode->i_gid = dir->i_gid;
789 else if (dir->i_mode & S_ISGID) { 789 else if (dir->i_mode & S_ISGID) {
790 inode->i_gid = dir->i_gid; 790 inode->i_gid = dir->i_gid;
@@ -833,7 +833,7 @@ got:
833 ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize; 833 ei->i_extra_isize = EXT4_SB(sb)->s_want_extra_isize;
834 834
835 ret = inode; 835 ret = inode;
836 if(DQUOT_ALLOC_INODE(inode)) { 836 if (DQUOT_ALLOC_INODE(inode)) {
837 err = -EDQUOT; 837 err = -EDQUOT;
838 goto fail_drop; 838 goto fail_drop;
839 } 839 }
@@ -842,7 +842,7 @@ got:
842 if (err) 842 if (err)
843 goto fail_free_drop; 843 goto fail_free_drop;
844 844
845 err = ext4_init_security(handle,inode, dir); 845 err = ext4_init_security(handle, inode, dir);
846 if (err) 846 if (err)
847 goto fail_free_drop; 847 goto fail_free_drop;
848 848
@@ -960,7 +960,7 @@ error:
960 return ERR_PTR(err); 960 return ERR_PTR(err);
961} 961}
962 962
963unsigned long ext4_count_free_inodes (struct super_block * sb) 963unsigned long ext4_count_free_inodes(struct super_block *sb)
964{ 964{
965 unsigned long desc_count; 965 unsigned long desc_count;
966 struct ext4_group_desc *gdp; 966 struct ext4_group_desc *gdp;
@@ -975,7 +975,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
975 bitmap_count = 0; 975 bitmap_count = 0;
976 gdp = NULL; 976 gdp = NULL;
977 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { 977 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) {
978 gdp = ext4_get_group_desc (sb, i, NULL); 978 gdp = ext4_get_group_desc(sb, i, NULL);
979 if (!gdp) 979 if (!gdp)
980 continue; 980 continue;
981 desc_count += le16_to_cpu(gdp->bg_free_inodes_count); 981 desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
@@ -997,7 +997,7 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
997#else 997#else
998 desc_count = 0; 998 desc_count = 0;
999 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { 999 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) {
1000 gdp = ext4_get_group_desc (sb, i, NULL); 1000 gdp = ext4_get_group_desc(sb, i, NULL);
1001 if (!gdp) 1001 if (!gdp)
1002 continue; 1002 continue;
1003 desc_count += le16_to_cpu(gdp->bg_free_inodes_count); 1003 desc_count += le16_to_cpu(gdp->bg_free_inodes_count);
@@ -1008,13 +1008,13 @@ unsigned long ext4_count_free_inodes (struct super_block * sb)
1008} 1008}
1009 1009
1010/* Called at mount-time, super-block is locked */ 1010/* Called at mount-time, super-block is locked */
1011unsigned long ext4_count_dirs (struct super_block * sb) 1011unsigned long ext4_count_dirs(struct super_block * sb)
1012{ 1012{
1013 unsigned long count = 0; 1013 unsigned long count = 0;
1014 ext4_group_t i; 1014 ext4_group_t i;
1015 1015
1016 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) { 1016 for (i = 0; i < EXT4_SB(sb)->s_groups_count; i++) {
1017 struct ext4_group_desc *gdp = ext4_get_group_desc (sb, i, NULL); 1017 struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL);
1018 if (!gdp) 1018 if (!gdp)
1019 continue; 1019 continue;
1020 count += le16_to_cpu(gdp->bg_used_dirs_count); 1020 count += le16_to_cpu(gdp->bg_used_dirs_count);