diff options
Diffstat (limited to 'fs/ext3/ialloc.c')
-rw-r--r-- | fs/ext3/ialloc.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c index 36546ed36a14..e45dbd651736 100644 --- a/fs/ext3/ialloc.c +++ b/fs/ext3/ialloc.c | |||
@@ -202,7 +202,7 @@ error_return: | |||
202 | static int find_group_dir(struct super_block *sb, struct inode *parent) | 202 | static int find_group_dir(struct super_block *sb, struct inode *parent) |
203 | { | 203 | { |
204 | int ngroups = EXT3_SB(sb)->s_groups_count; | 204 | int ngroups = EXT3_SB(sb)->s_groups_count; |
205 | int freei, avefreei; | 205 | unsigned int freei, avefreei; |
206 | struct ext3_group_desc *desc, *best_desc = NULL; | 206 | struct ext3_group_desc *desc, *best_desc = NULL; |
207 | struct buffer_head *bh; | 207 | struct buffer_head *bh; |
208 | int group, best_group = -1; | 208 | int group, best_group = -1; |
@@ -216,7 +216,7 @@ static int find_group_dir(struct super_block *sb, struct inode *parent) | |||
216 | continue; | 216 | continue; |
217 | if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) | 217 | if (le16_to_cpu(desc->bg_free_inodes_count) < avefreei) |
218 | continue; | 218 | continue; |
219 | if (!best_desc || | 219 | if (!best_desc || |
220 | (le16_to_cpu(desc->bg_free_blocks_count) > | 220 | (le16_to_cpu(desc->bg_free_blocks_count) > |
221 | le16_to_cpu(best_desc->bg_free_blocks_count))) { | 221 | le16_to_cpu(best_desc->bg_free_blocks_count))) { |
222 | best_group = group; | 222 | best_group = group; |
@@ -226,30 +226,30 @@ static int find_group_dir(struct super_block *sb, struct inode *parent) | |||
226 | return best_group; | 226 | return best_group; |
227 | } | 227 | } |
228 | 228 | ||
229 | /* | 229 | /* |
230 | * Orlov's allocator for directories. | 230 | * Orlov's allocator for directories. |
231 | * | 231 | * |
232 | * We always try to spread first-level directories. | 232 | * We always try to spread first-level directories. |
233 | * | 233 | * |
234 | * If there are blockgroups with both free inodes and free blocks counts | 234 | * If there are blockgroups with both free inodes and free blocks counts |
235 | * not worse than average we return one with smallest directory count. | 235 | * not worse than average we return one with smallest directory count. |
236 | * Otherwise we simply return a random group. | 236 | * Otherwise we simply return a random group. |
237 | * | 237 | * |
238 | * For the rest rules look so: | 238 | * For the rest rules look so: |
239 | * | 239 | * |
240 | * It's OK to put directory into a group unless | 240 | * It's OK to put directory into a group unless |
241 | * it has too many directories already (max_dirs) or | 241 | * it has too many directories already (max_dirs) or |
242 | * it has too few free inodes left (min_inodes) or | 242 | * it has too few free inodes left (min_inodes) or |
243 | * it has too few free blocks left (min_blocks) or | 243 | * it has too few free blocks left (min_blocks) or |
244 | * it's already running too large debt (max_debt). | 244 | * it's already running too large debt (max_debt). |
245 | * Parent's group is prefered, if it doesn't satisfy these | 245 | * Parent's group is prefered, if it doesn't satisfy these |
246 | * conditions we search cyclically through the rest. If none | 246 | * conditions we search cyclically through the rest. If none |
247 | * of the groups look good we just look for a group with more | 247 | * of the groups look good we just look for a group with more |
248 | * free inodes than average (starting at parent's group). | 248 | * free inodes than average (starting at parent's group). |
249 | * | 249 | * |
250 | * Debt is incremented each time we allocate a directory and decremented | 250 | * Debt is incremented each time we allocate a directory and decremented |
251 | * when we allocate an inode, within 0--255. | 251 | * when we allocate an inode, within 0--255. |
252 | */ | 252 | */ |
253 | 253 | ||
254 | #define INODE_COST 64 | 254 | #define INODE_COST 64 |
255 | #define BLOCK_COST 256 | 255 | #define BLOCK_COST 256 |
@@ -261,10 +261,10 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent) | |||
261 | struct ext3_super_block *es = sbi->s_es; | 261 | struct ext3_super_block *es = sbi->s_es; |
262 | int ngroups = sbi->s_groups_count; | 262 | int ngroups = sbi->s_groups_count; |
263 | int inodes_per_group = EXT3_INODES_PER_GROUP(sb); | 263 | int inodes_per_group = EXT3_INODES_PER_GROUP(sb); |
264 | int freei, avefreei; | 264 | unsigned int freei, avefreei; |
265 | ext3_fsblk_t freeb, avefreeb; | 265 | ext3_fsblk_t freeb, avefreeb; |
266 | ext3_fsblk_t blocks_per_dir; | 266 | ext3_fsblk_t blocks_per_dir; |
267 | int ndirs; | 267 | unsigned int ndirs; |
268 | int max_debt, max_dirs, min_inodes; | 268 | int max_debt, max_dirs, min_inodes; |
269 | ext3_grpblk_t min_blocks; | 269 | ext3_grpblk_t min_blocks; |
270 | int group = -1, i; | 270 | int group = -1, i; |
@@ -454,7 +454,7 @@ struct inode *ext3_new_inode(handle_t *handle, struct inode * dir, int mode) | |||
454 | group = find_group_dir(sb, dir); | 454 | group = find_group_dir(sb, dir); |
455 | else | 455 | else |
456 | group = find_group_orlov(sb, dir); | 456 | group = find_group_orlov(sb, dir); |
457 | } else | 457 | } else |
458 | group = find_group_other(sb, dir); | 458 | group = find_group_other(sb, dir); |
459 | 459 | ||
460 | err = -ENOSPC; | 460 | err = -ENOSPC; |
@@ -559,7 +559,6 @@ got: | |||
559 | 559 | ||
560 | inode->i_ino = ino; | 560 | inode->i_ino = ino; |
561 | /* This is the optimal IO size (for stat), not the fs block size */ | 561 | /* This is the optimal IO size (for stat), not the fs block size */ |
562 | inode->i_blksize = PAGE_SIZE; | ||
563 | inode->i_blocks = 0; | 562 | inode->i_blocks = 0; |
564 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; | 563 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME_SEC; |
565 | 564 | ||