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.h261
1 files changed, 138 insertions, 123 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index b1bcb275b596..63d069bd80b7 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
@@ -53,6 +54,7 @@ struct inodes_stat_t {
53#define MAY_APPEND 8 54#define MAY_APPEND 8
54#define MAY_ACCESS 16 55#define MAY_ACCESS 16
55#define MAY_OPEN 32 56#define MAY_OPEN 32
57#define MAY_CHDIR 64
56 58
57/* 59/*
58 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond 60 * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
@@ -60,24 +62,24 @@ struct inodes_stat_t {
60 */ 62 */
61 63
62/* file is open for reading */ 64/* file is open for reading */
63#define FMODE_READ ((__force fmode_t)1) 65#define FMODE_READ ((__force fmode_t)0x1)
64/* file is open for writing */ 66/* file is open for writing */
65#define FMODE_WRITE ((__force fmode_t)2) 67#define FMODE_WRITE ((__force fmode_t)0x2)
66/* file is seekable */ 68/* file is seekable */
67#define FMODE_LSEEK ((__force fmode_t)4) 69#define FMODE_LSEEK ((__force fmode_t)0x4)
68/* file can be accessed using pread */ 70/* file can be accessed using pread */
69#define FMODE_PREAD ((__force fmode_t)8) 71#define FMODE_PREAD ((__force fmode_t)0x8)
70/* file can be accessed using pwrite */ 72/* file can be accessed using pwrite */
71#define FMODE_PWRITE ((__force fmode_t)16) 73#define FMODE_PWRITE ((__force fmode_t)0x10)
72/* File is opened for execution with sys_execve / sys_uselib */ 74/* File is opened for execution with sys_execve / sys_uselib */
73#define FMODE_EXEC ((__force fmode_t)32) 75#define FMODE_EXEC ((__force fmode_t)0x20)
74/* File is opened with O_NDELAY (only set for block devices) */ 76/* File is opened with O_NDELAY (only set for block devices) */
75#define FMODE_NDELAY ((__force fmode_t)64) 77#define FMODE_NDELAY ((__force fmode_t)0x40)
76/* File is opened with O_EXCL (only set for block devices) */ 78/* File is opened with O_EXCL (only set for block devices) */
77#define FMODE_EXCL ((__force fmode_t)128) 79#define FMODE_EXCL ((__force fmode_t)0x80)
78/* File is opened using open(.., 3, ..) and is writeable only for ioctls 80/* File is opened using open(.., 3, ..) and is writeable only for ioctls
79 (specialy hack for floppy.c) */ 81 (specialy hack for floppy.c) */
80#define FMODE_WRITE_IOCTL ((__force fmode_t)256) 82#define FMODE_WRITE_IOCTL ((__force fmode_t)0x100)
81 83
82/* 84/*
83 * Don't update ctime and mtime. 85 * Don't update ctime and mtime.
@@ -85,7 +87,13 @@ struct inodes_stat_t {
85 * Currently a special hack for the XFS open_by_handle ioctl, but we'll 87 * Currently a special hack for the XFS open_by_handle ioctl, but we'll
86 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon. 88 * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon.
87 */ 89 */
88#define FMODE_NOCMTIME ((__force fmode_t)2048) 90#define FMODE_NOCMTIME ((__force fmode_t)0x800)
91
92/* Expect random access pattern */
93#define FMODE_RANDOM ((__force fmode_t)0x1000)
94
95/* File was opened by fanotify and shouldn't generate fanotify events */
96#define FMODE_NONOTIFY ((__force fmode_t)0x1000000)
89 97
90/* 98/*
91 * 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
@@ -114,12 +122,9 @@ struct inodes_stat_t {
114 * immediately wait on this read without caring about 122 * immediately wait on this read without caring about
115 * unplugging. 123 * unplugging.
116 * READA Used for read-ahead operations. Lower priority, and the 124 * READA Used for read-ahead operations. Lower priority, and the
117 * block layer could (in theory) choose to ignore this 125 * block layer could (in theory) choose to ignore this
118 * request if it runs into resource problems. 126 * request if it runs into resource problems.
119 * WRITE A normal async write. Device will be plugged. 127 * 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 128 * WRITE_SYNC_PLUG Synchronous write. Identical to WRITE, but passes down
124 * the hint that someone will be waiting on this IO 129 * the hint that someone will be waiting on this IO
125 * shortly. The device must still be unplugged explicitly, 130 * shortly. The device must still be unplugged explicitly,
@@ -130,10 +135,7 @@ struct inodes_stat_t {
130 * immediately after submission. The write equivalent 135 * immediately after submission. The write equivalent
131 * of READ_SYNC. 136 * of READ_SYNC.
132 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. 137 * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only.
133 * SWRITE_SYNC 138 * WRITE_BARRIER Like WRITE_SYNC, but tells the block layer that all
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 139 * previously submitted writes must be safely on storage
138 * before this one is started. Also guarantees that when 140 * before this one is started. Also guarantees that when
139 * this write is complete, it itself is also safely on 141 * this write is complete, it itself is also safely on
@@ -141,29 +143,29 @@ struct inodes_stat_t {
141 * of this IO. 143 * of this IO.
142 * 144 *
143 */ 145 */
144#define RW_MASK 1 146#define RW_MASK REQ_WRITE
145#define RWA_MASK 2 147#define RWA_MASK REQ_RAHEAD
146#define READ 0 148
147#define WRITE 1 149#define READ 0
148#define READA 2 /* read-ahead - don't block if no resources */ 150#define WRITE RW_MASK
149#define SWRITE 3 /* for ll_rw_block() - wait for buffer lock */ 151#define READA RWA_MASK
150#define READ_SYNC (READ | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) 152
151#define READ_META (READ | (1 << BIO_RW_META)) 153#define READ_SYNC (READ | REQ_SYNC | REQ_UNPLUG)
152#define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 154#define READ_META (READ | REQ_META)
153#define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 155#define WRITE_SYNC_PLUG (WRITE | REQ_SYNC | REQ_NOIDLE)
154#define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) 156#define WRITE_SYNC (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG)
155#define WRITE_META (WRITE | (1 << BIO_RW_META)) 157#define WRITE_ODIRECT_PLUG (WRITE | REQ_SYNC)
156#define SWRITE_SYNC_PLUG \ 158#define WRITE_META (WRITE | REQ_META)
157 (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) 159#define WRITE_BARRIER (WRITE | REQ_SYNC | REQ_NOIDLE | REQ_UNPLUG | \
158#define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) 160 REQ_HARDBARRIER)
159#define WRITE_BARRIER (WRITE | (1 << BIO_RW_BARRIER))
160 161
161/* 162/*
162 * These aren't really reads or writes, they pass down information about 163 * These aren't really reads or writes, they pass down information about
163 * parts of device that are now unused by the file system. 164 * parts of device that are now unused by the file system.
164 */ 165 */
165#define DISCARD_NOBARRIER (WRITE | (1 << BIO_RW_DISCARD)) 166#define DISCARD_NOBARRIER (WRITE | REQ_DISCARD)
166#define DISCARD_BARRIER (DISCARD_NOBARRIER | (1 << BIO_RW_BARRIER)) 167#define DISCARD_BARRIER (WRITE | REQ_DISCARD | REQ_HARDBARRIER)
168#define DISCARD_SECURE (DISCARD_NOBARRIER | REQ_SECURE)
167 169
168#define SEL_IN 1 170#define SEL_IN 1
169#define SEL_OUT 2 171#define SEL_OUT 2
@@ -206,6 +208,7 @@ struct inodes_stat_t {
206#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */ 208#define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
207#define MS_I_VERSION (1<<23) /* Update inode I_version field */ 209#define MS_I_VERSION (1<<23) /* Update inode I_version field */
208#define MS_STRICTATIME (1<<24) /* Always perform atime updates */ 210#define MS_STRICTATIME (1<<24) /* Always perform atime updates */
211#define MS_BORN (1<<29)
209#define MS_ACTIVE (1<<30) 212#define MS_ACTIVE (1<<30)
210#define MS_NOUSER (1<<31) 213#define MS_NOUSER (1<<31)
211 214
@@ -306,6 +309,7 @@ struct inodes_stat_t {
306#define BLKALIGNOFF _IO(0x12,122) 309#define BLKALIGNOFF _IO(0x12,122)
307#define BLKPBSZGET _IO(0x12,123) 310#define BLKPBSZGET _IO(0x12,123)
308#define BLKDISCARDZEROES _IO(0x12,124) 311#define BLKDISCARDZEROES _IO(0x12,124)
312#define BLKSECDISCARD _IO(0x12,125)
309 313
310#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ 314#define BMAP_IOCTL 1 /* obsolete - kept for compatibility */
311#define FIBMAP _IO(0x00,1) /* bmap access */ 315#define FIBMAP _IO(0x00,1) /* bmap access */
@@ -404,15 +408,13 @@ extern int get_max_files(void);
404extern int sysctl_nr_open; 408extern int sysctl_nr_open;
405extern struct inodes_stat_t inodes_stat; 409extern struct inodes_stat_t inodes_stat;
406extern int leases_enable, lease_break_time; 410extern int leases_enable, lease_break_time;
407#ifdef CONFIG_DNOTIFY
408extern int dir_notify_enable;
409#endif
410 411
411struct buffer_head; 412struct buffer_head;
412typedef int (get_block_t)(struct inode *inode, sector_t iblock, 413typedef int (get_block_t)(struct inode *inode, sector_t iblock,
413 struct buffer_head *bh_result, int create); 414 struct buffer_head *bh_result, int create);
414typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset, 415typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
415 ssize_t bytes, void *private); 416 ssize_t bytes, void *private, int ret,
417 bool is_async);
416 418
417/* 419/*
418 * Attribute flags. These should be or-ed together to figure out what 420 * Attribute flags. These should be or-ed together to figure out what
@@ -648,6 +650,7 @@ struct block_device {
648 int bd_openers; 650 int bd_openers;
649 struct mutex bd_mutex; /* open/close mutex */ 651 struct mutex bd_mutex; /* open/close mutex */
650 struct list_head bd_inodes; 652 struct list_head bd_inodes;
653 void * bd_claiming;
651 void * bd_holder; 654 void * bd_holder;
652 int bd_holders; 655 int bd_holders;
653#ifdef CONFIG_SYSFS 656#ifdef CONFIG_SYSFS
@@ -681,6 +684,7 @@ struct block_device {
681 */ 684 */
682#define PAGECACHE_TAG_DIRTY 0 685#define PAGECACHE_TAG_DIRTY 0
683#define PAGECACHE_TAG_WRITEBACK 1 686#define PAGECACHE_TAG_WRITEBACK 1
687#define PAGECACHE_TAG_TOWRITE 2
684 688
685int mapping_tagged(struct address_space *mapping, int tag); 689int mapping_tagged(struct address_space *mapping, int tag);
686 690
@@ -729,6 +733,7 @@ struct inode {
729 uid_t i_uid; 733 uid_t i_uid;
730 gid_t i_gid; 734 gid_t i_gid;
731 dev_t i_rdev; 735 dev_t i_rdev;
736 unsigned int i_blkbits;
732 u64 i_version; 737 u64 i_version;
733 loff_t i_size; 738 loff_t i_size;
734#ifdef __NEED_I_SIZE_ORDERED 739#ifdef __NEED_I_SIZE_ORDERED
@@ -738,7 +743,6 @@ struct inode {
738 struct timespec i_mtime; 743 struct timespec i_mtime;
739 struct timespec i_ctime; 744 struct timespec i_ctime;
740 blkcnt_t i_blocks; 745 blkcnt_t i_blocks;
741 unsigned int i_blkbits;
742 unsigned short i_bytes; 746 unsigned short i_bytes;
743 umode_t i_mode; 747 umode_t i_mode;
744 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 748 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
@@ -764,12 +768,7 @@ struct inode {
764 768
765#ifdef CONFIG_FSNOTIFY 769#ifdef CONFIG_FSNOTIFY
766 __u32 i_fsnotify_mask; /* all events this inode cares about */ 770 __u32 i_fsnotify_mask; /* all events this inode cares about */
767 struct hlist_head i_fsnotify_mark_entries; /* fsnotify mark entries */ 771 struct hlist_head i_fsnotify_marks;
768#endif
769
770#ifdef CONFIG_INOTIFY
771 struct list_head inotify_watches; /* watches on this inode */
772 struct mutex inotify_mutex; /* protects the watches list */
773#endif 772#endif
774 773
775 unsigned long i_state; 774 unsigned long i_state;
@@ -921,6 +920,9 @@ struct file {
921#define f_vfsmnt f_path.mnt 920#define f_vfsmnt f_path.mnt
922 const struct file_operations *f_op; 921 const struct file_operations *f_op;
923 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */ 922 spinlock_t f_lock; /* f_ep_links, f_flags, no IRQ */
923#ifdef CONFIG_SMP
924 int f_sb_list_cpu;
925#endif
924 atomic_long_t f_count; 926 atomic_long_t f_count;
925 unsigned int f_flags; 927 unsigned int f_flags;
926 fmode_t f_mode; 928 fmode_t f_mode;
@@ -945,11 +947,9 @@ struct file {
945 unsigned long f_mnt_write_state; 947 unsigned long f_mnt_write_state;
946#endif 948#endif
947}; 949};
948extern spinlock_t files_lock;
949#define file_list_lock() spin_lock(&files_lock);
950#define file_list_unlock() spin_unlock(&files_lock);
951 950
952#define get_file(x) atomic_long_inc(&(x)->f_count) 951#define get_file(x) atomic_long_inc(&(x)->f_count)
952#define fput_atomic(x) atomic_long_add_unless(&(x)->f_count, -1, 1)
953#define file_count(x) atomic_long_read(&(x)->f_count) 953#define file_count(x) atomic_long_read(&(x)->f_count)
954 954
955#ifdef CONFIG_DEBUG_WRITECOUNT 955#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -1093,6 +1093,10 @@ struct file_lock {
1093 1093
1094#include <linux/fcntl.h> 1094#include <linux/fcntl.h>
1095 1095
1096/* temporary stubs for BKL removal */
1097#define lock_flocks() lock_kernel()
1098#define unlock_flocks() unlock_kernel()
1099
1096extern void send_sigio(struct fown_struct *fown, int fd, int band); 1100extern void send_sigio(struct fown_struct *fown, int fd, int band);
1097 1101
1098#ifdef CONFIG_FILE_LOCKING 1102#ifdef CONFIG_FILE_LOCKING
@@ -1277,10 +1281,12 @@ static inline int lock_may_write(struct inode *inode, loff_t start,
1277 1281
1278 1282
1279struct fasync_struct { 1283struct fasync_struct {
1280 int magic; 1284 spinlock_t fa_lock;
1281 int fa_fd; 1285 int magic;
1282 struct fasync_struct *fa_next; /* singly linked list */ 1286 int fa_fd;
1283 struct file *fa_file; 1287 struct fasync_struct *fa_next; /* singly linked list */
1288 struct file *fa_file;
1289 struct rcu_head fa_rcu;
1284}; 1290};
1285 1291
1286#define FASYNC_MAGIC 0x4601 1292#define FASYNC_MAGIC 0x4601
@@ -1289,8 +1295,6 @@ struct fasync_struct {
1289extern int fasync_helper(int, struct file *, int, struct fasync_struct **); 1295extern int fasync_helper(int, struct file *, int, struct fasync_struct **);
1290/* can be called from interrupts */ 1296/* can be called from interrupts */
1291extern void kill_fasync(struct fasync_struct **, int, int); 1297extern void kill_fasync(struct fasync_struct **, int, int);
1292/* only for net: no internal synchronization */
1293extern void __kill_fasync(struct fasync_struct *, int, int);
1294 1298
1295extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force); 1299extern int __f_setown(struct file *filp, struct pid *, enum pid_type, int force);
1296extern int f_setown(struct file *filp, unsigned long arg, int force); 1300extern int f_setown(struct file *filp, unsigned long arg, int force);
@@ -1305,18 +1309,18 @@ extern int send_sigurg(struct fown_struct *fown);
1305#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ 1309#define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */
1306#define MNT_DETACH 0x00000002 /* Just detach from the tree */ 1310#define MNT_DETACH 0x00000002 /* Just detach from the tree */
1307#define MNT_EXPIRE 0x00000004 /* Mark for expiry */ 1311#define MNT_EXPIRE 0x00000004 /* Mark for expiry */
1312#define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */
1313#define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */
1308 1314
1309extern struct list_head super_blocks; 1315extern struct list_head super_blocks;
1310extern spinlock_t sb_lock; 1316extern spinlock_t sb_lock;
1311 1317
1312#define sb_entry(list) list_entry((list), struct super_block, s_list)
1313#define S_BIAS (1<<30)
1314struct super_block { 1318struct super_block {
1315 struct list_head s_list; /* Keep this first */ 1319 struct list_head s_list; /* Keep this first */
1316 dev_t s_dev; /* search index; _not_ kdev_t */ 1320 dev_t s_dev; /* search index; _not_ kdev_t */
1317 unsigned long s_blocksize;
1318 unsigned char s_blocksize_bits;
1319 unsigned char s_dirt; 1321 unsigned char s_dirt;
1322 unsigned char s_blocksize_bits;
1323 unsigned long s_blocksize;
1320 loff_t s_maxbytes; /* Max file size */ 1324 loff_t s_maxbytes; /* Max file size */
1321 struct file_system_type *s_type; 1325 struct file_system_type *s_type;
1322 const struct super_operations *s_op; 1326 const struct super_operations *s_op;
@@ -1329,16 +1333,19 @@ struct super_block {
1329 struct rw_semaphore s_umount; 1333 struct rw_semaphore s_umount;
1330 struct mutex s_lock; 1334 struct mutex s_lock;
1331 int s_count; 1335 int s_count;
1332 int s_need_sync;
1333 atomic_t s_active; 1336 atomic_t s_active;
1334#ifdef CONFIG_SECURITY 1337#ifdef CONFIG_SECURITY
1335 void *s_security; 1338 void *s_security;
1336#endif 1339#endif
1337 struct xattr_handler **s_xattr; 1340 const struct xattr_handler **s_xattr;
1338 1341
1339 struct list_head s_inodes; /* all inodes */ 1342 struct list_head s_inodes; /* all inodes */
1340 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */ 1343 struct hlist_head s_anon; /* anonymous dentries for (nfs) exporting */
1344#ifdef CONFIG_SMP
1345 struct list_head __percpu *s_files;
1346#else
1341 struct list_head s_files; 1347 struct list_head s_files;
1348#endif
1342 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */ 1349 /* s_dentry_lru and s_nr_dentry_unused are protected by dcache_lock */
1343 struct list_head s_dentry_lru; /* unused dentry lru */ 1350 struct list_head s_dentry_lru; /* unused dentry lru */
1344 int s_nr_dentry_unused; /* # of dentry on lru */ 1351 int s_nr_dentry_unused; /* # of dentry on lru */
@@ -1357,16 +1364,16 @@ struct super_block {
1357 void *s_fs_info; /* Filesystem private info */ 1364 void *s_fs_info; /* Filesystem private info */
1358 fmode_t s_mode; 1365 fmode_t s_mode;
1359 1366
1367 /* Granularity of c/m/atime in ns.
1368 Cannot be worse than a second */
1369 u32 s_time_gran;
1370
1360 /* 1371 /*
1361 * The next field is for VFS *only*. No filesystems have any business 1372 * The next field is for VFS *only*. No filesystems have any business
1362 * even looking at it. You had been warned. 1373 * even looking at it. You had been warned.
1363 */ 1374 */
1364 struct mutex s_vfs_rename_mutex; /* Kludge */ 1375 struct mutex s_vfs_rename_mutex; /* Kludge */
1365 1376
1366 /* Granularity of c/m/atime in ns.
1367 Cannot be worse than a second */
1368 u32 s_time_gran;
1369
1370 /* 1377 /*
1371 * Filesystem subtype. If non-empty the filesystem type field 1378 * Filesystem subtype. If non-empty the filesystem type field
1372 * in /proc/mounts will be "type.subtype" 1379 * in /proc/mounts will be "type.subtype"
@@ -1426,7 +1433,8 @@ extern void dentry_unhash(struct dentry *dentry);
1426 * VFS file helper functions. 1433 * VFS file helper functions.
1427 */ 1434 */
1428extern int file_permission(struct file *, int); 1435extern int file_permission(struct file *, int);
1429 1436extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1437 mode_t mode);
1430/* 1438/*
1431 * VFS FS_IOC_FIEMAP helper definitions. 1439 * VFS FS_IOC_FIEMAP helper definitions.
1432 */ 1440 */
@@ -1474,8 +1482,8 @@ struct block_device_operations;
1474 1482
1475/* 1483/*
1476 * NOTE: 1484 * NOTE:
1477 * read, write, poll, fsync, readv, writev, unlocked_ioctl and compat_ioctl 1485 * all file operations except setlease can be called without
1478 * can be called without the big kernel lock held in all filesystems. 1486 * the big kernel lock held in all filesystems.
1479 */ 1487 */
1480struct file_operations { 1488struct file_operations {
1481 struct module *owner; 1489 struct module *owner;
@@ -1486,14 +1494,13 @@ struct file_operations {
1486 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t); 1494 ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
1487 int (*readdir) (struct file *, void *, filldir_t); 1495 int (*readdir) (struct file *, void *, filldir_t);
1488 unsigned int (*poll) (struct file *, struct poll_table_struct *); 1496 unsigned int (*poll) (struct file *, struct poll_table_struct *);
1489 int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);
1490 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); 1497 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
1491 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); 1498 long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
1492 int (*mmap) (struct file *, struct vm_area_struct *); 1499 int (*mmap) (struct file *, struct vm_area_struct *);
1493 int (*open) (struct inode *, struct file *); 1500 int (*open) (struct inode *, struct file *);
1494 int (*flush) (struct file *, fl_owner_t id); 1501 int (*flush) (struct file *, fl_owner_t id);
1495 int (*release) (struct inode *, struct file *); 1502 int (*release) (struct inode *, struct file *);
1496 int (*fsync) (struct file *, struct dentry *, int datasync); 1503 int (*fsync) (struct file *, int datasync);
1497 int (*aio_fsync) (struct kiocb *, int datasync); 1504 int (*aio_fsync) (struct kiocb *, int datasync);
1498 int (*fasync) (int, struct file *, int); 1505 int (*fasync) (int, struct file *, int);
1499 int (*lock) (struct file *, int, struct file_lock *); 1506 int (*lock) (struct file *, int, struct file_lock *);
@@ -1555,9 +1562,9 @@ struct super_operations {
1555 void (*destroy_inode)(struct inode *); 1562 void (*destroy_inode)(struct inode *);
1556 1563
1557 void (*dirty_inode) (struct inode *); 1564 void (*dirty_inode) (struct inode *);
1558 int (*write_inode) (struct inode *, int); 1565 int (*write_inode) (struct inode *, struct writeback_control *wbc);
1559 void (*drop_inode) (struct inode *); 1566 int (*drop_inode) (struct inode *);
1560 void (*delete_inode) (struct inode *); 1567 void (*evict_inode) (struct inode *);
1561 void (*put_super) (struct super_block *); 1568 void (*put_super) (struct super_block *);
1562 void (*write_super) (struct super_block *); 1569 void (*write_super) (struct super_block *);
1563 int (*sync_fs)(struct super_block *sb, int wait); 1570 int (*sync_fs)(struct super_block *sb, int wait);
@@ -1565,7 +1572,6 @@ struct super_operations {
1565 int (*unfreeze_fs) (struct super_block *); 1572 int (*unfreeze_fs) (struct super_block *);
1566 int (*statfs) (struct dentry *, struct kstatfs *); 1573 int (*statfs) (struct dentry *, struct kstatfs *);
1567 int (*remount_fs) (struct super_block *, int *, char *); 1574 int (*remount_fs) (struct super_block *, int *, char *);
1568 void (*clear_inode) (struct inode *);
1569 void (*umount_begin) (struct super_block *); 1575 void (*umount_begin) (struct super_block *);
1570 1576
1571 int (*show_options)(struct seq_file *, struct vfsmount *); 1577 int (*show_options)(struct seq_file *, struct vfsmount *);
@@ -1610,8 +1616,8 @@ struct super_operations {
1610 * 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
1611 * pages or buffers attached or the inode itself is still 1617 * pages or buffers attached or the inode itself is still
1612 * dirty. 1618 * dirty.
1613 * 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
1614 * and can be destroyed. 1620 * and can be destroyed. Inode keeps I_FREEING.
1615 * 1621 *
1616 * 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
1617 * prohibited for many purposes. iget() must wait for 1623 * prohibited for many purposes. iget() must wait for
@@ -1739,6 +1745,7 @@ struct file_system_type {
1739 1745
1740 struct lock_class_key s_lock_key; 1746 struct lock_class_key s_lock_key;
1741 struct lock_class_key s_umount_key; 1747 struct lock_class_key s_umount_key;
1748 struct lock_class_key s_vfs_rename_key;
1742 1749
1743 struct lock_class_key i_lock_key; 1750 struct lock_class_key i_lock_key;
1744 struct lock_class_key i_mutex_key; 1751 struct lock_class_key i_mutex_key;
@@ -1776,8 +1783,19 @@ extern int get_sb_pseudo(struct file_system_type *, char *,
1776 const struct super_operations *ops, unsigned long, 1783 const struct super_operations *ops, unsigned long,
1777 struct vfsmount *mnt); 1784 struct vfsmount *mnt);
1778extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb); 1785extern void simple_set_mnt(struct vfsmount *mnt, struct super_block *sb);
1779int __put_super_and_need_restart(struct super_block *sb); 1786
1780void put_super(struct super_block *sb); 1787static inline void sb_mark_dirty(struct super_block *sb)
1788{
1789 sb->s_dirt = 1;
1790}
1791static inline void sb_mark_clean(struct super_block *sb)
1792{
1793 sb->s_dirt = 0;
1794}
1795static inline int sb_is_dirty(struct super_block *sb)
1796{
1797 return sb->s_dirt;
1798}
1781 1799
1782/* Alas, no aliases. Too much hassle with bringing module.h everywhere */ 1800/* Alas, no aliases. Too much hassle with bringing module.h everywhere */
1783#define fops_get(fops) \ 1801#define fops_get(fops) \
@@ -1794,8 +1812,12 @@ extern int may_umount(struct vfsmount *);
1794extern long do_mount(char *, char *, char *, unsigned long, void *); 1812extern long do_mount(char *, char *, char *, unsigned long, void *);
1795extern struct vfsmount *collect_mounts(struct path *); 1813extern struct vfsmount *collect_mounts(struct path *);
1796extern void drop_collected_mounts(struct vfsmount *); 1814extern void drop_collected_mounts(struct vfsmount *);
1797 1815extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *,
1798extern int vfs_statfs(struct dentry *, struct kstatfs *); 1816 struct vfsmount *);
1817extern int vfs_statfs(struct path *, struct kstatfs *);
1818extern int statfs_by_dentry(struct dentry *, struct kstatfs *);
1819extern int freeze_super(struct super_block *super);
1820extern int thaw_super(struct super_block *super);
1799 1821
1800extern int current_umask(void); 1822extern int current_umask(void);
1801 1823
@@ -2058,12 +2080,6 @@ extern int invalidate_inodes(struct super_block *);
2058unsigned long invalidate_mapping_pages(struct address_space *mapping, 2080unsigned long invalidate_mapping_pages(struct address_space *mapping,
2059 pgoff_t start, pgoff_t end); 2081 pgoff_t start, pgoff_t end);
2060 2082
2061static inline unsigned long __deprecated
2062invalidate_inode_pages(struct address_space *mapping)
2063{
2064 return invalidate_mapping_pages(mapping, 0, ~0UL);
2065}
2066
2067static inline void invalidate_remote_inode(struct inode *inode) 2083static inline void invalidate_remote_inode(struct inode *inode)
2068{ 2084{
2069 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || 2085 if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
@@ -2087,9 +2103,9 @@ extern int __filemap_fdatawrite_range(struct address_space *mapping,
2087extern int filemap_fdatawrite_range(struct address_space *mapping, 2103extern int filemap_fdatawrite_range(struct address_space *mapping,
2088 loff_t start, loff_t end); 2104 loff_t start, loff_t end);
2089 2105
2090extern int vfs_fsync_range(struct file *file, struct dentry *dentry, 2106extern int vfs_fsync_range(struct file *file, loff_t start, loff_t end,
2091 loff_t start, loff_t end, int datasync); 2107 int datasync);
2092extern int vfs_fsync(struct file *file, struct dentry *dentry, int datasync); 2108extern int vfs_fsync(struct file *file, int datasync);
2093extern int generic_write_sync(struct file *file, loff_t pos, loff_t count); 2109extern int generic_write_sync(struct file *file, loff_t pos, loff_t count);
2094extern void sync_supers(void); 2110extern void sync_supers(void);
2095extern void emergency_sync(void); 2111extern void emergency_sync(void);
@@ -2132,6 +2148,7 @@ extern struct file * open_exec(const char *);
2132 2148
2133/* fs/dcache.c -- generic fs support functions */ 2149/* fs/dcache.c -- generic fs support functions */
2134extern int is_subdir(struct dentry *, struct dentry *); 2150extern int is_subdir(struct dentry *, struct dentry *);
2151extern int path_is_under(struct path *, struct path *);
2135extern ino_t find_inode_number(struct dentry *, struct qstr *); 2152extern ino_t find_inode_number(struct dentry *, struct qstr *);
2136 2153
2137#include <linux/err.h> 2154#include <linux/err.h>
@@ -2148,9 +2165,8 @@ extern void iput(struct inode *);
2148extern struct inode * igrab(struct inode *); 2165extern struct inode * igrab(struct inode *);
2149extern ino_t iunique(struct super_block *, ino_t); 2166extern ino_t iunique(struct super_block *, ino_t);
2150extern int inode_needs_sync(struct inode *inode); 2167extern int inode_needs_sync(struct inode *inode);
2151extern void generic_delete_inode(struct inode *inode); 2168extern int generic_delete_inode(struct inode *inode);
2152extern void generic_drop_inode(struct inode *inode); 2169extern int generic_drop_inode(struct inode *inode);
2153extern int generic_detach_inode(struct inode *inode);
2154 2170
2155extern struct inode *ilookup5_nowait(struct super_block *sb, 2171extern struct inode *ilookup5_nowait(struct super_block *sb,
2156 unsigned long hashval, int (*test)(struct inode *, void *), 2172 unsigned long hashval, int (*test)(struct inode *, void *),
@@ -2167,7 +2183,7 @@ extern void unlock_new_inode(struct inode *);
2167 2183
2168extern void __iget(struct inode * inode); 2184extern void __iget(struct inode * inode);
2169extern void iget_failed(struct inode *); 2185extern void iget_failed(struct inode *);
2170extern void clear_inode(struct inode *); 2186extern void end_writeback(struct inode *);
2171extern void destroy_inode(struct inode *); 2187extern void destroy_inode(struct inode *);
2172extern void __destroy_inode(struct inode *); 2188extern void __destroy_inode(struct inode *);
2173extern struct inode *new_inode(struct super_block *); 2189extern struct inode *new_inode(struct super_block *);
@@ -2180,10 +2196,7 @@ static inline void insert_inode_hash(struct inode *inode) {
2180 __insert_inode_hash(inode, inode->i_ino); 2196 __insert_inode_hash(inode, inode->i_ino);
2181} 2197}
2182 2198
2183extern void file_move(struct file *f, struct list_head *list);
2184extern void file_kill(struct file *f);
2185#ifdef CONFIG_BLOCK 2199#ifdef CONFIG_BLOCK
2186struct bio;
2187extern void submit_bio(int, struct bio *); 2200extern void submit_bio(int, struct bio *);
2188extern int bdev_read_only(struct block_device *); 2201extern int bdev_read_only(struct block_device *);
2189#endif 2202#endif
@@ -2211,6 +2224,7 @@ extern int generic_segment_checks(const struct iovec *iov,
2211/* fs/block_dev.c */ 2224/* fs/block_dev.c */
2212extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, 2225extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov,
2213 unsigned long nr_segs, loff_t pos); 2226 unsigned long nr_segs, loff_t pos);
2227extern int blkdev_fsync(struct file *filp, int datasync);
2214 2228
2215/* fs/splice.c */ 2229/* fs/splice.c */
2216extern ssize_t generic_file_splice_read(struct file *, loff_t *, 2230extern ssize_t generic_file_splice_read(struct file *, loff_t *,
@@ -2226,6 +2240,7 @@ extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2226 2240
2227extern void 2241extern void
2228file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2242file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
2243extern loff_t noop_llseek(struct file *file, loff_t offset, int origin);
2229extern loff_t no_llseek(struct file *file, loff_t offset, int origin); 2244extern loff_t no_llseek(struct file *file, loff_t offset, int origin);
2230extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin); 2245extern loff_t generic_file_llseek(struct file *file, loff_t offset, int origin);
2231extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset, 2246extern loff_t generic_file_llseek_unlocked(struct file *file, loff_t offset,
@@ -2248,10 +2263,8 @@ static inline int xip_truncate_page(struct address_space *mapping, loff_t from)
2248#endif 2263#endif
2249 2264
2250#ifdef CONFIG_BLOCK 2265#ifdef CONFIG_BLOCK
2251ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, 2266typedef void (dio_submit_t)(int rw, struct bio *bio, struct inode *inode,
2252 struct block_device *bdev, const struct iovec *iov, loff_t offset, 2267 loff_t file_offset);
2253 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2254 int lock_type);
2255 2268
2256enum { 2269enum {
2257 /* need locking between buffered and direct access */ 2270 /* need locking between buffered and direct access */
@@ -2261,24 +2274,22 @@ enum {
2261 DIO_SKIP_HOLES = 0x02, 2274 DIO_SKIP_HOLES = 0x02,
2262}; 2275};
2263 2276
2277void dio_end_io(struct bio *bio, int error);
2278
2279ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2280 struct block_device *bdev, const struct iovec *iov, loff_t offset,
2281 unsigned long nr_segs, get_block_t get_block, dio_iodone_t end_io,
2282 dio_submit_t submit_io, int flags);
2283
2264static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2284static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2265 struct inode *inode, struct block_device *bdev, const struct iovec *iov, 2285 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2266 loff_t offset, unsigned long nr_segs, get_block_t get_block, 2286 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2267 dio_iodone_t end_io) 2287 dio_iodone_t end_io)
2268{ 2288{
2269 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2289 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2270 nr_segs, get_block, end_io, 2290 nr_segs, get_block, end_io, NULL,
2271 DIO_LOCKING | DIO_SKIP_HOLES); 2291 DIO_LOCKING | DIO_SKIP_HOLES);
2272} 2292}
2273
2274static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2275 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2276 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2277 dio_iodone_t end_io)
2278{
2279 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2280 nr_segs, get_block, end_io, 0);
2281}
2282#endif 2293#endif
2283 2294
2284extern const struct file_operations generic_ro_fops; 2295extern const struct file_operations generic_ro_fops;
@@ -2305,16 +2316,17 @@ void inode_set_bytes(struct inode *inode, loff_t bytes);
2305 2316
2306extern int vfs_readdir(struct file *, filldir_t, void *); 2317extern int vfs_readdir(struct file *, filldir_t, void *);
2307 2318
2308extern int vfs_stat(char __user *, struct kstat *); 2319extern int vfs_stat(const char __user *, struct kstat *);
2309extern int vfs_lstat(char __user *, struct kstat *); 2320extern int vfs_lstat(const char __user *, struct kstat *);
2310extern int vfs_fstat(unsigned int, struct kstat *); 2321extern int vfs_fstat(unsigned int, struct kstat *);
2311extern int vfs_fstatat(int , char __user *, struct kstat *, int); 2322extern int vfs_fstatat(int , const char __user *, struct kstat *, int);
2312 2323
2313extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, 2324extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd,
2314 unsigned long arg); 2325 unsigned long arg);
2315extern int __generic_block_fiemap(struct inode *inode, 2326extern int __generic_block_fiemap(struct inode *inode,
2316 struct fiemap_extent_info *fieinfo, u64 start, 2327 struct fiemap_extent_info *fieinfo,
2317 u64 len, get_block_t *get_block); 2328 loff_t start, loff_t len,
2329 get_block_t *get_block);
2318extern int generic_block_fiemap(struct inode *inode, 2330extern int generic_block_fiemap(struct inode *inode,
2319 struct fiemap_extent_info *fieinfo, u64 start, 2331 struct fiemap_extent_info *fieinfo, u64 start,
2320 u64 len, get_block_t *get_block); 2332 u64 len, get_block_t *get_block);
@@ -2326,22 +2338,22 @@ extern struct super_block *get_super(struct block_device *);
2326extern struct super_block *get_active_super(struct block_device *bdev); 2338extern struct super_block *get_active_super(struct block_device *bdev);
2327extern struct super_block *user_get_super(dev_t); 2339extern struct super_block *user_get_super(dev_t);
2328extern void drop_super(struct super_block *sb); 2340extern void drop_super(struct super_block *sb);
2341extern void iterate_supers(void (*)(struct super_block *, void *), void *);
2329 2342
2330extern int dcache_dir_open(struct inode *, struct file *); 2343extern int dcache_dir_open(struct inode *, struct file *);
2331extern int dcache_dir_close(struct inode *, struct file *); 2344extern int dcache_dir_close(struct inode *, struct file *);
2332extern loff_t dcache_dir_lseek(struct file *, loff_t, int); 2345extern loff_t dcache_dir_lseek(struct file *, loff_t, int);
2333extern int dcache_readdir(struct file *, void *, filldir_t); 2346extern int dcache_readdir(struct file *, void *, filldir_t);
2347extern int simple_setattr(struct dentry *, struct iattr *);
2334extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2348extern int simple_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2335extern int simple_statfs(struct dentry *, struct kstatfs *); 2349extern int simple_statfs(struct dentry *, struct kstatfs *);
2336extern int simple_link(struct dentry *, struct inode *, struct dentry *); 2350extern int simple_link(struct dentry *, struct inode *, struct dentry *);
2337extern int simple_unlink(struct inode *, struct dentry *); 2351extern int simple_unlink(struct inode *, struct dentry *);
2338extern int simple_rmdir(struct inode *, struct dentry *); 2352extern int simple_rmdir(struct inode *, struct dentry *);
2339extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *); 2353extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
2340extern int simple_sync_file(struct file *, struct dentry *, int); 2354extern int noop_fsync(struct file *, int);
2341extern int simple_empty(struct dentry *); 2355extern int simple_empty(struct dentry *);
2342extern int simple_readpage(struct file *file, struct page *page); 2356extern int simple_readpage(struct file *file, struct page *page);
2343extern int simple_prepare_write(struct file *file, struct page *page,
2344 unsigned offset, unsigned to);
2345extern int simple_write_begin(struct file *file, struct address_space *mapping, 2357extern int simple_write_begin(struct file *file, struct address_space *mapping,
2346 loff_t pos, unsigned len, unsigned flags, 2358 loff_t pos, unsigned len, unsigned flags,
2347 struct page **pagep, void **fsdata); 2359 struct page **pagep, void **fsdata);
@@ -2355,14 +2367,16 @@ extern const struct file_operations simple_dir_operations;
2355extern const struct inode_operations simple_dir_inode_operations; 2367extern const struct inode_operations simple_dir_inode_operations;
2356struct tree_descr { char *name; const struct file_operations *ops; int mode; }; 2368struct tree_descr { char *name; const struct file_operations *ops; int mode; };
2357struct dentry *d_alloc_name(struct dentry *, const char *); 2369struct dentry *d_alloc_name(struct dentry *, const char *);
2358extern int simple_fill_super(struct super_block *, int, struct tree_descr *); 2370extern int simple_fill_super(struct super_block *, unsigned long, struct tree_descr *);
2359extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count); 2371extern int simple_pin_fs(struct file_system_type *, struct vfsmount **mount, int *count);
2360extern void simple_release_fs(struct vfsmount **mount, int *count); 2372extern void simple_release_fs(struct vfsmount **mount, int *count);
2361 2373
2362extern ssize_t simple_read_from_buffer(void __user *to, size_t count, 2374extern ssize_t simple_read_from_buffer(void __user *to, size_t count,
2363 loff_t *ppos, const void *from, size_t available); 2375 loff_t *ppos, const void *from, size_t available);
2376extern ssize_t simple_write_to_buffer(void *to, size_t available, loff_t *ppos,
2377 const void __user *from, size_t count);
2364 2378
2365extern int simple_fsync(struct file *, struct dentry *, int); 2379extern int generic_file_fsync(struct file *, int);
2366 2380
2367#ifdef CONFIG_MIGRATION 2381#ifdef CONFIG_MIGRATION
2368extern int buffer_migrate_page(struct address_space *, 2382extern int buffer_migrate_page(struct address_space *,
@@ -2373,7 +2387,7 @@ extern int buffer_migrate_page(struct address_space *,
2373 2387
2374extern int inode_change_ok(const struct inode *, struct iattr *); 2388extern int inode_change_ok(const struct inode *, struct iattr *);
2375extern int inode_newsize_ok(const struct inode *, loff_t offset); 2389extern int inode_newsize_ok(const struct inode *, loff_t offset);
2376extern int __must_check inode_setattr(struct inode *, struct iattr *); 2390extern void setattr_copy(struct inode *inode, const struct iattr *attr);
2377 2391
2378extern void file_update_time(struct file *file); 2392extern void file_update_time(struct file *file);
2379 2393
@@ -2464,7 +2478,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2464int __init get_filesystem_list(char *buf); 2478int __init get_filesystem_list(char *buf);
2465 2479
2466#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) 2480#define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE])
2467#define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) 2481#define OPEN_FMODE(flag) ((__force fmode_t)(((flag + 1) & O_ACCMODE) | \
2482 (flag & FMODE_NONOTIFY)))
2468 2483
2469#endif /* __KERNEL__ */ 2484#endif /* __KERNEL__ */
2470#endif /* _LINUX_FS_H */ 2485#endif /* _LINUX_FS_H */