Skip to content

Commit 5e04966

Browse files
committed
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: "Regression and bug fixes: - Performance regression fix from 5.18 on a Rasberry Pi - Fix extent parsing bug which triggers a BUG_ON when a (corrupted) extent tree has has a non-root node when zero entries. - Fix a livelock where in the right (wrong) circumstances a large number of nfsd threads can try to write to a nearly full file system, and retry for hours(!)" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: limit the number of retries after discarding preallocations blocks ext4: fix bug in extents parsing when eh_entries == 0 and eh_depth > 0 ext4: use buckets for cr 1 block scan instead of rbtree ext4: use locality group preallocation for small closed files ext4: make directory inode spreading reflect flexbg size ext4: avoid unnecessary spreading of allocations among groups ext4: make mballoc try target group first even with mb_optimize_scan
2 parents 4207d59 + 80fa46d commit 5e04966

File tree

5 files changed

+154
-181
lines changed

5 files changed

+154
-181
lines changed

fs/ext4/ext4.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,6 @@ enum SHIFT_DIRECTION {
167167
#define EXT4_MB_CR0_OPTIMIZED 0x8000
168168
/* Avg fragment size rb tree lookup succeeded at least once for cr = 1 */
169169
#define EXT4_MB_CR1_OPTIMIZED 0x00010000
170-
/* Perform linear traversal for one group */
171-
#define EXT4_MB_SEARCH_NEXT_LINEAR 0x00020000
172170
struct ext4_allocation_request {
173171
/* target inode for block we're allocating */
174172
struct inode *inode;
@@ -1600,8 +1598,8 @@ struct ext4_sb_info {
16001598
struct list_head s_discard_list;
16011599
struct work_struct s_discard_work;
16021600
atomic_t s_retry_alloc_pending;
1603-
struct rb_root s_mb_avg_fragment_size_root;
1604-
rwlock_t s_mb_rb_lock;
1601+
struct list_head *s_mb_avg_fragment_size;
1602+
rwlock_t *s_mb_avg_fragment_size_locks;
16051603
struct list_head *s_mb_largest_free_orders;
16061604
rwlock_t *s_mb_largest_free_orders_locks;
16071605

@@ -3413,14 +3411,16 @@ struct ext4_group_info {
34133411
ext4_grpblk_t bb_first_free; /* first free block */
34143412
ext4_grpblk_t bb_free; /* total free blocks */
34153413
ext4_grpblk_t bb_fragments; /* nr of freespace fragments */
3414+
int bb_avg_fragment_size_order; /* order of average
3415+
fragment in BG */
34163416
ext4_grpblk_t bb_largest_free_order;/* order of largest frag in BG */
34173417
ext4_group_t bb_group; /* Group number */
34183418
struct list_head bb_prealloc_list;
34193419
#ifdef DOUBLE_CHECK
34203420
void *bb_bitmap;
34213421
#endif
34223422
struct rw_semaphore alloc_sem;
3423-
struct rb_node bb_avg_fragment_size_rb;
3423+
struct list_head bb_avg_fragment_size_node;
34243424
struct list_head bb_largest_free_order_node;
34253425
ext4_grpblk_t bb_counters[]; /* Nr of free power-of-two-block
34263426
* regions, index is order.

fs/ext4/extents.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,10 @@ static int __ext4_ext_check(const char *function, unsigned int line,
460460
error_msg = "invalid eh_entries";
461461
goto corrupted;
462462
}
463+
if (unlikely((eh->eh_entries == 0) && (depth > 0))) {
464+
error_msg = "eh_entries is 0 but eh_depth is > 0";
465+
goto corrupted;
466+
}
463467
if (!ext4_valid_extent_entries(inode, eh, lblk, &pblk, depth)) {
464468
error_msg = "invalid extent entries";
465469
goto corrupted;

fs/ext4/ialloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
510510
goto fallback;
511511
}
512512

513-
max_dirs = ndirs / ngroups + inodes_per_group / 16;
513+
max_dirs = ndirs / ngroups + inodes_per_group*flex_size / 16;
514514
min_inodes = avefreei - inodes_per_group*flex_size / 4;
515515
if (min_inodes < 1)
516516
min_inodes = 1;

0 commit comments

Comments
 (0)