Commit cf4eb321 authored by Jan Kara's avatar Jan Kara

ext2: Simplify initialization in ext2_try_to_allocate()

Somewhat simplify the logic initializing search start and end in
ext2_try_to_allocate(). No functional change.
Signed-off-by: default avatarJan Kara <jack@suse.cz>
parent 90f3741c
...@@ -671,29 +671,17 @@ ext2_try_to_allocate(struct super_block *sb, int group, ...@@ -671,29 +671,17 @@ ext2_try_to_allocate(struct super_block *sb, int group,
ext2_grpblk_t start, end; ext2_grpblk_t start, end;
unsigned long num = 0; unsigned long num = 0;
start = 0;
end = group_last_block - group_first_block + 1;
/* we do allocation within the reservation window if we have a window */ /* we do allocation within the reservation window if we have a window */
if (my_rsv) { if (my_rsv) {
if (my_rsv->_rsv_start >= group_first_block) if (my_rsv->_rsv_start >= group_first_block)
start = my_rsv->_rsv_start - group_first_block; start = my_rsv->_rsv_start - group_first_block;
else if (my_rsv->_rsv_end < group_last_block)
/* reservation window cross group boundary */
start = 0;
end = my_rsv->_rsv_end - group_first_block + 1; end = my_rsv->_rsv_end - group_first_block + 1;
if (end > group_last_block - group_first_block + 1) if (grp_goal < start || grp_goal >= end)
/* reservation window crosses group boundary */
end = group_last_block - group_first_block + 1;
if ((start <= grp_goal) && (grp_goal < end))
start = grp_goal;
else
grp_goal = -1; grp_goal = -1;
} else {
if (grp_goal > 0)
start = grp_goal;
else
start = 0;
end = group_last_block - group_first_block + 1;
} }
BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb)); BUG_ON(start > EXT2_BLOCKS_PER_GROUP(sb));
repeat: repeat:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment