@@ -157,7 +157,7 @@ enum criteria {
157
157
158
158
/*
159
159
* Reads each block group sequentially, performing disk IO if
160
- * necessary, to find find_suitable block group. Tries to
160
+ * necessary, to find suitable block group. Tries to
161
161
* allocate goal length but might trim the request if nothing
162
162
* is found after enough tries.
163
163
*/
@@ -185,14 +185,8 @@ enum criteria {
185
185
186
186
/* prefer goal again. length */
187
187
#define EXT4_MB_HINT_MERGE 0x0001
188
- /* blocks already reserved */
189
- #define EXT4_MB_HINT_RESERVED 0x0002
190
- /* metadata is being allocated */
191
- #define EXT4_MB_HINT_METADATA 0x0004
192
188
/* first blocks in the file */
193
189
#define EXT4_MB_HINT_FIRST 0x0008
194
- /* search for the best chunk */
195
- #define EXT4_MB_HINT_BEST 0x0010
196
190
/* data is being allocated */
197
191
#define EXT4_MB_HINT_DATA 0x0020
198
192
/* don't preallocate (for tails) */
@@ -213,15 +207,6 @@ enum criteria {
213
207
#define EXT4_MB_USE_RESERVED 0x2000
214
208
/* Do strict check for free blocks while retrying block allocation */
215
209
#define EXT4_MB_STRICT_CHECK 0x4000
216
- /* Large fragment size list lookup succeeded at least once for
217
- * CR_POWER2_ALIGNED */
218
- #define EXT4_MB_CR_POWER2_ALIGNED_OPTIMIZED 0x8000
219
- /* Avg fragment size rb tree lookup succeeded at least once for
220
- * CR_GOAL_LEN_FAST */
221
- #define EXT4_MB_CR_GOAL_LEN_FAST_OPTIMIZED 0x00010000
222
- /* Avg fragment size rb tree lookup succeeded at least once for
223
- * CR_BEST_AVAIL_LEN */
224
- #define EXT4_MB_CR_BEST_AVAIL_LEN_OPTIMIZED 0x00020000
225
210
226
211
struct ext4_allocation_request {
227
212
/* target inode for block we're allocating */
@@ -1608,16 +1593,14 @@ struct ext4_sb_info {
1608
1593
unsigned short * s_mb_offsets ;
1609
1594
unsigned int * s_mb_maxs ;
1610
1595
unsigned int s_group_info_size ;
1611
- unsigned int s_mb_free_pending ;
1596
+ atomic_t s_mb_free_pending ;
1612
1597
struct list_head s_freed_data_list [2 ]; /* List of blocks to be freed
1613
1598
after commit completed */
1614
1599
struct list_head s_discard_list ;
1615
1600
struct work_struct s_discard_work ;
1616
1601
atomic_t s_retry_alloc_pending ;
1617
- struct list_head * s_mb_avg_fragment_size ;
1618
- rwlock_t * s_mb_avg_fragment_size_locks ;
1619
- struct list_head * s_mb_largest_free_orders ;
1620
- rwlock_t * s_mb_largest_free_orders_locks ;
1602
+ struct xarray * s_mb_avg_fragment_size ;
1603
+ struct xarray * s_mb_largest_free_orders ;
1621
1604
1622
1605
/* tunables */
1623
1606
unsigned long s_stripe ;
@@ -1629,15 +1612,16 @@ struct ext4_sb_info {
1629
1612
unsigned int s_mb_order2_reqs ;
1630
1613
unsigned int s_mb_group_prealloc ;
1631
1614
unsigned int s_max_dir_size_kb ;
1632
- /* where last allocation was done - for stream allocation */
1633
- unsigned long s_mb_last_group ;
1634
- unsigned long s_mb_last_start ;
1635
1615
unsigned int s_mb_prefetch ;
1636
1616
unsigned int s_mb_prefetch_limit ;
1637
1617
unsigned int s_mb_best_avail_max_trim_order ;
1638
1618
unsigned int s_sb_update_sec ;
1639
1619
unsigned int s_sb_update_kb ;
1640
1620
1621
+ /* where last allocation was done - for stream allocation */
1622
+ ext4_group_t * s_mb_last_groups ;
1623
+ unsigned int s_mb_nr_global_goals ;
1624
+
1641
1625
/* stats for buddy allocator */
1642
1626
atomic_t s_bal_reqs ; /* number of reqs with len > 1 */
1643
1627
atomic_t s_bal_success ; /* we found long enough chunks */
@@ -1646,12 +1630,10 @@ struct ext4_sb_info {
1646
1630
atomic_t s_bal_cX_ex_scanned [EXT4_MB_NUM_CRS ]; /* total extents scanned */
1647
1631
atomic_t s_bal_groups_scanned ; /* number of groups scanned */
1648
1632
atomic_t s_bal_goals ; /* goal hits */
1633
+ atomic_t s_bal_stream_goals ; /* stream allocation global goal hits */
1649
1634
atomic_t s_bal_len_goals ; /* len goal hits */
1650
1635
atomic_t s_bal_breaks ; /* too long searches */
1651
1636
atomic_t s_bal_2orders ; /* 2^order hits */
1652
- atomic_t s_bal_p2_aligned_bad_suggestions ;
1653
- atomic_t s_bal_goal_fast_bad_suggestions ;
1654
- atomic_t s_bal_best_avail_bad_suggestions ;
1655
1637
atomic64_t s_bal_cX_groups_considered [EXT4_MB_NUM_CRS ];
1656
1638
atomic64_t s_bal_cX_hits [EXT4_MB_NUM_CRS ];
1657
1639
atomic64_t s_bal_cX_failed [EXT4_MB_NUM_CRS ]; /* cX loop didn't find blocks */
@@ -3020,7 +3002,7 @@ int ext4_walk_page_buffers(handle_t *handle,
3020
3002
struct buffer_head * bh ));
3021
3003
int do_journal_get_write_access (handle_t * handle , struct inode * inode ,
3022
3004
struct buffer_head * bh );
3023
- bool ext4_should_enable_large_folio (struct inode * inode );
3005
+ void ext4_set_inode_mapping_order (struct inode * inode );
3024
3006
#define FALL_BACK_TO_NONDELALLOC 1
3025
3007
#define CONVERT_INLINE_DATA 2
3026
3008
@@ -3064,9 +3046,9 @@ extern int ext4_punch_hole(struct file *file, loff_t offset, loff_t length);
3064
3046
extern void ext4_set_inode_flags (struct inode * , bool init );
3065
3047
extern int ext4_alloc_da_blocks (struct inode * inode );
3066
3048
extern void ext4_set_aops (struct inode * inode );
3067
- extern int ext4_writepage_trans_blocks (struct inode * );
3068
3049
extern int ext4_normal_submit_inode_data_buffers (struct jbd2_inode * jinode );
3069
3050
extern int ext4_chunk_trans_blocks (struct inode * , int nrblocks );
3051
+ extern int ext4_chunk_trans_extent (struct inode * inode , int nrblocks );
3070
3052
extern int ext4_meta_trans_blocks (struct inode * inode , int lblocks ,
3071
3053
int pextents );
3072
3054
extern int ext4_zero_partial_blocks (handle_t * handle , struct inode * inode ,
@@ -3489,8 +3471,6 @@ struct ext4_group_info {
3489
3471
void * bb_bitmap ;
3490
3472
#endif
3491
3473
struct rw_semaphore alloc_sem ;
3492
- struct list_head bb_avg_fragment_size_node ;
3493
- struct list_head bb_largest_free_order_node ;
3494
3474
ext4_grpblk_t bb_counters []; /* Nr of free power-of-two-block
3495
3475
* regions, index is order.
3496
3476
* bb_counters[3] = 5 means
@@ -3541,23 +3521,28 @@ static inline int ext4_fs_is_busy(struct ext4_sb_info *sbi)
3541
3521
return (atomic_read (& sbi -> s_lock_busy ) > EXT4_CONTENTION_THRESHOLD );
3542
3522
}
3543
3523
3524
+ static inline bool ext4_try_lock_group (struct super_block * sb , ext4_group_t group )
3525
+ {
3526
+ if (!spin_trylock (ext4_group_lock_ptr (sb , group )))
3527
+ return false;
3528
+ /*
3529
+ * We're able to grab the lock right away, so drop the lock
3530
+ * contention counter.
3531
+ */
3532
+ atomic_add_unless (& EXT4_SB (sb )-> s_lock_busy , -1 , 0 );
3533
+ return true;
3534
+ }
3535
+
3544
3536
static inline void ext4_lock_group (struct super_block * sb , ext4_group_t group )
3545
3537
{
3546
- spinlock_t * lock = ext4_group_lock_ptr (sb , group );
3547
- if (spin_trylock (lock ))
3548
- /*
3549
- * We're able to grab the lock right away, so drop the
3550
- * lock contention counter.
3551
- */
3552
- atomic_add_unless (& EXT4_SB (sb )-> s_lock_busy , -1 , 0 );
3553
- else {
3538
+ if (!ext4_try_lock_group (sb , group )) {
3554
3539
/*
3555
3540
* The lock is busy, so bump the contention counter,
3556
3541
* and then wait on the spin lock.
3557
3542
*/
3558
3543
atomic_add_unless (& EXT4_SB (sb )-> s_lock_busy , 1 ,
3559
3544
EXT4_MAX_CONTENTION );
3560
- spin_lock (lock );
3545
+ spin_lock (ext4_group_lock_ptr ( sb , group ) );
3561
3546
}
3562
3547
}
3563
3548
@@ -3612,6 +3597,7 @@ extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin);
3612
3597
extern int ext4_get_max_inline_size (struct inode * inode );
3613
3598
extern int ext4_find_inline_data_nolock (struct inode * inode );
3614
3599
extern int ext4_destroy_inline_data (handle_t * handle , struct inode * inode );
3600
+ extern void ext4_update_final_de (void * de_buf , int old_size , int new_size );
3615
3601
3616
3602
int ext4_readpage_inline (struct inode * inode , struct folio * folio );
3617
3603
extern int ext4_try_to_write_inline_data (struct address_space * mapping ,
@@ -3671,10 +3657,10 @@ static inline int ext4_has_inline_data(struct inode *inode)
3671
3657
extern const struct inode_operations ext4_dir_inode_operations ;
3672
3658
extern const struct inode_operations ext4_special_inode_operations ;
3673
3659
extern struct dentry * ext4_get_parent (struct dentry * child );
3674
- extern struct ext4_dir_entry_2 * ext4_init_dot_dotdot ( struct inode * inode ,
3675
- struct ext4_dir_entry_2 * de ,
3676
- int blocksize , int csum_size ,
3677
- unsigned int parent_ino , int dotdot_real_len );
3660
+ extern int ext4_init_dirblock ( handle_t * handle , struct inode * inode ,
3661
+ struct buffer_head * dir_block ,
3662
+ unsigned int parent_ino , void * inline_buf ,
3663
+ int inline_size );
3678
3664
extern void ext4_initialize_dirent_tail (struct buffer_head * bh ,
3679
3665
unsigned int blocksize );
3680
3666
extern int ext4_handle_dirty_dirblock (handle_t * handle , struct inode * inode ,
0 commit comments