Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 96809
b: refs/heads/master
c: 1930479
h: refs/heads/master
i:
  96807: 19e68f2
v: v3
  • Loading branch information
Valerie Clement authored and Theodore Ts'o committed May 13, 2008
1 parent 4213455 commit c1c1a82
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c8be6b222f76c332d9faeb00c047996d340632c
refs/heads/master: 1930479c4b6bbcb6f164a5b3498e0d98329967f4
19 changes: 9 additions & 10 deletions trunk/fs/ext4/mballoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2880,12 +2880,11 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
if (size < i_size_read(ac->ac_inode))
size = i_size_read(ac->ac_inode);

/* max available blocks in a free group */
max = EXT4_BLOCKS_PER_GROUP(ac->ac_sb) - 1 - 1 -
EXT4_SB(ac->ac_sb)->s_itb_per_group;
/* max size of free chunks */
max = 2 << bsbits;

#define NRL_CHECK_SIZE(req, size, max,bits) \
(req <= (size) || max <= ((size) >> bits))
#define NRL_CHECK_SIZE(req, size, max, chunk_size) \
(req <= (size) || max <= (chunk_size))

/* first, try to predict filesize */
/* XXX: should this table be tunable? */
Expand All @@ -2904,16 +2903,16 @@ ext4_mb_normalize_request(struct ext4_allocation_context *ac,
size = 512 * 1024;
} else if (size <= 1024 * 1024) {
size = 1024 * 1024;
} else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, bsbits)) {
} else if (NRL_CHECK_SIZE(size, 4 * 1024 * 1024, max, 2 * 1024)) {
start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
(20 - bsbits)) << 20;
size = 1024 * 1024;
} else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, bsbits)) {
(21 - bsbits)) << 21;
size = 2 * 1024 * 1024;
} else if (NRL_CHECK_SIZE(size, 8 * 1024 * 1024, max, 4 * 1024)) {
start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
(22 - bsbits)) << 22;
size = 4 * 1024 * 1024;
} else if (NRL_CHECK_SIZE(ac->ac_o_ex.fe_len,
(8<<20)>>bsbits, max, bsbits)) {
(8<<20)>>bsbits, max, 8 * 1024)) {
start_off = ((loff_t)ac->ac_o_ex.fe_logical >>
(23 - bsbits)) << 23;
size = 8 * 1024 * 1024;
Expand Down

0 comments on commit c1c1a82

Please sign in to comment.