diff options
Diffstat (limited to 'fs/ext4/ext4.h')
| -rw-r--r-- | fs/ext4/ext4.h | 110 |
1 files changed, 88 insertions, 22 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 889ec9d5e6ad..8b5dd6369f82 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
| @@ -168,7 +168,20 @@ struct mpage_da_data { | |||
| 168 | int pages_written; | 168 | int pages_written; |
| 169 | int retval; | 169 | int retval; |
| 170 | }; | 170 | }; |
| 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 | |||
| 172 | typedef struct ext4_io_end { | 185 | typedef struct ext4_io_end { |
| 173 | struct list_head list; /* per-file finished IO list */ | 186 | struct list_head list; /* per-file finished IO list */ |
| 174 | struct inode *inode; /* file being written to */ | 187 | struct inode *inode; /* file being written to */ |
| @@ -179,8 +192,18 @@ typedef struct ext4_io_end { | |||
| 179 | struct work_struct work; /* data work queue */ | 192 | struct work_struct work; /* data work queue */ |
| 180 | struct kiocb *iocb; /* iocb struct for AIO */ | 193 | struct kiocb *iocb; /* iocb struct for AIO */ |
| 181 | int result; /* error value for AIO */ | 194 | int result; /* error value for AIO */ |
| 195 | int num_io_pages; | ||
| 196 | struct ext4_io_page *pages[MAX_IO_PAGES]; | ||
| 182 | } ext4_io_end_t; | 197 | } ext4_io_end_t; |
| 183 | 198 | ||
| 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 | |||
| 184 | /* | 207 | /* |
| 185 | * Special inodes numbers | 208 | * Special inodes numbers |
| 186 | */ | 209 | */ |
| @@ -205,6 +228,7 @@ typedef struct ext4_io_end { | |||
| 205 | #define EXT4_MIN_BLOCK_SIZE 1024 | 228 | #define EXT4_MIN_BLOCK_SIZE 1024 |
| 206 | #define EXT4_MAX_BLOCK_SIZE 65536 | 229 | #define EXT4_MAX_BLOCK_SIZE 65536 |
| 207 | #define EXT4_MIN_BLOCK_LOG_SIZE 10 | 230 | #define EXT4_MIN_BLOCK_LOG_SIZE 10 |
| 231 | #define EXT4_MAX_BLOCK_LOG_SIZE 16 | ||
| 208 | #ifdef __KERNEL__ | 232 | #ifdef __KERNEL__ |
| 209 | # define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) | 233 | # define EXT4_BLOCK_SIZE(s) ((s)->s_blocksize) |
| 210 | #else | 234 | #else |
| @@ -889,6 +913,7 @@ struct ext4_inode_info { | |||
| 889 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ | 913 | #define EXT4_MOUNT_DATA_ERR_ABORT 0x10000000 /* Abort on file data write */ |
| 890 | #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ | 914 | #define EXT4_MOUNT_BLOCK_VALIDITY 0x20000000 /* Block validity checking */ |
| 891 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ | 915 | #define EXT4_MOUNT_DISCARD 0x40000000 /* Issue DISCARD requests */ |
| 916 | #define EXT4_MOUNT_INIT_INODE_TABLE 0x80000000 /* Initialize uninitialized itables */ | ||
| 892 | 917 | ||
| 893 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt | 918 | #define clear_opt(o, opt) o &= ~EXT4_MOUNT_##opt |
| 894 | #define set_opt(o, opt) o |= EXT4_MOUNT_##opt | 919 | #define set_opt(o, opt) o |= EXT4_MOUNT_##opt |
| @@ -1087,7 +1112,6 @@ struct ext4_sb_info { | |||
| 1087 | struct completion s_kobj_unregister; | 1112 | struct completion s_kobj_unregister; |
| 1088 | 1113 | ||
| 1089 | /* Journaling */ | 1114 | /* Journaling */ |
| 1090 | struct inode *s_journal_inode; | ||
| 1091 | struct journal_s *s_journal; | 1115 | struct journal_s *s_journal; |
| 1092 | struct list_head s_orphan; | 1116 | struct list_head s_orphan; |
| 1093 | struct mutex s_orphan_lock; | 1117 | struct mutex s_orphan_lock; |
| @@ -1120,10 +1144,7 @@ struct ext4_sb_info { | |||
| 1120 | /* for buddy allocator */ | 1144 | /* for buddy allocator */ |
| 1121 | struct ext4_group_info ***s_group_info; | 1145 | struct ext4_group_info ***s_group_info; |
| 1122 | struct inode *s_buddy_cache; | 1146 | struct inode *s_buddy_cache; |
| 1123 | long s_blocks_reserved; | ||
| 1124 | spinlock_t s_reserve_lock; | ||
| 1125 | spinlock_t s_md_lock; | 1147 | spinlock_t s_md_lock; |
| 1126 | tid_t s_last_transaction; | ||
| 1127 | unsigned short *s_mb_offsets; | 1148 | unsigned short *s_mb_offsets; |
| 1128 | unsigned int *s_mb_maxs; | 1149 | unsigned int *s_mb_maxs; |
| 1129 | 1150 | ||
| @@ -1141,7 +1162,6 @@ struct ext4_sb_info { | |||
| 1141 | unsigned long s_mb_last_start; | 1162 | unsigned long s_mb_last_start; |
| 1142 | 1163 | ||
| 1143 | /* stats for buddy allocator */ | 1164 | /* stats for buddy allocator */ |
| 1144 | spinlock_t s_mb_pa_lock; | ||
| 1145 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ | 1165 | atomic_t s_bal_reqs; /* number of reqs with len > 1 */ |
| 1146 | atomic_t s_bal_success; /* we found long enough chunks */ | 1166 | atomic_t s_bal_success; /* we found long enough chunks */ |
| 1147 | atomic_t s_bal_allocated; /* in blocks */ | 1167 | atomic_t s_bal_allocated; /* in blocks */ |
| @@ -1172,6 +1192,11 @@ struct ext4_sb_info { | |||
| 1172 | 1192 | ||
| 1173 | /* timer for periodic error stats printing */ | 1193 | /* timer for periodic error stats printing */ |
| 1174 | struct timer_list s_err_report; | 1194 | 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; | ||
| 1175 | }; | 1200 | }; |
| 1176 | 1201 | ||
| 1177 | static inline struct ext4_sb_info *EXT4_SB(struct super_block *sb) | 1202 | static 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) | |||
| 1533 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, | 1558 | void ext4_get_group_no_and_offset(struct super_block *sb, ext4_fsblk_t blocknr, |
| 1534 | ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp); | 1559 | ext4_group_t *blockgrpp, ext4_grpblk_t *offsetp); |
| 1535 | 1560 | ||
| 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 | }; | ||
| 1537 | 1597 | ||
| 1538 | /* | 1598 | /* |
| 1539 | * Function prototypes | 1599 | * Function prototypes |
| @@ -1561,7 +1621,6 @@ extern unsigned long ext4_bg_num_gdb(struct super_block *sb, | |||
| 1561 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, | 1621 | extern ext4_fsblk_t ext4_new_meta_blocks(handle_t *handle, struct inode *inode, |
| 1562 | ext4_fsblk_t goal, unsigned long *count, int *errp); | 1622 | ext4_fsblk_t goal, unsigned long *count, int *errp); |
| 1563 | extern int ext4_claim_free_blocks(struct ext4_sb_info *sbi, s64 nblocks); | 1623 | extern 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); | ||
| 1565 | extern void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, | 1624 | extern void ext4_add_groupblocks(handle_t *handle, struct super_block *sb, |
| 1566 | ext4_fsblk_t block, unsigned long count); | 1625 | ext4_fsblk_t block, unsigned long count); |
| 1567 | extern ext4_fsblk_t ext4_count_free_blocks(struct super_block *); | 1626 | extern 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); | |||
| 1605 | extern unsigned long ext4_count_free_inodes(struct super_block *); | 1664 | extern unsigned long ext4_count_free_inodes(struct super_block *); |
| 1606 | extern unsigned long ext4_count_dirs(struct super_block *); | 1665 | extern unsigned long ext4_count_dirs(struct super_block *); |
| 1607 | extern void ext4_check_inodes_bitmap(struct super_block *); | 1666 | extern void ext4_check_inodes_bitmap(struct super_block *); |
| 1608 | extern unsigned ext4_init_inode_bitmap(struct super_block *sb, | 1667 | extern void ext4_mark_bitmap_end(int start_bit, int end_bit, char *bitmap); |
| 1609 | struct buffer_head *bh, | 1668 | extern int ext4_init_inode_table(struct super_block *sb, |
| 1610 | ext4_group_t group, | 1669 | ext4_group_t group, int barrier); |
| 1611 | struct ext4_group_desc *desc); | ||
| 1612 | extern void mark_bitmap_end(int start_bit, int end_bit, char *bitmap); | ||
| 1613 | 1670 | ||
| 1614 | /* mballoc.c */ | 1671 | /* mballoc.c */ |
| 1615 | extern long ext4_mb_stats; | 1672 | extern long ext4_mb_stats; |
| @@ -1620,16 +1677,15 @@ extern ext4_fsblk_t ext4_mb_new_blocks(handle_t *, | |||
| 1620 | struct ext4_allocation_request *, int *); | 1677 | struct ext4_allocation_request *, int *); |
| 1621 | extern int ext4_mb_reserve_blocks(struct super_block *, int); | 1678 | extern int ext4_mb_reserve_blocks(struct super_block *, int); |
| 1622 | extern void ext4_discard_preallocations(struct inode *); | 1679 | extern void ext4_discard_preallocations(struct inode *); |
| 1623 | extern int __init init_ext4_mballoc(void); | 1680 | extern int __init ext4_init_mballoc(void); |
| 1624 | extern void exit_ext4_mballoc(void); | 1681 | extern void ext4_exit_mballoc(void); |
| 1625 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, | 1682 | extern void ext4_free_blocks(handle_t *handle, struct inode *inode, |
| 1626 | struct buffer_head *bh, ext4_fsblk_t block, | 1683 | struct buffer_head *bh, ext4_fsblk_t block, |
| 1627 | unsigned long count, int flags); | 1684 | unsigned long count, int flags); |
| 1628 | extern int ext4_mb_add_groupinfo(struct super_block *sb, | 1685 | extern int ext4_mb_add_groupinfo(struct super_block *sb, |
| 1629 | ext4_group_t i, struct ext4_group_desc *desc); | 1686 | ext4_group_t i, struct ext4_group_desc *desc); |
| 1630 | extern int ext4_mb_get_buddy_cache_lock(struct super_block *, ext4_group_t); | 1687 | extern int ext4_trim_fs(struct super_block *, struct fstrim_range *); |
| 1631 | extern void ext4_mb_put_buddy_cache_lock(struct super_block *, | 1688 | |
| 1632 | ext4_group_t, int); | ||
| 1633 | /* inode.c */ | 1689 | /* inode.c */ |
| 1634 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, | 1690 | struct buffer_head *ext4_getblk(handle_t *, struct inode *, |
| 1635 | ext4_lblk_t, int, int *); | 1691 | ext4_lblk_t, int, int *); |
| @@ -1657,13 +1713,11 @@ extern void ext4_get_inode_flags(struct ext4_inode_info *); | |||
| 1657 | extern int ext4_alloc_da_blocks(struct inode *inode); | 1713 | extern int ext4_alloc_da_blocks(struct inode *inode); |
| 1658 | extern void ext4_set_aops(struct inode *inode); | 1714 | extern void ext4_set_aops(struct inode *inode); |
| 1659 | extern int ext4_writepage_trans_blocks(struct inode *); | 1715 | extern int ext4_writepage_trans_blocks(struct inode *); |
| 1660 | extern int ext4_meta_trans_blocks(struct inode *, int nrblocks, int idxblocks); | ||
| 1661 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); | 1716 | extern int ext4_chunk_trans_blocks(struct inode *, int nrblocks); |
| 1662 | extern int ext4_block_truncate_page(handle_t *handle, | 1717 | extern int ext4_block_truncate_page(handle_t *handle, |
| 1663 | struct address_space *mapping, loff_t from); | 1718 | struct address_space *mapping, loff_t from); |
| 1664 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); | 1719 | extern int ext4_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf); |
| 1665 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); | 1720 | extern qsize_t *ext4_get_reserved_space(struct inode *inode); |
| 1666 | extern int flush_completed_IO(struct inode *inode); | ||
| 1667 | extern void ext4_da_update_reserve_space(struct inode *inode, | 1721 | extern void ext4_da_update_reserve_space(struct inode *inode, |
| 1668 | int used, int quota_claim); | 1722 | int used, int quota_claim); |
| 1669 | /* ioctl.c */ | 1723 | /* ioctl.c */ |
| @@ -1960,6 +2014,7 @@ extern const struct file_operations ext4_dir_operations; | |||
| 1960 | /* file.c */ | 2014 | /* file.c */ |
| 1961 | extern const struct inode_operations ext4_file_inode_operations; | 2015 | extern const struct inode_operations ext4_file_inode_operations; |
| 1962 | extern const struct file_operations ext4_file_operations; | 2016 | extern const struct file_operations ext4_file_operations; |
| 2017 | extern loff_t ext4_llseek(struct file *file, loff_t offset, int origin); | ||
| 1963 | 2018 | ||
| 1964 | /* namei.c */ | 2019 | /* namei.c */ |
| 1965 | extern const struct inode_operations ext4_dir_inode_operations; | 2020 | extern const struct inode_operations ext4_dir_inode_operations; |
| @@ -1973,8 +2028,8 @@ extern const struct inode_operations ext4_fast_symlink_inode_operations; | |||
| 1973 | /* block_validity */ | 2028 | /* block_validity */ |
| 1974 | extern void ext4_release_system_zone(struct super_block *sb); | 2029 | extern void ext4_release_system_zone(struct super_block *sb); |
| 1975 | extern int ext4_setup_system_zone(struct super_block *sb); | 2030 | extern int ext4_setup_system_zone(struct super_block *sb); |
| 1976 | extern int __init init_ext4_system_zone(void); | 2031 | extern int __init ext4_init_system_zone(void); |
| 1977 | extern void exit_ext4_system_zone(void); | 2032 | extern void ext4_exit_system_zone(void); |
| 1978 | extern int ext4_data_block_valid(struct ext4_sb_info *sbi, | 2033 | extern int ext4_data_block_valid(struct ext4_sb_info *sbi, |
| 1979 | ext4_fsblk_t start_blk, | 2034 | ext4_fsblk_t start_blk, |
| 1980 | unsigned int count); | 2035 | unsigned int count); |
| @@ -2002,6 +2057,17 @@ extern int ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
| 2002 | __u64 start_orig, __u64 start_donor, | 2057 | __u64 start_orig, __u64 start_donor, |
| 2003 | __u64 len, __u64 *moved_len); | 2058 | __u64 len, __u64 *moved_len); |
| 2004 | 2059 | ||
| 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); | ||
| 2005 | 2071 | ||
| 2006 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ | 2072 | /* BH_Uninit flag: blocks are allocated but uninitialized on disk */ |
| 2007 | enum ext4_state_bits { | 2073 | enum ext4_state_bits { |
