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
7dcaa802
Commit
7dcaa802
authored
Dec 21, 2002
by
Andrew Morton
Committed by
Linus Torvalds
Dec 21, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] ext2: smarter block allocation startup
The same thing, for ext2.
parent
d2562c9d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
fs/ext2/inode.c
fs/ext2/inode.c
+14
-3
No files found.
fs/ext2/inode.c
View file @
7dcaa802
...
...
@@ -303,14 +303,22 @@ static Indirect *ext2_get_branch(struct inode *inode,
* + if there is a block to the left of our position - allocate near it.
* + if pointer will live in indirect block - allocate near that block.
* + if pointer will live in inode - allocate in the same cylinder group.
*
* In the latter case we colour the starting block by the callers PID to
* prevent it from clashing with concurrent allocations for a different inode
* in the same block group. The PID is used here so that functionally related
* files will be close-by on-disk.
*
* Caller must make sure that @ind is valid and will stay that way.
*/
static
inline
unsigned
long
ext2_find_near
(
struct
inode
*
inode
,
Indirect
*
ind
)
static
unsigned
long
ext2_find_near
(
struct
inode
*
inode
,
Indirect
*
ind
)
{
struct
ext2_inode_info
*
ei
=
EXT2_I
(
inode
);
u32
*
start
=
ind
->
bh
?
(
u32
*
)
ind
->
bh
->
b_data
:
ei
->
i_data
;
u32
*
p
;
unsigned
long
bg_start
;
unsigned
long
colour
;
/* Try to find previous block */
for
(
p
=
ind
->
p
-
1
;
p
>=
start
;
p
--
)
...
...
@@ -325,8 +333,11 @@ static inline unsigned long ext2_find_near(struct inode *inode, Indirect *ind)
* It is going to be refered from inode itself? OK, just put it into
* the same cylinder group then.
*/
return
(
ei
->
i_block_group
*
EXT2_BLOCKS_PER_GROUP
(
inode
->
i_sb
))
+
le32_to_cpu
(
EXT2_SB
(
inode
->
i_sb
)
->
s_es
->
s_first_data_block
);
bg_start
=
(
ei
->
i_block_group
*
EXT2_BLOCKS_PER_GROUP
(
inode
->
i_sb
))
+
le32_to_cpu
(
EXT2_SB
(
inode
->
i_sb
)
->
s_es
->
s_first_data_block
);
colour
=
(
current
->
pid
%
16
)
*
(
EXT2_BLOCKS_PER_GROUP
(
inode
->
i_sb
)
/
16
);
return
bg_start
+
colour
;
}
/**
...
...
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