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.h127
1 files changed, 46 insertions, 81 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 488efec09d14..1542e0e52b2e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -8,6 +8,7 @@
8 8
9#include <linux/limits.h> 9#include <linux/limits.h>
10#include <linux/ioctl.h> 10#include <linux/ioctl.h>
11#include <linux/blk_types.h>
11 12
12/* 13/*
13 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change 14 * It's silly to have NR_OPEN bigger than NR_FILE, but you can change
@@ -91,6 +92,9 @@ struct inodes_stat_t {
91/* Expect random access pattern */ 92/* Expect random access pattern */
92#define FMODE_RANDOM ((__force fmode_t)0x1000) 93#define FMODE_RANDOM ((__force fmode_t)0x1000)
93 94
95/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)16777216) /* 0x1000000 */
97
94/* 98/*
95 * The below are the various read and write types that we support. Some of 99 * The below are the various read and write types that we support. Some of
96 * them include behavioral modifiers that send information down to the 100 * them include behavioral modifiers that send information down to the
@@ -118,7 +122,7 @@ struct inodes_stat_t {
118 * immediately wait on this read without caring about 122 * immediately wait on this read without caring about
119 * unplugging. 123 * unplugging.
120 * READA Used for read-ahead operations. Lower priority, and the 124 * READA Used for read-ahead operations. Lower priority, and the
121 * block layer could (in theory) choose to ignore this 125 * block layer could (in theory) choose to ignore this
122 * request if it runs into resource problems. 126 * request if it runs into resource problems.
123 * WRITE A normal async write. Device will be plugged. 127 * WRITE A normal async write. Device will be plugged.
124 * SWRITE Like WRITE, but a special case for ll_rw_block() that 128 * SWRITE Like WRITE, but a special case for ll_rw_block() that
@@ -137,7 +141,7 @@ struct inodes_stat_t {
137 * SWRITE_SYNC 141 * SWRITE_SYNC
138 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. 142 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
139 * See SWRITE. 143 * See SWRITE.
140 * WRITE_BARRIER Like WRITE, but tells the block layer that all 144 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
141 * previously submitted writes must be safely on storage 145 * previously submitted writes must be safely on storage
142 * before this one is started. Also guarantees that when 146 * before this one is started. Also guarantees that when
143 * this write is complete, it itself is also safely on 147 * this write is complete, it itself is also safely on
@@ -145,29 +149,31 @@ struct inodes_stat_t {
145 * of this IO. 149 * of this IO.
146 * 150 *
147 */ 151 */
148#define RW_MASK 1 152#define RW_MASK REQ_WRITE
149#define RWA_MASK 2 153#define RWA_MASK REQ_RAHEAD
150#define READ 0 154
151#define WRITE 1 155#define READ 0
152#define READA 2 /* read-ahead - don't block if no resources */ 156#define WRITE RW_MASK
153#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 157#define READA RWA_MASK
154#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 158#define SWRITE (WRITE | READA)
155#define READ_META (READ | (1 << BIO_RW_META)) 159
156#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 160#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)
157#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 161#define READ_META (READ | REQ_META)
158#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) 162#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE)
159#define WRITE_META (WRITE | (1 << BIO_RW_META)) 163#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
160#define SWRITE_SYNC_PLUG \ 164#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
161 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 165#define WRITE_META (WRITE | REQ_META)
162#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 166#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
163#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 167 REQ_HARDBARRIER)
168#define SWRITE_SYNC_PLUG (SWRITE | REQ_SYNC | REQ_NOIDLE)
169#define SWRITE_SYNC (SWRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
164 170
165/* 171/*
166 * These aren't really reads or writes, they pass down information about 172 * These aren't really reads or writes, they pass down information about
167 * parts of device that are now unused by the file system. 173 * parts of device that are now unused by the file system.
168 */ 174 */
169#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) 175#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
170#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) 176#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
171 177
172#define SEL_IN 1 178#define SEL_IN 1
173#define SEL_OUT 2 179#define SEL_OUT 2
@@ -210,6 +216,7 @@ struct inodes_stat_t {
210#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 216#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
211#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 217#define MS_I_VERSION (1<<23) /* Update inode I_version field */
212#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 218#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
219#define MS_BORN (1<<29)
213#define MS_ACTIVE (1<<30) 220#define MS_ACTIVE (1<<30)
214#define MS_NOUSER (1<<31) 221#define MS_NOUSER (1<<31)
215 222
@@ -408,9 +415,6 @@ extern int get_max_files(void);
408extern int sysctl_nr_open; 415extern int sysctl_nr_open;
409extern struct inodes_stat_t inodes_stat; 416extern struct inodes_stat_t inodes_stat;
410extern int leases_enable, lease_break_time; 417extern int leases_enable, lease_break_time;
411#ifdef CONFIG_DNOTIFY
412extern int dir_notify_enable;
413#endif
414 418
415struct buffer_head; 419struct buffer_head;
416typedef int (get_block_t)(struct inode *inode, sector_t iblock, 420typedef int (get_block_t)(struct inode *inode, sector_t iblock,
@@ -771,12 +775,7 @@ struct inode {
771 775
772#ifdef CONFIG_FSNOTIFY 776#ifdef CONFIG_FSNOTIFY
773 __u32 i_fsnotify_mask; /* all events this inode cares about */ 777 __u32 i_fsnotify_mask; /* all events this inode cares about */
774 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 778 struct hlist_head i_fsnotify_marks;
775#endif
776
777#ifdef CONFIG_INOTIFY
778 struct list_head inotify_watches; /* watches on this inode */
779 struct mutex inotify_mutex; /* protects the watches list */
780#endif 779#endif
781 780
782 unsigned long i_state; 781 unsigned long i_state;
@@ -1564,8 +1563,8 @@ struct super_operations {
1564 1563
1565 void (*dirty_inode) (struct inode *); 1564 void (*dirty_inode) (struct inode *);
1566 int (*write_inode) (struct inode *, struct writeback_control *wbc); 1565 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1567 void (*drop_inode) (struct inode *); 1566 int (*drop_inode) (struct inode *);
1568 void (*delete_inode) (struct inode *); 1567 void (*evict_inode) (struct inode *);
1569 void (*put_super) (struct super_block *); 1568 void (*put_super) (struct super_block *);
1570 void (*write_super) (struct super_block *); 1569 void (*write_super) (struct super_block *);
1571 int (*sync_fs)(struct super_block *sb, int wait); 1570 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1573,7 +1572,6 @@ struct super_operations {
1573 int (*unfreeze_fs) (struct super_block *); 1572 int (*unfreeze_fs) (struct super_block *);
1574 int (*statfs) (struct dentry *, struct kstatfs *); 1573 int (*statfs) (struct dentry *, struct kstatfs *);
1575 int (*remount_fs) (struct super_block *, int *, char *); 1574 int (*remount_fs) (struct super_block *, int *, char *);
1576 void (*clear_inode) (struct inode *);
1577 void (*umount_begin) (struct super_block *); 1575 void (*umount_begin) (struct super_block *);
1578 1576
1579 int (*show_options)(struct seq_file *, struct vfsmount *); 1577 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1618,8 +1616,8 @@ struct super_operations {
1618 * I_FREEING Set when inode is about to be freed but still has dirty 1616 * I_FREEING Set when inode is about to be freed but still has dirty
1619 * pages or buffers attached or the inode itself is still 1617 * pages or buffers attached or the inode itself is still
1620 * dirty. 1618 * dirty.
1621 * I_CLEAR Set by clear_inode(). In this state the inode is clean 1619 * I_CLEAR Added by end_writeback(). In this state the inode is clean
1622 * and can be destroyed. 1620 * and can be destroyed. Inode keeps I_FREEING.
1623 * 1621 *
1624 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are 1622 * Inodes that are I_WILL_FREE, I_FREEING or I_CLEAR are
1625 * prohibited for many purposes. iget() must wait for 1623 * prohibited for many purposes. iget() must wait for
@@ -1816,7 +1814,8 @@ extern struct vfsmount *collect_mounts(struct path *);
1816extern void drop_collected_mounts(struct vfsmount *); 1814extern void drop_collected_mounts(struct vfsmount *);
1817extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, 1815extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1818 struct vfsmount *); 1816 struct vfsmount *);
1819extern int vfs_statfs(struct dentry *, struct kstatfs *); 1817extern int vfs_statfs(struct path *, struct kstatfs *);
1818extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1820extern int freeze_super(struct super_block *super); 1819extern int freeze_super(struct super_block *super);
1821extern int thaw_super(struct super_block *super); 1820extern int thaw_super(struct super_block *super);
1822 1821
@@ -2166,9 +2165,8 @@ extern void iput(struct inode *);
2166extern struct inode * igrab(struct inode *); 2165extern struct inode * igrab(struct inode *);
2167extern ino_t iunique(struct super_block *, ino_t); 2166extern ino_t iunique(struct super_block *, ino_t);
2168extern int inode_needs_sync(struct inode *inode); 2167extern int inode_needs_sync(struct inode *inode);
2169extern void generic_delete_inode(struct inode *inode); 2168extern int generic_delete_inode(struct inode *inode);
2170extern void generic_drop_inode(struct inode *inode); 2169extern int generic_drop_inode(struct inode *inode);
2171extern int generic_detach_inode(struct inode *inode);
2172 2170
2173extern struct inode *ilookup5_nowait(struct super_block *sb, 2171extern struct inode *ilookup5_nowait(struct super_block *sb,
2174 unsigned long hashval, int (*test)(struct inode *, void *), 2172 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2185,7 +2183,7 @@ extern void unlock_new_inode(struct inode *);
2185 2183
2186extern void __iget(struct inode * inode); 2184extern void __iget(struct inode * inode);
2187extern void iget_failed(struct inode *); 2185extern void iget_failed(struct inode *);
2188extern void clear_inode(struct inode *); 2186extern void end_writeback(struct inode *);
2189extern void destroy_inode(struct inode *); 2187extern void destroy_inode(struct inode *);
2190extern void __destroy_inode(struct inode *); 2188extern void __destroy_inode(struct inode *);
2191extern struct inode *new_inode(struct super_block *); 2189extern struct inode *new_inode(struct super_block *);
@@ -2201,7 +2199,6 @@ static inline void insert_inode_hash(struct inode *inode) {
2201extern void file_move(struct file *f, struct list_head *list); 2199extern void file_move(struct file *f, struct list_head *list);
2202extern void file_kill(struct file *f); 2200extern void file_kill(struct file *f);
2203#ifdef CONFIG_BLOCK 2201#ifdef CONFIG_BLOCK
2204struct bio;
2205extern void submit_bio(int, struct bio *); 2202extern void submit_bio(int, struct bio *);
2206extern int bdev_read_only(struct block_device *); 2203extern int bdev_read_only(struct block_device *);
2207#endif 2204#endif
@@ -2268,19 +2265,8 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2268#endif 2265#endif
2269 2266
2270#ifdef CONFIG_BLOCK 2267#ifdef CONFIG_BLOCK
2271struct bio;
2272typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode, 2268typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2273 loff_t file_offset); 2269 loff_t file_offset);
2274void dio_end_io(struct bio *bio, int error);
2275
2276ssize_t __blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, struct inode *inode,
2277 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2278 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2279 dio_submit_t submit_io, int lock_type);
2280ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2281 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2282 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2283 dio_submit_t submit_io, int lock_type);
2284 2270
2285enum { 2271enum {
2286 /* need locking between buffered and direct access */ 2272 /* need locking between buffered and direct access */
@@ -2290,24 +2276,13 @@ enum {
2290 DIO_SKIP_HOLES = 0x02, 2276 DIO_SKIP_HOLES = 0x02,
2291}; 2277};
2292 2278
2293static inline ssize_t blockdev_direct_IO_newtrunc(int rw, struct kiocb *iocb, 2279void dio_end_io(struct bio *bio, int error);
2294 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2280
2295 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2281ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2296 dio_iodone_t end_io) 2282 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2297{ 2283 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2298 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset, 2284 dio_submit_t submit_io, int flags);
2299 nr_segs, get_block, end_io, NULL,
2300 DIO_LOCKING | DIO_SKIP_HOLES);
2301}
2302 2285
2303static inline ssize_t blockdev_direct_IO_no_locking_newtrunc(int rw, struct kiocb *iocb,
2304 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2305 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2306 dio_iodone_t end_io)
2307{
2308 return __blockdev_direct_IO_newtrunc(rw, iocb, inode, bdev, iov, offset,
2309 nr_segs, get_block, end_io, NULL, 0);
2310}
2311static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2286static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2312 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2287 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2313 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2288 loff_t offset, unsigned long nr_segs, get_block_t get_block,
@@ -2317,15 +2292,6 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2317 nr_segs, get_block, end_io, NULL, 2292 nr_segs, get_block, end_io, NULL,
2318 DIO_LOCKING | DIO_SKIP_HOLES); 2293 DIO_LOCKING | DIO_SKIP_HOLES);
2319} 2294}
2320
2321static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2322 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2323 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2324 dio_iodone_t end_io)
2325{
2326 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2327 nr_segs, get_block, end_io, NULL, 0);
2328}
2329#endif 2295#endif
2330 2296
2331extern const struct file_operations generic_ro_fops; 2297extern const struct file_operations generic_ro_fops;
@@ -2387,7 +2353,6 @@ extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2387extern int simple_unlink(struct inode *, struct dentry *); 2353extern int simple_unlink(struct inode *, struct dentry *);
2388extern int simple_rmdir(struct inode *, struct dentry *); 2354extern int simple_rmdir(struct inode *, struct dentry *);
2389extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2355extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2390extern int simple_setsize(struct inode *, loff_t);
2391extern int noop_fsync(struct file *, int); 2356extern int noop_fsync(struct file *, int);
2392extern int simple_empty(struct dentry *); 2357extern int simple_empty(struct dentry *);
2393extern int simple_readpage(struct file *file, struct page *page); 2358extern int simple_readpage(struct file *file, struct page *page);
@@ -2424,8 +2389,7 @@ extern int buffer_migrate_page(struct address_space *,
2424 2389
2425extern int inode_change_ok(const struct inode *, struct iattr *); 2390extern int inode_change_ok(const struct inode *, struct iattr *);
2426extern int inode_newsize_ok(const struct inode *, loff_t offset); 2391extern int inode_newsize_ok(const struct inode *, loff_t offset);
2427extern int __must_check inode_setattr(struct inode *, const struct iattr *); 2392extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2428extern void generic_setattr(struct inode *inode, const struct iattr *attr);
2429 2393
2430extern void file_update_time(struct file *file); 2394extern void file_update_time(struct file *file);
2431 2395
@@ -2516,7 +2480,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2516int __init get_filesystem_list(char *buf); 2480int __init get_filesystem_list(char *buf);
2517 2481
2518#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2482#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2519#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2483#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2484 (flag & FMODE_NONOTIFY)))
2520 2485
2521#endif /* __KERNEL__ */ 2486#endif /* __KERNEL__ */
2522#endif /* _LINUX_FS_H */ 2487#endif /* _LINUX_FS_H */