aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h87
1 files changed, 27 insertions, 60 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 68ca1b0491af..a8ccf85b8691 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -53,6 +53,7 @@ struct inodes_stat_t {
53#define MAY_APPEND 8 53#define MAY_APPEND 8
54#define MAY_ACCESS 16 54#define MAY_ACCESS 16
55#define MAY_OPEN 32 55#define MAY_OPEN 32
56#define MAY_CHDIR 64
56 57
57/* 58/*
58 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond 59 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
@@ -90,6 +91,9 @@ struct inodes_stat_t {
90/* Expect random access pattern */ 91/* Expect random access pattern */
91#define FMODE_RANDOM ((__force fmode_t)0x1000) 92#define FMODE_RANDOM ((__force fmode_t)0x1000)
92 93
94/* File was opened by fanotify and shouldn't generate fanotify events */
95#define FMODE_NONOTIFY ((__force fmode_t)16777216) /* 0x1000000 */
96
93/* 97/*
94 * The below are the various read and write types that we support. Some of 98 * The below are the various read and write types that we support. Some of
95 * them include behavioral modifiers that send information down to the 99 * them include behavioral modifiers that send information down to the
@@ -209,6 +213,7 @@ struct inodes_stat_t {
209#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 213#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
210#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 214#define MS_I_VERSION (1<<23) /* Update inode I_version field */
211#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 215#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
216#define MS_BORN (1<<29)
212#define MS_ACTIVE (1<<30) 217#define MS_ACTIVE (1<<30)
213#define MS_NOUSER (1<<31) 218#define MS_NOUSER (1<<31)
214 219
@@ -407,15 +412,13 @@ extern int get_max_files(void);
407extern int sysctl_nr_open; 412extern int sysctl_nr_open;
408extern struct inodes_stat_t inodes_stat; 413extern struct inodes_stat_t inodes_stat;
409extern int leases_enable, lease_break_time; 414extern int leases_enable, lease_break_time;
410#ifdef CONFIG_DNOTIFY
411extern int dir_notify_enable;
412#endif
413 415
414struct buffer_head; 416struct buffer_head;
415typedef int (get_block_t)(struct inode *inode, sector_t iblock, 417typedef int (get_block_t)(struct inode *inode, sector_t iblock,
416 struct buffer_head *bh_result, int create); 418 struct buffer_head *bh_result, int create);
417typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 419typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
418 ssize_t bytes, void *private); 420 ssize_t bytes, void *private, int ret,
421 bool is_async);
419 422
420/* 423/*
421 * Attribute flags. These should be or-ed together to figure out what 424 * Attribute flags. These should be or-ed together to figure out what
@@ -685,6 +688,7 @@ struct block_device {
685 */ 688 */
686#define PAGECACHE_TAG_DIRTY 0 689#define PAGECACHE_TAG_DIRTY 0
687#define PAGECACHE_TAG_WRITEBACK 1 690#define PAGECACHE_TAG_WRITEBACK 1
691#define PAGECACHE_TAG_TOWRITE 2
688 692
689int mapping_tagged(struct address_space *mapping, int tag); 693int mapping_tagged(struct address_space *mapping, int tag);
690 694
@@ -768,12 +772,7 @@ struct inode {
768 772
769#ifdef CONFIG_FSNOTIFY 773#ifdef CONFIG_FSNOTIFY
770 __u32 i_fsnotify_mask; /* all events this inode cares about */ 774 __u32 i_fsnotify_mask; /* all events this inode cares about */
771 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 775 struct hlist_head i_fsnotify_marks;
772#endif
773
774#ifdef CONFIG_INOTIFY
775 struct list_head inotify_watches; /* watches on this inode */
776 struct mutex inotify_mutex; /* protects the watches list */
777#endif 776#endif
778 777
779 unsigned long i_state; 778 unsigned long i_state;
@@ -1561,8 +1560,8 @@ struct super_operations {
1561 1560
1562 void (*dirty_inode) (struct inode *); 1561 void (*dirty_inode) (struct inode *);
1563 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1562 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1564 void (*drop_inode) (struct inode *); 1563 int (*drop_inode) (struct inode *);
1565 void (*delete_inode) (struct inode *); 1564 void (*evict_inode) (struct inode *);
1566 void (*put_super) (struct super_block *); 1565 void (*put_super) (struct super_block *);
1567 void (*write_super) (struct super_block *); 1566 void (*write_super) (struct super_block *);
1568 int (*sync_fs)(struct super_block *sb, int wait); 1567 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1570,7 +1569,6 @@ struct super_operations {
1570 int (*unfreeze_fs) (struct super_block *); 1569 int (*unfreeze_fs) (struct super_block *);
1571 int (*statfs) (struct dentry *, struct kstatfs *); 1570 int (*statfs) (struct dentry *, struct kstatfs *);
1572 int (*remount_fs) (struct super_block *, int *, char *); 1571 int (*remount_fs) (struct super_block *, int *, char *);
1573 void (*clear_inode) (struct inode *);
1574 void (*umount_begin) (struct super_block *); 1572 void (*umount_begin) (struct super_block *);
1575 1573
1576 int (*show_options)(struct seq_file *, struct vfsmount *); 1574 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1615,8 +1613,8 @@ struct super_operations {
1615 * I_FREEING Set when inode is about to be freed but still has dirty 1613 * I_FREEING Set when inode is about to be freed but still has dirty
1616 * pages or buffers attached or the inode itself is still 1614 * pages or buffers attached or the inode itself is still
1617 * dirty. 1615 * dirty.
1618 * I_CLEAR Set by clear_inode(). In this state the inode is clean 1616 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1619 * and can be destroyed. 1617 * and can be destroyed. Inode keeps I_FREEING.
1620 * 1618 *
1621 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1619 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1622 * prohibited for many purposes. iget() must wait for 1620 * prohibited for many purposes. iget() must wait for
@@ -1813,7 +1811,8 @@ extern struct vfsmount *collect_mounts(struct path *);
1813extern void drop_collected_mounts(struct vfsmount *); 1811extern void drop_collected_mounts(struct vfsmount *);
1814extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1812extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1815 struct vfsmount *); 1813 struct vfsmount *);
1816extern int vfs_statfs(struct dentry *, struct kstatfs *); 1814extern int vfs_statfs(struct path *, struct kstatfs *);
1815extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1817extern int freeze_super(struct super_block *super); 1816extern int freeze_super(struct super_block *super);
1818extern int thaw_super(struct super_block *super); 1817extern int thaw_super(struct super_block *super);
1819 1818
@@ -2163,9 +2162,8 @@ extern void iput(struct inode *);
2163extern struct inode * igrab(struct inode *); 2162extern struct inode * igrab(struct inode *);
2164extern ino_t iunique(struct super_block *, ino_t); 2163extern ino_t iunique(struct super_block *, ino_t);
2165extern int inode_needs_sync(struct inode *inode); 2164extern int inode_needs_sync(struct inode *inode);
2166extern void generic_delete_inode(struct inode *inode); 2165extern int generic_delete_inode(struct inode *inode);
2167extern void generic_drop_inode(struct inode *inode); 2166extern int generic_drop_inode(struct inode *inode);
2168extern int generic_detach_inode(struct inode *inode);
2169 2167
2170extern struct inode *ilookup5_nowait(struct super_block *sb, 2168extern struct inode *ilookup5_nowait(struct super_block *sb,
2171 unsigned long hashval, int (*test)(struct inode *, void *), 2169 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2182,7 +2180,7 @@ extern void unlock_new_inode(struct inode *);
2182 2180
2183extern void __iget(struct inode * inode); 2181extern void __iget(struct inode * inode);
2184extern void iget_failed(struct inode *); 2182extern void iget_failed(struct inode *);
2185extern void clear_inode(struct inode *); 2183extern void end_writeback(struct inode *);
2186extern void destroy_inode(struct inode *); 2184extern void destroy_inode(struct inode *);
2187extern void __destroy_inode(struct inode *); 2185extern void __destroy_inode(struct inode *);
2188extern struct inode *new_inode(struct super_block *); 2186extern struct inode *new_inode(struct super_block *);
@@ -2268,16 +2266,6 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2268struct bio; 2266struct bio;
2269typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, 2267typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2270 loff_t file_offset); 2268 loff_t file_offset);
2271void dio_end_io(struct bio *bio, int error);
2272
2273ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2274 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2275 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2276 dio_submit_t submit_io, int lock_type);
2277ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2278 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2279 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2280 dio_submit_t submit_io, int lock_type);
2281 2269
2282enum { 2270enum {
2283 /* need locking between buffered and direct access */ 2271 /* need locking between buffered and direct access */
@@ -2287,24 +2275,13 @@ enum {
2287 DIO_SKIP_HOLES = 0x02, 2275 DIO_SKIP_HOLES = 0x02,
2288}; 2276};
2289 2277
2290static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, 2278void dio_end_io(struct bio *bio, int error);
2291 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2279
2292 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2280ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2293 dio_iodone_t end_io) 2281 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2294{ 2282 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2295 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, 2283 dio_submit_t submit_io, int flags);
2296 nr_segs, get_block, end_io, NULL,
2297 DIO_LOCKING | DIO_SKIP_HOLES);
2298}
2299 2284
2300static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2301 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2302 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2303 dio_iodone_t end_io)
2304{
2305 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2306 nr_segs, get_block, end_io, NULL, 0);
2307}
2308static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2285static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2309 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2286 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2310 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2287 loff_t offset, unsigned long nr_segs, get_block_t get_block,
@@ -2314,15 +2291,6 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2314 nr_segs, get_block, end_io, NULL, 2291 nr_segs, get_block, end_io, NULL,
2315 DIO_LOCKING | DIO_SKIP_HOLES); 2292 DIO_LOCKING | DIO_SKIP_HOLES);
2316} 2293}
2317
2318static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2319 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2320 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2321 dio_iodone_t end_io)
2322{
2323 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2324 nr_segs, get_block, end_io, NULL, 0);
2325}
2326#endif 2294#endif
2327 2295
2328extern const struct file_operations generic_ro_fops; 2296extern const struct file_operations generic_ro_fops;
@@ -2384,7 +2352,6 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2384extern int simple_unlink(struct inode *, struct dentry *); 2352extern int simple_unlink(struct inode *, struct dentry *);
2385extern int simple_rmdir(struct inode *, struct dentry *); 2353extern int simple_rmdir(struct inode *, struct dentry *);
2386extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2354extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2387extern int simple_setsize(struct inode *, loff_t);
2388extern int noop_fsync(struct file *, int); 2355extern int noop_fsync(struct file *, int);
2389extern int simple_empty(struct dentry *); 2356extern int simple_empty(struct dentry *);
2390extern int simple_readpage(struct file *file, struct page *page); 2357extern int simple_readpage(struct file *file, struct page *page);
@@ -2421,8 +2388,7 @@ extern int buffer_migrate_page(struct address_space *,
2421 2388
2422extern int inode_change_ok(const struct inode *, struct iattr *); 2389extern int inode_change_ok(const struct inode *, struct iattr *);
2423extern int inode_newsize_ok(const struct inode *, loff_t offset); 2390extern int inode_newsize_ok(const struct inode *, loff_t offset);
2424extern int __must_check inode_setattr(struct inode *, const struct iattr *); 2391extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2425extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2426 2392
2427extern void file_update_time(struct file *file); 2393extern void file_update_time(struct file *file);
2428 2394
@@ -2513,7 +2479,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2513int __init get_filesystem_list(char *buf); 2479int __init get_filesystem_list(char *buf);
2514 2480
2515#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2481#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2516#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2482#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2483 (flag & FMODE_NONOTIFY)))
2517 2484
2518#endif /* __KERNEL__ */ 2485#endif /* __KERNEL__ */
2519#endif /* _LINUX_FS_H */ 2486#endif /* _LINUX_FS_H */