@@ -168,7 +168,20 @@ struct mpage_da_data {
168168 int pages_written ;
169169 int retval ;
170170};
171- #define EXT4_IO_UNWRITTEN 0x1
171+
172+ /*
173+ * Flags for ext4_io_end->flags
174+ */
175+ #define EXT4_IO_END_UNWRITTEN 0x0001
176+ #define EXT4_IO_END_ERROR 0x0002
177+
178+ struct ext4_io_page {
179+ struct page * p_page ;
180+ int p_count ;
181+ };
182+
183+ #define MAX_IO_PAGES 128
184+
172185typedef struct ext4_io_end {
173186 struct list_head list ; /* per-file finished IO list */
174187 struct inode * inode ; /* file being written to */
@@ -179,8 +192,18 @@ typedef struct ext4_io_end {
179192 struct work_struct work ; /* data work queue */
180193 struct kiocb * iocb ; /* iocb struct for AIO */
181194 int result ; /* error value for AIO */
195+ int num_io_pages ;
196+ struct ext4_io_page * pages [MAX_IO_PAGES ];
182197} ext4_io_end_t ;
183198
199+ struct ext4_io_submit {
200+ int io_op ;
201+ struct bio * io_bio ;
202+ ext4_io_end_t * io_end ;
203+ struct ext4_io_page * io_page ;
204+ sector_t io_next_block ;
205+ };
206+
184207/*
185208 * Special inodes numbers
186209 */
@@ -205,6 +228,7 @@ typedef struct ext4_io_end {
205228#define EXT4_MIN_BLOCK_SIZE 1024
206229#define EXT4_MAX_BLOCK_SIZE 65536
207230#define EXT4_MIN_BLOCK_LOG_SIZE 10
231+ #define EXT4_MAX_BLOCK_LOG_SIZE 16
208232#ifdef __KERNEL__
209233# define EXT4_BLOCK_SIZE (s ) ((s)->s_blocksize)
210234#else
@@ -889,6 +913,7 @@ struct ext4_inode_info {
889913#define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */
890914#define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */
891915#define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */
916+ #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */
892917
893918#define clear_opt (o , opt ) o &= ~EXT4_MOUNT_##opt
894919#define set_opt (o , opt ) o |= EXT4_MOUNT_##opt
@@ -1087,7 +1112,6 @@ struct ext4_sb_info {
10871112 struct completion s_kobj_unregister ;
10881113
10891114 /* Journaling */
1090- struct inode * s_journal_inode ;
10911115 struct journal_s * s_journal ;
10921116 struct list_head s_orphan ;
10931117 struct mutex s_orphan_lock ;
@@ -1120,10 +1144,7 @@ struct ext4_sb_info {
11201144 /* for buddy allocator */
11211145 struct ext4_group_info * * * s_group_info ;
11221146 struct inode * s_buddy_cache ;
1123- long s_blocks_reserved ;
1124- spinlock_t s_reserve_lock ;
11251147 spinlock_t s_md_lock ;
1126- tid_t s_last_transaction ;
11271148 unsigned short * s_mb_offsets ;
11281149 unsigned int * s_mb_maxs ;
11291150
@@ -1141,7 +1162,6 @@ struct ext4_sb_info {
11411162 unsigned long s_mb_last_start ;
11421163
11431164 /* stats for buddy allocator */
1144- spinlock_t s_mb_pa_lock ;
11451165 atomic_t s_bal_reqs ; /* number of reqs with len > 1 */
11461166 atomic_t s_bal_success ; /* we found long enough chunks */
11471167 atomic_t s_bal_allocated ; /* in blocks */
@@ -1172,6 +1192,11 @@ struct ext4_sb_info {
11721192
11731193 /* timer for periodic error stats printing */
11741194 struct timer_list s_err_report ;
1195+
1196+ /* Lazy inode table initialization info */
1197+ struct ext4_li_request * s_li_request ;
1198+ /* Wait multiplier for lazy initialization thread */
1199+ unsigned int s_li_wait_mult ;
11751200};
11761201
11771202static inline struct ext4_sb_info * EXT4_SB (struct super_block * sb )
@@ -1533,7 +1558,42 @@ ext4_group_first_block_no(struct super_block *sb, ext4_group_t group_no)
15331558void ext4_get_group_no_and_offset (struct super_block * sb , ext4_fsblk_t blocknr ,
15341559 ext4_group_t * blockgrpp , ext4_grpblk_t * offsetp );
15351560
1536- extern struct proc_dir_entry * ext4_proc_root ;
1561+ /*
1562+ * Timeout and state flag for lazy initialization inode thread.
1563+ */
1564+ #define EXT4_DEF_LI_WAIT_MULT 10
1565+ #define EXT4_DEF_LI_MAX_START_DELAY 5
1566+ #define EXT4_LAZYINIT_QUIT 0x0001
1567+ #define EXT4_LAZYINIT_RUNNING 0x0002
1568+
1569+ /*
1570+ * Lazy inode table initialization info
1571+ */
1572+ struct ext4_lazy_init {
1573+ unsigned long li_state ;
1574+
1575+ wait_queue_head_t li_wait_daemon ;
1576+ wait_queue_head_t li_wait_task ;
1577+ struct timer_list li_timer ;
1578+ struct task_struct * li_task ;
1579+
1580+ struct list_head li_request_list ;
1581+ struct mutex li_list_mtx ;
1582+ };
1583+
1584+ struct ext4_li_request {
1585+ struct super_block * lr_super ;
1586+ struct ext4_sb_info * lr_sbi ;
1587+ ext4_group_t lr_next_group ;
1588+ struct list_head lr_request ;
1589+ unsigned long lr_next_sched ;
1590+ unsigned long lr_timeout ;
1591+ };
1592+
1593+ struct ext4_features {
1594+ struct kobject f_kobj ;
1595+ struct completion f_kobj_unregister ;
1596+ };
15371597
15381598/*
15391599 * Function prototypes
@@ -1561,7 +1621,6 @@ extern unsigned long ext4_bg_num_gdb(struct super_block *sb,
15611621extern ext4_fsblk_t ext4_new_meta_blocks (handle_t * handle , struct inode * inode ,
15621622 ext4_fsblk_t goal , unsigned long * count , int * errp );
15631623extern int ext4_claim_free_blocks (struct ext4_sb_info * sbi , s64 nblocks );
1564- extern int ext4_has_free_blocks (struct ext4_sb_info * sbi , s64 nblocks );
15651624extern void ext4_add_groupblocks (handle_t * handle , struct super_block * sb ,
15661625 ext4_fsblk_t block , unsigned long count );
15671626extern ext4_fsblk_t ext4_count_free_blocks (struct super_block * );
@@ -1605,11 +1664,9 @@ extern struct inode * ext4_orphan_get(struct super_block *, unsigned long);
16051664extern unsigned long ext4_count_free_inodes (struct super_block * );
16061665extern unsigned long ext4_count_dirs (struct super_block * );
16071666extern void ext4_check_inodes_bitmap (struct super_block * );
1608- extern unsigned ext4_init_inode_bitmap (struct super_block * sb ,
1609- struct buffer_head * bh ,
1610- ext4_group_t group ,
1611- struct ext4_group_desc * desc );
1612- extern void mark_bitmap_end (int start_bit , int end_bit , char * bitmap );
1667+ extern void ext4_mark_bitmap_end (int start_bit , int end_bit , char * bitmap );
1668+ extern int ext4_init_inode_table (struct super_block * sb ,
1669+ ext4_group_t group , int barrier );
16131670
16141671/* mballoc.c */
16151672extern long ext4_mb_stats ;
@@ -1620,16 +1677,15 @@ extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *,
16201677 struct ext4_allocation_request * , int * );
16211678extern int ext4_mb_reserve_blocks (struct super_block * , int );
16221679extern void ext4_discard_preallocations (struct inode * );
1623- extern int __init init_ext4_mballoc (void );
1624- extern void exit_ext4_mballoc (void );
1680+ extern int __init ext4_init_mballoc (void );
1681+ extern void ext4_exit_mballoc (void );
16251682extern void ext4_free_blocks (handle_t * handle , struct inode * inode ,
16261683 struct buffer_head * bh , ext4_fsblk_t block ,
16271684 unsigned long count , int flags );
16281685extern int ext4_mb_add_groupinfo (struct super_block * sb ,
16291686 ext4_group_t i , struct ext4_group_desc * desc );
1630- extern int ext4_mb_get_buddy_cache_lock (struct super_block * , ext4_group_t );
1631- extern void ext4_mb_put_buddy_cache_lock (struct super_block * ,
1632- ext4_group_t , int );
1687+ extern int ext4_trim_fs (struct super_block * , struct fstrim_range * );
1688+
16331689/* inode.c */
16341690struct buffer_head * ext4_getblk (handle_t * , struct inode * ,
16351691 ext4_lblk_t , int , int * );
@@ -1657,13 +1713,11 @@ extern void ext4_get_inode_flags(struct ext4_inode_info *);
16571713extern int ext4_alloc_da_blocks (struct inode * inode );
16581714extern void ext4_set_aops (struct inode * inode );
16591715extern int ext4_writepage_trans_blocks (struct inode * );
1660- extern int ext4_meta_trans_blocks (struct inode * , int nrblocks , int idxblocks );
16611716extern int ext4_chunk_trans_blocks (struct inode * , int nrblocks );
16621717extern int ext4_block_truncate_page (handle_t * handle ,
16631718 struct address_space * mapping , loff_t from );
16641719extern int ext4_page_mkwrite (struct vm_area_struct * vma , struct vm_fault * vmf );
16651720extern qsize_t * ext4_get_reserved_space (struct inode * inode );
1666- extern int flush_completed_IO (struct inode * inode );
16671721extern void ext4_da_update_reserve_space (struct inode * inode ,
16681722 int used , int quota_claim );
16691723/* ioctl.c */
@@ -1960,6 +2014,7 @@ extern const struct file_operations ext4_dir_operations;
19602014/* file.c */
19612015extern const struct inode_operations ext4_file_inode_operations ;
19622016extern const struct file_operations ext4_file_operations ;
2017+ extern loff_t ext4_llseek (struct file * file , loff_t offset , int origin );
19632018
19642019/* namei.c */
19652020extern const struct inode_operations ext4_dir_inode_operations ;
@@ -1973,8 +2028,8 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations;
19732028/* block_validity */
19742029extern void ext4_release_system_zone (struct super_block * sb );
19752030extern int ext4_setup_system_zone (struct super_block * sb );
1976- extern int __init init_ext4_system_zone (void );
1977- extern void exit_ext4_system_zone (void );
2031+ extern int __init ext4_init_system_zone (void );
2032+ extern void ext4_exit_system_zone (void );
19782033extern int ext4_data_block_valid (struct ext4_sb_info * sbi ,
19792034 ext4_fsblk_t start_blk ,
19802035 unsigned int count );
@@ -2002,6 +2057,17 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp,
20022057 __u64 start_orig , __u64 start_donor ,
20032058 __u64 len , __u64 * moved_len );
20042059
2060+ /* page-io.c */
2061+ extern int __init ext4_init_pageio (void );
2062+ extern void ext4_exit_pageio (void );
2063+ extern void ext4_free_io_end (ext4_io_end_t * io );
2064+ extern ext4_io_end_t * ext4_init_io_end (struct inode * inode , gfp_t flags );
2065+ extern int ext4_end_io_nolock (ext4_io_end_t * io );
2066+ extern void ext4_io_submit (struct ext4_io_submit * io );
2067+ extern int ext4_bio_write_page (struct ext4_io_submit * io ,
2068+ struct page * page ,
2069+ int len ,
2070+ struct writeback_control * wbc );
20052071
20062072/* BH_Uninit flag: blocks are allocated but uninitialized on disk */
20072073enum ext4_state_bits {
0 commit comments