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.h119
1 files changed, 74 insertions, 45 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a09e17c8f5fd..3b534e527e09 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -87,6 +87,60 @@ struct inodes_stat_t {
87 */ 87 */
88#define FMODE_NOCMTIME ((__force fmode_t)2048) 88#define FMODE_NOCMTIME ((__force fmode_t)2048)
89 89
90/*
91 * The below are the various read and write types that we support. Some of
92 * them include behavioral modifiers that send information down to the
93 * block layer and IO scheduler. Terminology:
94 *
95 * The block layer uses device plugging to defer IO a little bit, in
96 * the hope that we will see more IO very shortly. This increases
97 * coalescing of adjacent IO and thus reduces the number of IOs we
98 * have to send to the device. It also allows for better queuing,
99 * if the IO isn't mergeable. If the caller is going to be waiting
100 * for the IO, then he must ensure that the device is unplugged so
101 * that the IO is dispatched to the driver.
102 *
103 * All IO is handled async in Linux. This is fine for background
104 * writes, but for reads or writes that someone waits for completion
105 * on, we want to notify the block layer and IO scheduler so that they
106 * know about it. That allows them to make better scheduling
107 * decisions. So when the below references 'sync' and 'async', it
108 * is referencing this priority hint.
109 *
110 * With that in mind, the available types are:
111 *
112 * READ A normal read operation. Device will be plugged.
113 * READ_SYNC A synchronous read. Device is not plugged, caller can
114 * immediately wait on this read without caring about
115 * unplugging.
116 * READA Used for read-ahead operations. Lower priority, and the
117 * block layer could (in theory) choose to ignore this
118 * request if it runs into resource problems.
119 * WRITE A normal async write. Device will be plugged.
120 * SWRITE Like WRITE, but a special case for ll_rw_block() that
121 * tells it to lock the buffer first. Normally a buffer
122 * must be locked before doing IO.
123 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down
124 * the hint that someone will be waiting on this IO
125 * shortly. The device must still be unplugged explicitly,
126 * WRITE_SYNC_PLUG does not do this as we could be
127 * submitting more writes before we actually wait on any
128 * of them.
129 * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device
130 * immediately after submission. The write equivalent
131 * of READ_SYNC.
132 * WRITE_ODIRECT Special case write for O_DIRECT only.
133 * SWRITE_SYNC
134 * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer.
135 * See SWRITE.
136 * WRITE_BARRIER Like WRITE, but tells the block layer that all
137 * previously submitted writes must be safely on storage
138 * before this one is started. Also guarantees that when
139 * this write is complete, it itself is also safely on
140 * storage. Prevents reordering of writes on both sides
141 * of this IO.
142 *
143 */
90#define RW_MASK 1 144#define RW_MASK 1
91#define RWA_MASK 2 145#define RWA_MASK 2
92#define READ 0 146#define READ 0
@@ -95,9 +149,18 @@ struct inodes_stat_t {
95#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 149#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */
96#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 150#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
97#define READ_META (READ | (1 << BIO_RW_META)) 151#define READ_META (READ | (1 << BIO_RW_META))
98#define WRITE_SYNC (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 152#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
99#define SWRITE_SYNC (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 153#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
154#define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG))
155#define SWRITE_SYNC_PLUG \
156 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE))
157#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG))
100#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER)) 158#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
159
160/*
161 * These aren't really reads or writes, they pass down information about
162 * parts of device that are now unused by the file system.
163 */
101#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD) 164#define DISCARD_NOBARRIER (1 << BIO_RW_DISCARD)
102#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER)) 165#define DISCARD_BARRIER ((1 << BIO_RW_DISCARD) | (1 << BIO_RW_BARRIER))
103 166
@@ -734,9 +797,6 @@ enum inode_i_mutex_lock_class
734 I_MUTEX_QUOTA 797 I_MUTEX_QUOTA
735}; 798};
736 799
737extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
738extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
739
740/* 800/*
741 * NOTE: in a 32bit arch with a preemptable kernel and 801 * NOTE: in a 32bit arch with a preemptable kernel and
742 * an UP compile the i_size_read/write must be atomic 802 * an UP compile the i_size_read/write must be atomic
@@ -1695,6 +1755,9 @@ struct file_system_type {
1695 struct lock_class_key i_alloc_sem_key; 1755 struct lock_class_key i_alloc_sem_key;
1696}; 1756};
1697 1757
1758extern int get_sb_ns(struct file_system_type *fs_type, int flags, void *data,
1759 int (*fill_super)(struct super_block *, void *, int),
1760 struct vfsmount *mnt);
1698extern int get_sb_bdev(struct file_system_type *fs_type, 1761extern int get_sb_bdev(struct file_system_type *fs_type,
1699 int flags, const char *dev_name, void *data, 1762 int flags, const char *dev_name, void *data,
1700 int (*fill_super)(struct super_block *, void *, int), 1763 int (*fill_super)(struct super_block *, void *, int),
@@ -1712,6 +1775,7 @@ void kill_block_super(struct super_block *sb);
1712void kill_anon_super(struct super_block *sb); 1775void kill_anon_super(struct super_block *sb);
1713void kill_litter_super(struct super_block *sb); 1776void kill_litter_super(struct super_block *sb);
1714void deactivate_super(struct super_block *sb); 1777void deactivate_super(struct super_block *sb);
1778void deactivate_locked_super(struct super_block *sb);
1715int set_anon_super(struct super_block *s, void *data); 1779int set_anon_super(struct super_block *s, void *data);
1716struct super_block *sget(struct file_system_type *type, 1780struct super_block *sget(struct file_system_type *type,
1717 int (*test)(struct super_block *,void *), 1781 int (*test)(struct super_block *,void *),
@@ -2054,7 +2118,7 @@ extern struct file *create_write_pipe(int flags);
2054extern void free_write_pipe(struct file *); 2118extern void free_write_pipe(struct file *);
2055 2119
2056extern struct file *do_filp_open(int dfd, const char *pathname, 2120extern struct file *do_filp_open(int dfd, const char *pathname,
2057 int open_flag, int mode); 2121 int open_flag, int mode, int acc_mode);
2058extern int may_open(struct path *, int, int); 2122extern int may_open(struct path *, int, int);
2059 2123
2060extern int kernel_read(struct file *, unsigned long, char *, unsigned long); 2124extern int kernel_read(struct file *, unsigned long, char *, unsigned long);
@@ -2143,8 +2207,6 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
2143 struct pipe_inode_info *, size_t, unsigned int); 2207 struct pipe_inode_info *, size_t, unsigned int);
2144extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 2208extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
2145 struct file *, loff_t *, size_t, unsigned int); 2209 struct file *, loff_t *, size_t, unsigned int);
2146extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *,
2147 struct file *, loff_t *, size_t, unsigned int);
2148extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2210extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2149 struct file *out, loff_t *, size_t len, unsigned int flags); 2211 struct file *out, loff_t *, size_t len, unsigned int flags);
2150extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, 2212extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
@@ -2238,9 +2300,8 @@ extern int vfs_readdir(struct file *, filldir_t, void *);
2238 2300
2239extern int vfs_stat(char __user *, struct kstat *); 2301extern int vfs_stat(char __user *, struct kstat *);
2240extern int vfs_lstat(char __user *, struct kstat *); 2302extern int vfs_lstat(char __user *, struct kstat *);
2241extern int vfs_stat_fd(int dfd, char __user *, struct kstat *);
2242extern int vfs_lstat_fd(int dfd, char __user *, struct kstat *);
2243extern int vfs_fstat(unsigned int, struct kstat *); 2303extern int vfs_fstat(unsigned int, struct kstat *);
2304extern int vfs_fstatat(int , char __user *, struct kstat *, int);
2244 2305
2245extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2306extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2246 unsigned long arg); 2307 unsigned long arg);
@@ -2307,6 +2368,7 @@ extern void file_update_time(struct file *file);
2307 2368
2308extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt); 2369extern int generic_show_options(struct seq_file *m, struct vfsmount *mnt);
2309extern void save_mount_options(struct super_block *sb, char *options); 2370extern void save_mount_options(struct super_block *sb, char *options);
2371extern void replace_mount_options(struct super_block *sb, char *options);
2310 2372
2311static inline ino_t parent_ino(struct dentry *dentry) 2373static inline ino_t parent_ino(struct dentry *dentry)
2312{ 2374{
@@ -2337,19 +2399,7 @@ ssize_t simple_transaction_read(struct file *file, char __user *buf,
2337 size_t size, loff_t *pos); 2399 size_t size, loff_t *pos);
2338int simple_transaction_release(struct inode *inode, struct file *file); 2400int simple_transaction_release(struct inode *inode, struct file *file);
2339 2401
2340static inline void simple_transaction_set(struct file *file, size_t n) 2402void simple_transaction_set(struct file *file, size_t n);
2341{
2342 struct simple_transaction_argresp *ar = file->private_data;
2343
2344 BUG_ON(n > SIMPLE_TRANSACTION_LIMIT);
2345
2346 /*
2347 * The barrier ensures that ar->size will really remain zero until
2348 * ar->data is ready for reading.
2349 */
2350 smp_mb();
2351 ar->size = n;
2352}
2353 2403
2354/* 2404/*
2355 * simple attribute files 2405 * simple attribute files
@@ -2396,32 +2446,11 @@ ssize_t simple_attr_read(struct file *file, char __user *buf,
2396ssize_t simple_attr_write(struct file *file, const char __user *buf, 2446ssize_t simple_attr_write(struct file *file, const char __user *buf,
2397 size_t len, loff_t *ppos); 2447 size_t len, loff_t *ppos);
2398 2448
2399
2400#ifdef CONFIG_SECURITY
2401static inline char *alloc_secdata(void)
2402{
2403 return (char *)get_zeroed_page(GFP_KERNEL);
2404}
2405
2406static inline void free_secdata(void *secdata)
2407{
2408 free_page((unsigned long)secdata);
2409}
2410#else
2411static inline char *alloc_secdata(void)
2412{
2413 return (char *)1;
2414}
2415
2416static inline void free_secdata(void *secdata)
2417{ }
2418#endif /* CONFIG_SECURITY */
2419
2420struct ctl_table; 2449struct ctl_table;
2421int proc_nr_files(struct ctl_table *table, int write, struct file *filp, 2450int proc_nr_files(struct ctl_table *table, int write, struct file *filp,
2422 void __user *buffer, size_t *lenp, loff_t *ppos); 2451 void __user *buffer, size_t *lenp, loff_t *ppos);
2423 2452
2424int get_filesystem_list(char * buf); 2453int __init get_filesystem_list(char *buf);
2425 2454
2426#endif /* __KERNEL__ */ 2455#endif /* __KERNEL__ */
2427#endif /* _LINUX_FS_H */ 2456#endif /* _LINUX_FS_H */