Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
f18a5f21
Commit
f18a5f21
authored
Aug 01, 2011
by
Theodore Ts'o
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ext4: use ext4_kvzalloc()/ext4_kvmalloc() for s_group_desc and s_group_info
Signed-off-by:
"Theodore Ts'o"
<
tytso@mit.edu
>
parent
9933fc0a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
13 deletions
+15
-13
fs/ext4/mballoc.c
fs/ext4/mballoc.c
+3
-3
fs/ext4/resize.c
fs/ext4/resize.c
+7
-6
fs/ext4/super.c
fs/ext4/super.c
+5
-4
No files found.
fs/ext4/mballoc.c
View file @
f18a5f21
...
@@ -2331,7 +2331,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
...
@@ -2331,7 +2331,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
/* An 8TB filesystem with 64-bit pointers requires a 4096 byte
/* An 8TB filesystem with 64-bit pointers requires a 4096 byte
* kmalloc. A 128kb malloc should suffice for a 256TB filesystem.
* kmalloc. A 128kb malloc should suffice for a 256TB filesystem.
* So a two level scheme suffices for now. */
* So a two level scheme suffices for now. */
sbi
->
s_group_info
=
k
zalloc
(
array_size
,
GFP_KERNEL
);
sbi
->
s_group_info
=
ext4_kv
zalloc
(
array_size
,
GFP_KERNEL
);
if
(
sbi
->
s_group_info
==
NULL
)
{
if
(
sbi
->
s_group_info
==
NULL
)
{
printk
(
KERN_ERR
"EXT4-fs: can't allocate buddy meta group
\n
"
);
printk
(
KERN_ERR
"EXT4-fs: can't allocate buddy meta group
\n
"
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -2365,7 +2365,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
...
@@ -2365,7 +2365,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
kfree
(
sbi
->
s_group_info
[
i
]);
kfree
(
sbi
->
s_group_info
[
i
]);
iput
(
sbi
->
s_buddy_cache
);
iput
(
sbi
->
s_buddy_cache
);
err_freesgi:
err_freesgi:
k
free
(
sbi
->
s_group_info
);
ext4_kv
free
(
sbi
->
s_group_info
);
return
-
ENOMEM
;
return
-
ENOMEM
;
}
}
...
@@ -2559,7 +2559,7 @@ int ext4_mb_release(struct super_block *sb)
...
@@ -2559,7 +2559,7 @@ int ext4_mb_release(struct super_block *sb)
EXT4_DESC_PER_BLOCK_BITS
(
sb
);
EXT4_DESC_PER_BLOCK_BITS
(
sb
);
for
(
i
=
0
;
i
<
num_meta_group_infos
;
i
++
)
for
(
i
=
0
;
i
<
num_meta_group_infos
;
i
++
)
kfree
(
sbi
->
s_group_info
[
i
]);
kfree
(
sbi
->
s_group_info
[
i
]);
k
free
(
sbi
->
s_group_info
);
ext4_kv
free
(
sbi
->
s_group_info
);
}
}
kfree
(
sbi
->
s_mb_offsets
);
kfree
(
sbi
->
s_mb_offsets
);
kfree
(
sbi
->
s_mb_maxs
);
kfree
(
sbi
->
s_mb_maxs
);
...
...
fs/ext4/resize.c
View file @
f18a5f21
...
@@ -467,12 +467,13 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
...
@@ -467,12 +467,13 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
if
(
unlikely
(
err
))
if
(
unlikely
(
err
))
goto
exit_dindj
;
goto
exit_dindj
;
n_group_desc
=
kmalloc
((
gdb_num
+
1
)
*
sizeof
(
struct
buffer_head
*
),
n_group_desc
=
ext4_kvmalloc
((
gdb_num
+
1
)
*
GFP_NOFS
);
sizeof
(
struct
buffer_head
*
),
GFP_NOFS
);
if
(
!
n_group_desc
)
{
if
(
!
n_group_desc
)
{
err
=
-
ENOMEM
;
err
=
-
ENOMEM
;
ext4_warning
(
sb
,
ext4_warning
(
sb
,
"not enough memory for %lu groups"
,
"not enough memory for %lu groups"
,
gdb_num
+
1
);
gdb_num
+
1
);
goto
exit_inode
;
goto
exit_inode
;
}
}
...
@@ -507,7 +508,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
...
@@ -507,7 +508,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
n_group_desc
[
gdb_num
]
=
gdb_bh
;
n_group_desc
[
gdb_num
]
=
gdb_bh
;
EXT4_SB
(
sb
)
->
s_group_desc
=
n_group_desc
;
EXT4_SB
(
sb
)
->
s_group_desc
=
n_group_desc
;
EXT4_SB
(
sb
)
->
s_gdb_count
++
;
EXT4_SB
(
sb
)
->
s_gdb_count
++
;
k
free
(
o_group_desc
);
ext4_kv
free
(
o_group_desc
);
le16_add_cpu
(
&
es
->
s_reserved_gdt_blocks
,
-
1
);
le16_add_cpu
(
&
es
->
s_reserved_gdt_blocks
,
-
1
);
err
=
ext4_handle_dirty_metadata
(
handle
,
NULL
,
EXT4_SB
(
sb
)
->
s_sbh
);
err
=
ext4_handle_dirty_metadata
(
handle
,
NULL
,
EXT4_SB
(
sb
)
->
s_sbh
);
...
@@ -517,7 +518,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
...
@@ -517,7 +518,7 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
return
err
;
return
err
;
exit_inode:
exit_inode:
k
free
(
n_group_desc
);
ext4_kv
free
(
n_group_desc
);
/* ext4_handle_release_buffer(handle, iloc.bh); */
/* ext4_handle_release_buffer(handle, iloc.bh); */
brelse
(
iloc
.
bh
);
brelse
(
iloc
.
bh
);
exit_dindj:
exit_dindj:
...
...
fs/ext4/super.c
View file @
f18a5f21
...
@@ -819,7 +819,7 @@ static void ext4_put_super(struct super_block *sb)
...
@@ -819,7 +819,7 @@ static void ext4_put_super(struct super_block *sb)
for
(
i
=
0
;
i
<
sbi
->
s_gdb_count
;
i
++
)
for
(
i
=
0
;
i
<
sbi
->
s_gdb_count
;
i
++
)
brelse
(
sbi
->
s_group_desc
[
i
]);
brelse
(
sbi
->
s_group_desc
[
i
]);
k
free
(
sbi
->
s_group_desc
);
ext4_kv
free
(
sbi
->
s_group_desc
);
ext4_kvfree
(
sbi
->
s_flex_groups
);
ext4_kvfree
(
sbi
->
s_flex_groups
);
percpu_counter_destroy
(
&
sbi
->
s_freeblocks_counter
);
percpu_counter_destroy
(
&
sbi
->
s_freeblocks_counter
);
percpu_counter_destroy
(
&
sbi
->
s_freeinodes_counter
);
percpu_counter_destroy
(
&
sbi
->
s_freeinodes_counter
);
...
@@ -3439,8 +3439,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -3439,8 +3439,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
(
EXT4_MAX_BLOCK_FILE_PHYS
/
EXT4_BLOCKS_PER_GROUP
(
sb
)));
(
EXT4_MAX_BLOCK_FILE_PHYS
/
EXT4_BLOCKS_PER_GROUP
(
sb
)));
db_count
=
(
sbi
->
s_groups_count
+
EXT4_DESC_PER_BLOCK
(
sb
)
-
1
)
/
db_count
=
(
sbi
->
s_groups_count
+
EXT4_DESC_PER_BLOCK
(
sb
)
-
1
)
/
EXT4_DESC_PER_BLOCK
(
sb
);
EXT4_DESC_PER_BLOCK
(
sb
);
sbi
->
s_group_desc
=
kmalloc
(
db_count
*
sizeof
(
struct
buffer_head
*
),
sbi
->
s_group_desc
=
ext4_kvmalloc
(
db_count
*
GFP_KERNEL
);
sizeof
(
struct
buffer_head
*
),
GFP_KERNEL
);
if
(
sbi
->
s_group_desc
==
NULL
)
{
if
(
sbi
->
s_group_desc
==
NULL
)
{
ext4_msg
(
sb
,
KERN_ERR
,
"not enough memory"
);
ext4_msg
(
sb
,
KERN_ERR
,
"not enough memory"
);
goto
failed_mount
;
goto
failed_mount
;
...
@@ -3783,7 +3784,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
...
@@ -3783,7 +3784,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
failed_mount2:
failed_mount2:
for
(
i
=
0
;
i
<
db_count
;
i
++
)
for
(
i
=
0
;
i
<
db_count
;
i
++
)
brelse
(
sbi
->
s_group_desc
[
i
]);
brelse
(
sbi
->
s_group_desc
[
i
]);
k
free
(
sbi
->
s_group_desc
);
ext4_kv
free
(
sbi
->
s_group_desc
);
failed_mount:
failed_mount:
if
(
sbi
->
s_proc
)
{
if
(
sbi
->
s_proc
)
{
remove_proc_entry
(
sb
->
s_id
,
ext4_proc_root
);
remove_proc_entry
(
sb
->
s_id
,
ext4_proc_root
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment