diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 98205f680476..16421f662a7a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -697,20 +697,26 @@ struct fown_struct { | |||
697 | * Track a single file's readahead state | 697 | * Track a single file's readahead state |
698 | */ | 698 | */ |
699 | struct file_ra_state { | 699 | struct file_ra_state { |
700 | unsigned long start; /* Current window */ | 700 | pgoff_t start; /* where readahead started */ |
701 | unsigned long size; | 701 | unsigned long size; /* # of readahead pages */ |
702 | unsigned long flags; /* ra flags RA_FLAG_xxx*/ | 702 | unsigned long async_size; /* do asynchronous readahead when |
703 | unsigned long cache_hit; /* cache hit count*/ | 703 | there are only # of pages ahead */ |
704 | unsigned long prev_index; /* Cache last read() position */ | 704 | |
705 | unsigned long ahead_start; /* Ahead window */ | ||
706 | unsigned long ahead_size; | ||
707 | unsigned long ra_pages; /* Maximum readahead window */ | 705 | unsigned long ra_pages; /* Maximum readahead window */ |
708 | unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ | 706 | unsigned long mmap_hit; /* Cache hit stat for mmap accesses */ |
709 | unsigned long mmap_miss; /* Cache miss stat for mmap accesses */ | 707 | unsigned long mmap_miss; /* Cache miss stat for mmap accesses */ |
708 | unsigned long prev_index; /* Cache last read() position */ | ||
710 | unsigned int prev_offset; /* Offset where last read() ended in a page */ | 709 | unsigned int prev_offset; /* Offset where last read() ended in a page */ |
711 | }; | 710 | }; |
712 | #define RA_FLAG_MISS 0x01 /* a cache miss occured against this file */ | 711 | |
713 | #define RA_FLAG_INCACHE 0x02 /* file is already in cache */ | 712 | /* |
713 | * Check if @index falls in the readahead windows. | ||
714 | */ | ||
715 | static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) | ||
716 | { | ||
717 | return (index >= ra->start && | ||
718 | index < ra->start + ra->size); | ||
719 | } | ||
714 | 720 | ||
715 | struct file { | 721 | struct file { |
716 | /* | 722 | /* |
@@ -862,7 +868,7 @@ extern void locks_init_lock(struct file_lock *); | |||
862 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); | 868 | extern void locks_copy_lock(struct file_lock *, struct file_lock *); |
863 | extern void locks_remove_posix(struct file *, fl_owner_t); | 869 | extern void locks_remove_posix(struct file *, fl_owner_t); |
864 | extern void locks_remove_flock(struct file *); | 870 | extern void locks_remove_flock(struct file *); |
865 | extern int posix_test_lock(struct file *, struct file_lock *); | 871 | extern void posix_test_lock(struct file *, struct file_lock *); |
866 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); | 872 | extern int posix_lock_file(struct file *, struct file_lock *, struct file_lock *); |
867 | extern int posix_lock_file_wait(struct file *, struct file_lock *); | 873 | extern int posix_lock_file_wait(struct file *, struct file_lock *); |
868 | extern int posix_unblock_lock(struct file *, struct file_lock *); | 874 | extern int posix_unblock_lock(struct file *, struct file_lock *); |
@@ -872,7 +878,8 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl); | |||
872 | extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); | 878 | extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl); |
873 | extern int __break_lease(struct inode *inode, unsigned int flags); | 879 | extern int __break_lease(struct inode *inode, unsigned int flags); |
874 | extern void lease_get_mtime(struct inode *, struct timespec *time); | 880 | extern void lease_get_mtime(struct inode *, struct timespec *time); |
875 | extern int setlease(struct file *, long, struct file_lock **); | 881 | extern int generic_setlease(struct file *, long, struct file_lock **); |
882 | extern int vfs_setlease(struct file *, long, struct file_lock **); | ||
876 | extern int lease_modify(struct file_lock **, int); | 883 | extern int lease_modify(struct file_lock **, int); |
877 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); | 884 | extern int lock_may_read(struct inode *, loff_t start, unsigned long count); |
878 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); | 885 | extern int lock_may_write(struct inode *, loff_t start, unsigned long count); |
@@ -1122,6 +1129,7 @@ struct file_operations { | |||
1122 | int (*flock) (struct file *, int, struct file_lock *); | 1129 | int (*flock) (struct file *, int, struct file_lock *); |
1123 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); | 1130 | ssize_t (*splice_write)(struct pipe_inode_info *, struct file *, loff_t *, size_t, unsigned int); |
1124 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); | 1131 | ssize_t (*splice_read)(struct file *, loff_t *, struct pipe_inode_info *, size_t, unsigned int); |
1132 | int (*setlease)(struct file *, long, struct file_lock **); | ||
1125 | }; | 1133 | }; |
1126 | 1134 | ||
1127 | struct inode_operations { | 1135 | struct inode_operations { |
@@ -1147,6 +1155,8 @@ struct inode_operations { | |||
1147 | ssize_t (*listxattr) (struct dentry *, char *, size_t); | 1155 | ssize_t (*listxattr) (struct dentry *, char *, size_t); |
1148 | int (*removexattr) (struct dentry *, const char *); | 1156 | int (*removexattr) (struct dentry *, const char *); |
1149 | void (*truncate_range)(struct inode *, loff_t, loff_t); | 1157 | void (*truncate_range)(struct inode *, loff_t, loff_t); |
1158 | long (*fallocate)(struct inode *inode, int mode, loff_t offset, | ||
1159 | loff_t len); | ||
1150 | }; | 1160 | }; |
1151 | 1161 | ||
1152 | struct seq_file; | 1162 | struct seq_file; |
@@ -1459,7 +1469,7 @@ extern int alloc_chrdev_region(dev_t *, unsigned, unsigned, const char *); | |||
1459 | extern int register_chrdev_region(dev_t, unsigned, const char *); | 1469 | extern int register_chrdev_region(dev_t, unsigned, const char *); |
1460 | extern int register_chrdev(unsigned int, const char *, | 1470 | extern int register_chrdev(unsigned int, const char *, |
1461 | const struct file_operations *); | 1471 | const struct file_operations *); |
1462 | extern int unregister_chrdev(unsigned int, const char *); | 1472 | extern void unregister_chrdev(unsigned int, const char *); |
1463 | extern void unregister_chrdev_region(dev_t, unsigned); | 1473 | extern void unregister_chrdev_region(dev_t, unsigned); |
1464 | extern int chrdev_open(struct inode *, struct file *); | 1474 | extern int chrdev_open(struct inode *, struct file *); |
1465 | extern void chrdev_show(struct seq_file *,off_t); | 1475 | extern void chrdev_show(struct seq_file *,off_t); |
@@ -1649,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int); | |||
1649 | extern int generic_file_mmap(struct file *, struct vm_area_struct *); | 1659 | extern int generic_file_mmap(struct file *, struct vm_area_struct *); |
1650 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); | 1660 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); |
1651 | extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); | 1661 | extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); |
1652 | extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size); | ||
1653 | int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); | 1662 | int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk); |
1654 | extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); | 1663 | extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t); |
1655 | extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); | 1664 | extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t); |