summaryrefslogtreecommitdiffstats
path: root/fs/ext2
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2019-11-06 16:39:26 +0100
committerJan Kara <jack@suse.cz>2019-11-07 12:35:22 +0100
commitcf4eb321b3ad63248069a8038df126fcf9ed9100 (patch)
treef2177b2e1ac06aeff43b3f29a12bcbe105906816 /fs/ext2
parentext2: code cleanup by calling ext2_group_last_block_no() (diff)
downloadlinux-cf4eb321b3ad63248069a8038df126fcf9ed9100.tar.xz
linux-cf4eb321b3ad63248069a8038df126fcf9ed9100.zip
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: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ext2')
-rw-r--r--fs/ext2/balloc.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/fs/ext2/balloc.c b/fs/ext2/balloc.c
index 994a1fd18e93..b7a4d74dfde7 100644
--- a/fs/ext2/balloc.c
+++ b/fs/ext2/balloc.c
@@ -671,29 +671,17 @@ ext2_try_to_allocate(struct super_block *sb, int group,
ext2_grpblk_t start, end;
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 */
if (my_rsv) {
if (my_rsv->_rsv_start >= group_first_block)
start = my_rsv->_rsv_start - group_first_block;
- else
- /* reservation window cross group boundary */
- start = 0;
- end = my_rsv->_rsv_end - group_first_block + 1;
- if (end > group_last_block - group_first_block + 1)
- /* reservation window crosses group boundary */
- end = group_last_block - group_first_block + 1;
- if ((start <= grp_goal) && (grp_goal < end))
- start = grp_goal;
- else
+ if (my_rsv->_rsv_end < group_last_block)
+ end = my_rsv->_rsv_end - group_first_block + 1;
+ if (grp_goal < start || grp_goal >= end)
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));
repeat: