diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 136 |
1 files changed, 62 insertions, 74 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5c7e0ff370ba..894918440bc8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -60,24 +60,24 @@ struct inodes_stat_t { | |||
60 | */ | 60 | */ |
61 | 61 | ||
62 | /* file is open for reading */ | 62 | /* file is open for reading */ |
63 | #define FMODE_READ ((__force fmode_t)1) | 63 | #define FMODE_READ ((__force fmode_t)0x1) |
64 | /* file is open for writing */ | 64 | /* file is open for writing */ |
65 | #define FMODE_WRITE ((__force fmode_t)2) | 65 | #define FMODE_WRITE ((__force fmode_t)0x2) |
66 | /* file is seekable */ | 66 | /* file is seekable */ |
67 | #define FMODE_LSEEK ((__force fmode_t)4) | 67 | #define FMODE_LSEEK ((__force fmode_t)0x4) |
68 | /* file can be accessed using pread */ | 68 | /* file can be accessed using pread */ |
69 | #define FMODE_PREAD ((__force fmode_t)8) | 69 | #define FMODE_PREAD ((__force fmode_t)0x8) |
70 | /* file can be accessed using pwrite */ | 70 | /* file can be accessed using pwrite */ |
71 | #define FMODE_PWRITE ((__force fmode_t)16) | 71 | #define FMODE_PWRITE ((__force fmode_t)0x10) |
72 | /* File is opened for execution with sys_execve / sys_uselib */ | 72 | /* File is opened for execution with sys_execve / sys_uselib */ |
73 | #define FMODE_EXEC ((__force fmode_t)32) | 73 | #define FMODE_EXEC ((__force fmode_t)0x20) |
74 | /* File is opened with O_NDELAY (only set for block devices) */ | 74 | /* File is opened with O_NDELAY (only set for block devices) */ |
75 | #define FMODE_NDELAY ((__force fmode_t)64) | 75 | #define FMODE_NDELAY ((__force fmode_t)0x40) |
76 | /* File is opened with O_EXCL (only set for block devices) */ | 76 | /* File is opened with O_EXCL (only set for block devices) */ |
77 | #define FMODE_EXCL ((__force fmode_t)128) | 77 | #define FMODE_EXCL ((__force fmode_t)0x80) |
78 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls | 78 | /* File is opened using open(.., 3, ..) and is writeable only for ioctls |
79 | (specialy hack for floppy.c) */ | 79 | (specialy hack for floppy.c) */ |
80 | #define FMODE_WRITE_IOCTL ((__force fmode_t)256) | 80 | #define FMODE_WRITE_IOCTL ((__force fmode_t)0x100) |
81 | 81 | ||
82 | /* | 82 | /* |
83 | * Don't update ctime and mtime. | 83 | * Don't update ctime and mtime. |
@@ -85,7 +85,10 @@ struct inodes_stat_t { | |||
85 | * Currently a special hack for the XFS open_by_handle ioctl, but we'll | 85 | * 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. | 86 | * hopefully graduate it to a proper O_CMTIME flag supported by open(2) soon. |
87 | */ | 87 | */ |
88 | #define FMODE_NOCMTIME ((__force fmode_t)2048) | 88 | #define FMODE_NOCMTIME ((__force fmode_t)0x800) |
89 | |||
90 | /* Expect random access pattern */ | ||
91 | #define FMODE_RANDOM ((__force fmode_t)0x1000) | ||
89 | 92 | ||
90 | /* | 93 | /* |
91 | * The below are the various read and write types that we support. Some of | 94 | * The below are the various read and write types that we support. Some of |
@@ -129,7 +132,7 @@ struct inodes_stat_t { | |||
129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device | 132 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device |
130 | * immediately after submission. The write equivalent | 133 | * immediately after submission. The write equivalent |
131 | * of READ_SYNC. | 134 | * of READ_SYNC. |
132 | * WRITE_ODIRECT Special case write for O_DIRECT only. | 135 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. |
133 | * SWRITE_SYNC | 136 | * SWRITE_SYNC |
134 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | 137 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. |
135 | * See SWRITE. | 138 | * See SWRITE. |
@@ -151,7 +154,8 @@ struct inodes_stat_t { | |||
151 | #define READ_META (READ | (1 << BIO_RW_META)) | 154 | #define READ_META (READ | (1 << BIO_RW_META)) |
152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 155 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 156 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
154 | #define WRITE_ODIRECT (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_UNPLUG)) | 157 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) |
158 | #define WRITE_META (WRITE | (1 << BIO_RW_META)) | ||
155 | #define SWRITE_SYNC_PLUG \ | 159 | #define SWRITE_SYNC_PLUG \ |
156 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 160 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
157 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 161 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
@@ -304,6 +308,7 @@ struct inodes_stat_t { | |||
304 | #define BLKIOOPT _IO(0x12,121) | 308 | #define BLKIOOPT _IO(0x12,121) |
305 | #define BLKALIGNOFF _IO(0x12,122) | 309 | #define BLKALIGNOFF _IO(0x12,122) |
306 | #define BLKPBSZGET _IO(0x12,123) | 310 | #define BLKPBSZGET _IO(0x12,123) |
311 | #define BLKDISCARDZEROES _IO(0x12,124) | ||
307 | 312 | ||
308 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 313 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
309 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 314 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
@@ -728,6 +733,7 @@ struct inode { | |||
728 | uid_t i_uid; | 733 | uid_t i_uid; |
729 | gid_t i_gid; | 734 | gid_t i_gid; |
730 | dev_t i_rdev; | 735 | dev_t i_rdev; |
736 | unsigned int i_blkbits; | ||
731 | u64 i_version; | 737 | u64 i_version; |
732 | loff_t i_size; | 738 | loff_t i_size; |
733 | #ifdef __NEED_I_SIZE_ORDERED | 739 | #ifdef __NEED_I_SIZE_ORDERED |
@@ -737,7 +743,6 @@ struct inode { | |||
737 | struct timespec i_mtime; | 743 | struct timespec i_mtime; |
738 | struct timespec i_ctime; | 744 | struct timespec i_ctime; |
739 | blkcnt_t i_blocks; | 745 | blkcnt_t i_blocks; |
740 | unsigned int i_blkbits; | ||
741 | unsigned short i_bytes; | 746 | unsigned short i_bytes; |
742 | umode_t i_mode; | 747 | umode_t i_mode; |
743 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ | 748 | spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ |
@@ -1096,10 +1101,6 @@ struct file_lock { | |||
1096 | 1101 | ||
1097 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1102 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
1098 | 1103 | ||
1099 | /* fs/sync.c */ | ||
1100 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1101 | loff_t endbyte, unsigned int flags); | ||
1102 | |||
1103 | #ifdef CONFIG_FILE_LOCKING | 1104 | #ifdef CONFIG_FILE_LOCKING |
1104 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1105 | extern int fcntl_getlk(struct file *, struct flock __user *); |
1105 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1106 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
@@ -1310,6 +1311,8 @@ extern int send_sigurg(struct fown_struct *fown); | |||
1310 | #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ | 1311 | #define MNT_FORCE 0x00000001 /* Attempt to forcibily umount */ |
1311 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ | 1312 | #define MNT_DETACH 0x00000002 /* Just detach from the tree */ |
1312 | #define MNT_EXPIRE 0x00000004 /* Mark for expiry */ | 1313 | #define MNT_EXPIRE 0x00000004 /* Mark for expiry */ |
1314 | #define UMOUNT_NOFOLLOW 0x00000008 /* Don't follow symlink on umount */ | ||
1315 | #define UMOUNT_UNUSED 0x80000000 /* Flag guaranteed to be unused */ | ||
1313 | 1316 | ||
1314 | extern struct list_head super_blocks; | 1317 | extern struct list_head super_blocks; |
1315 | extern spinlock_t sb_lock; | 1318 | extern spinlock_t sb_lock; |
@@ -1319,9 +1322,9 @@ extern spinlock_t sb_lock; | |||
1319 | struct super_block { | 1322 | struct super_block { |
1320 | struct list_head s_list; /* Keep this first */ | 1323 | struct list_head s_list; /* Keep this first */ |
1321 | dev_t s_dev; /* search index; _not_ kdev_t */ | 1324 | dev_t s_dev; /* search index; _not_ kdev_t */ |
1322 | unsigned long s_blocksize; | ||
1323 | unsigned char s_blocksize_bits; | ||
1324 | unsigned char s_dirt; | 1325 | unsigned char s_dirt; |
1326 | unsigned char s_blocksize_bits; | ||
1327 | unsigned long s_blocksize; | ||
1325 | loff_t s_maxbytes; /* Max file size */ | 1328 | loff_t s_maxbytes; /* Max file size */ |
1326 | struct file_system_type *s_type; | 1329 | struct file_system_type *s_type; |
1327 | const struct super_operations *s_op; | 1330 | const struct super_operations *s_op; |
@@ -1362,16 +1365,16 @@ struct super_block { | |||
1362 | void *s_fs_info; /* Filesystem private info */ | 1365 | void *s_fs_info; /* Filesystem private info */ |
1363 | fmode_t s_mode; | 1366 | fmode_t s_mode; |
1364 | 1367 | ||
1368 | /* Granularity of c/m/atime in ns. | ||
1369 | Cannot be worse than a second */ | ||
1370 | u32 s_time_gran; | ||
1371 | |||
1365 | /* | 1372 | /* |
1366 | * The next field is for VFS *only*. No filesystems have any business | 1373 | * The next field is for VFS *only*. No filesystems have any business |
1367 | * even looking at it. You had been warned. | 1374 | * even looking at it. You had been warned. |
1368 | */ | 1375 | */ |
1369 | struct mutex s_vfs_rename_mutex; /* Kludge */ | 1376 | struct mutex s_vfs_rename_mutex; /* Kludge */ |
1370 | 1377 | ||
1371 | /* Granularity of c/m/atime in ns. | ||
1372 | Cannot be worse than a second */ | ||
1373 | u32 s_time_gran; | ||
1374 | |||
1375 | /* | 1378 | /* |
1376 | * Filesystem subtype. If non-empty the filesystem type field | 1379 | * Filesystem subtype. If non-empty the filesystem type field |
1377 | * in /proc/mounts will be "type.subtype" | 1380 | * in /proc/mounts will be "type.subtype" |
@@ -1560,7 +1563,7 @@ struct super_operations { | |||
1560 | void (*destroy_inode)(struct inode *); | 1563 | void (*destroy_inode)(struct inode *); |
1561 | 1564 | ||
1562 | void (*dirty_inode) (struct inode *); | 1565 | void (*dirty_inode) (struct inode *); |
1563 | int (*write_inode) (struct inode *, int); | 1566 | int (*write_inode) (struct inode *, struct writeback_control *wbc); |
1564 | void (*drop_inode) (struct inode *); | 1567 | void (*drop_inode) (struct inode *); |
1565 | void (*delete_inode) (struct inode *); | 1568 | void (*delete_inode) (struct inode *); |
1566 | void (*put_super) (struct super_block *); | 1569 | void (*put_super) (struct super_block *); |
@@ -1592,7 +1595,7 @@ struct super_operations { | |||
1592 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at | 1595 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at |
1593 | * various stages of removing an inode. | 1596 | * various stages of removing an inode. |
1594 | * | 1597 | * |
1595 | * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. | 1598 | * Two bits are used for locking and completion notification, I_NEW and I_SYNC. |
1596 | * | 1599 | * |
1597 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on | 1600 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on |
1598 | * fdatasync(). i_atime is the usual cause. | 1601 | * fdatasync(). i_atime is the usual cause. |
@@ -1601,8 +1604,14 @@ struct super_operations { | |||
1601 | * don't have to write inode on fdatasync() when only | 1604 | * don't have to write inode on fdatasync() when only |
1602 | * mtime has changed in it. | 1605 | * mtime has changed in it. |
1603 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. | 1606 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. |
1604 | * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both | 1607 | * I_NEW Serves as both a mutex and completion notification. |
1605 | * are cleared by unlock_new_inode(), called from iget(). | 1608 | * New inodes set I_NEW. If two processes both create |
1609 | * the same inode, one of them will release its inode and | ||
1610 | * wait for I_NEW to be released before returning. | ||
1611 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1612 | * also cause waiting on I_NEW, without I_NEW actually | ||
1613 | * being set. find_inode() uses this to prevent returning | ||
1614 | * nearly-dead inodes. | ||
1606 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count | 1615 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count |
1607 | * is zero. I_FREEING must be set when I_WILL_FREE is | 1616 | * is zero. I_FREEING must be set when I_WILL_FREE is |
1608 | * cleared. | 1617 | * cleared. |
@@ -1616,35 +1625,23 @@ struct super_operations { | |||
1616 | * prohibited for many purposes. iget() must wait for | 1625 | * prohibited for many purposes. iget() must wait for |
1617 | * the inode to be completely released, then create it | 1626 | * the inode to be completely released, then create it |
1618 | * anew. Other functions will just ignore such inodes, | 1627 | * anew. Other functions will just ignore such inodes, |
1619 | * if appropriate. I_LOCK is used for waiting. | 1628 | * if appropriate. I_NEW is used for waiting. |
1620 | * | 1629 | * |
1621 | * I_LOCK Serves as both a mutex and completion notification. | 1630 | * I_SYNC Synchonized write of dirty inode data. The bits is |
1622 | * New inodes set I_LOCK. If two processes both create | 1631 | * set during data writeback, and cleared with a wakeup |
1623 | * the same inode, one of them will release its inode and | 1632 | * on the bit address once it is done. |
1624 | * wait for I_LOCK to be released before returning. | ||
1625 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1626 | * also cause waiting on I_LOCK, without I_LOCK actually | ||
1627 | * being set. find_inode() uses this to prevent returning | ||
1628 | * nearly-dead inodes. | ||
1629 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | ||
1630 | * of inode dirty data. Having a separate lock for this | ||
1631 | * purpose reduces latency and prevents some filesystem- | ||
1632 | * specific deadlocks. | ||
1633 | * | 1633 | * |
1634 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1634 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
1635 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
1636 | * I_CLEAR? If not, why? | ||
1637 | */ | 1635 | */ |
1638 | #define I_DIRTY_SYNC 1 | 1636 | #define I_DIRTY_SYNC 1 |
1639 | #define I_DIRTY_DATASYNC 2 | 1637 | #define I_DIRTY_DATASYNC 2 |
1640 | #define I_DIRTY_PAGES 4 | 1638 | #define I_DIRTY_PAGES 4 |
1641 | #define I_NEW 8 | 1639 | #define __I_NEW 3 |
1640 | #define I_NEW (1 << __I_NEW) | ||
1642 | #define I_WILL_FREE 16 | 1641 | #define I_WILL_FREE 16 |
1643 | #define I_FREEING 32 | 1642 | #define I_FREEING 32 |
1644 | #define I_CLEAR 64 | 1643 | #define I_CLEAR 64 |
1645 | #define __I_LOCK 7 | 1644 | #define __I_SYNC 7 |
1646 | #define I_LOCK (1 << __I_LOCK) | ||
1647 | #define __I_SYNC 8 | ||
1648 | #define I_SYNC (1 << __I_SYNC) | 1645 | #define I_SYNC (1 << __I_SYNC) |
1649 | 1646 | ||
1650 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1647 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
@@ -1805,7 +1802,8 @@ extern int may_umount(struct vfsmount *); | |||
1805 | extern long do_mount(char *, char *, char *, unsigned long, void *); | 1802 | extern long do_mount(char *, char *, char *, unsigned long, void *); |
1806 | extern struct vfsmount *collect_mounts(struct path *); | 1803 | extern struct vfsmount *collect_mounts(struct path *); |
1807 | extern void drop_collected_mounts(struct vfsmount *); | 1804 | extern void drop_collected_mounts(struct vfsmount *); |
1808 | 1805 | extern int iterate_mounts(int (*)(struct vfsmount *, void *), void *, | |
1806 | struct vfsmount *); | ||
1809 | extern int vfs_statfs(struct dentry *, struct kstatfs *); | 1807 | extern int vfs_statfs(struct dentry *, struct kstatfs *); |
1810 | 1808 | ||
1811 | extern int current_umask(void); | 1809 | extern int current_umask(void); |
@@ -2069,12 +2067,6 @@ extern int invalidate_inodes(struct super_block *); | |||
2069 | unsigned long invalidate_mapping_pages(struct address_space *mapping, | 2067 | unsigned long invalidate_mapping_pages(struct address_space *mapping, |
2070 | pgoff_t start, pgoff_t end); | 2068 | pgoff_t start, pgoff_t end); |
2071 | 2069 | ||
2072 | static inline unsigned long __deprecated | ||
2073 | invalidate_inode_pages(struct address_space *mapping) | ||
2074 | { | ||
2075 | return invalidate_mapping_pages(mapping, 0, ~0UL); | ||
2076 | } | ||
2077 | |||
2078 | static inline void invalidate_remote_inode(struct inode *inode) | 2070 | static inline void invalidate_remote_inode(struct inode *inode) |
2079 | { | 2071 | { |
2080 | if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || | 2072 | if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) || |
@@ -2093,8 +2085,6 @@ extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | |||
2093 | extern int filemap_write_and_wait(struct address_space *mapping); | 2085 | extern int filemap_write_and_wait(struct address_space *mapping); |
2094 | extern int filemap_write_and_wait_range(struct address_space *mapping, | 2086 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
2095 | loff_t lstart, loff_t lend); | 2087 | loff_t lstart, loff_t lend); |
2096 | extern int wait_on_page_writeback_range(struct address_space *mapping, | ||
2097 | pgoff_t start, pgoff_t end); | ||
2098 | extern int __filemap_fdatawrite_range(struct address_space *mapping, | 2088 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
2099 | loff_t start, loff_t end, int sync_mode); | 2089 | loff_t start, loff_t end, int sync_mode); |
2100 | extern int filemap_fdatawrite_range(struct address_space *mapping, | 2090 | extern int filemap_fdatawrite_range(struct address_space *mapping, |
@@ -2145,6 +2135,7 @@ extern struct file * open_exec(const char *); | |||
2145 | 2135 | ||
2146 | /* fs/dcache.c -- generic fs support functions */ | 2136 | /* fs/dcache.c -- generic fs support functions */ |
2147 | extern int is_subdir(struct dentry *, struct dentry *); | 2137 | extern int is_subdir(struct dentry *, struct dentry *); |
2138 | extern int path_is_under(struct path *, struct path *); | ||
2148 | extern ino_t find_inode_number(struct dentry *, struct qstr *); | 2139 | extern ino_t find_inode_number(struct dentry *, struct qstr *); |
2149 | 2140 | ||
2150 | #include <linux/err.h> | 2141 | #include <linux/err.h> |
@@ -2193,7 +2184,6 @@ static inline void insert_inode_hash(struct inode *inode) { | |||
2193 | __insert_inode_hash(inode, inode->i_ino); | 2184 | __insert_inode_hash(inode, inode->i_ino); |
2194 | } | 2185 | } |
2195 | 2186 | ||
2196 | extern struct file * get_empty_filp(void); | ||
2197 | extern void file_move(struct file *f, struct list_head *list); | 2187 | extern void file_move(struct file *f, struct list_head *list); |
2198 | extern void file_kill(struct file *f); | 2188 | extern void file_kill(struct file *f); |
2199 | #ifdef CONFIG_BLOCK | 2189 | #ifdef CONFIG_BLOCK |
@@ -2225,6 +2215,7 @@ extern int generic_segment_checks(const struct iovec *iov, | |||
2225 | /* fs/block_dev.c */ | 2215 | /* fs/block_dev.c */ |
2226 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | 2216 | extern ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, |
2227 | unsigned long nr_segs, loff_t pos); | 2217 | unsigned long nr_segs, loff_t pos); |
2218 | extern int blkdev_fsync(struct file *filp, struct dentry *dentry, int datasync); | ||
2228 | 2219 | ||
2229 | /* fs/splice.c */ | 2220 | /* fs/splice.c */ |
2230 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, | 2221 | extern ssize_t generic_file_splice_read(struct file *, loff_t *, |
@@ -2268,9 +2259,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
2268 | int lock_type); | 2259 | int lock_type); |
2269 | 2260 | ||
2270 | enum { | 2261 | enum { |
2271 | DIO_LOCKING = 1, /* need locking between buffered and direct access */ | 2262 | /* need locking between buffered and direct access */ |
2272 | DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ | 2263 | DIO_LOCKING = 0x01, |
2273 | DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ | 2264 | |
2265 | /* filesystem does not support filling holes */ | ||
2266 | DIO_SKIP_HOLES = 0x02, | ||
2274 | }; | 2267 | }; |
2275 | 2268 | ||
2276 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2269 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
@@ -2279,7 +2272,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | |||
2279 | dio_iodone_t end_io) | 2272 | dio_iodone_t end_io) |
2280 | { | 2273 | { |
2281 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2274 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2282 | nr_segs, get_block, end_io, DIO_LOCKING); | 2275 | nr_segs, get_block, end_io, |
2276 | DIO_LOCKING | DIO_SKIP_HOLES); | ||
2283 | } | 2277 | } |
2284 | 2278 | ||
2285 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | 2279 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, |
@@ -2288,16 +2282,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | |||
2288 | dio_iodone_t end_io) | 2282 | dio_iodone_t end_io) |
2289 | { | 2283 | { |
2290 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2284 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2291 | nr_segs, get_block, end_io, DIO_NO_LOCKING); | 2285 | nr_segs, get_block, end_io, 0); |
2292 | } | ||
2293 | |||
2294 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, | ||
2295 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
2296 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
2297 | dio_iodone_t end_io) | ||
2298 | { | ||
2299 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | ||
2300 | nr_segs, get_block, end_io, DIO_OWN_LOCKING); | ||
2301 | } | 2286 | } |
2302 | #endif | 2287 | #endif |
2303 | 2288 | ||
@@ -2317,6 +2302,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
2317 | extern int generic_readlink(struct dentry *, char __user *, int); | 2302 | extern int generic_readlink(struct dentry *, char __user *, int); |
2318 | extern void generic_fillattr(struct inode *, struct kstat *); | 2303 | extern void generic_fillattr(struct inode *, struct kstat *); |
2319 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2304 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2305 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
2320 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2306 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2321 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2307 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
2322 | loff_t inode_get_bytes(struct inode *inode); | 2308 | loff_t inode_get_bytes(struct inode *inode); |
@@ -2332,8 +2318,9 @@ extern int vfs_fstatat(int , char __user *, struct kstat *, int); | |||
2332 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, | 2318 | extern int do_vfs_ioctl(struct file *filp, unsigned int fd, unsigned int cmd, |
2333 | unsigned long arg); | 2319 | unsigned long arg); |
2334 | extern int __generic_block_fiemap(struct inode *inode, | 2320 | extern int __generic_block_fiemap(struct inode *inode, |
2335 | struct fiemap_extent_info *fieinfo, u64 start, | 2321 | struct fiemap_extent_info *fieinfo, |
2336 | u64 len, get_block_t *get_block); | 2322 | loff_t start, loff_t len, |
2323 | get_block_t *get_block); | ||
2337 | extern int generic_block_fiemap(struct inode *inode, | 2324 | extern int generic_block_fiemap(struct inode *inode, |
2338 | struct fiemap_extent_info *fieinfo, u64 start, | 2325 | struct fiemap_extent_info *fieinfo, u64 start, |
2339 | u64 len, get_block_t *get_block); | 2326 | u64 len, get_block_t *get_block); |
@@ -2359,8 +2346,6 @@ extern int simple_rename(struct inode *, struct dentry *, struct inode *, struct | |||
2359 | extern int simple_sync_file(struct file *, struct dentry *, int); | 2346 | extern int simple_sync_file(struct file *, struct dentry *, int); |
2360 | extern int simple_empty(struct dentry *); | 2347 | extern int simple_empty(struct dentry *); |
2361 | extern int simple_readpage(struct file *file, struct page *page); | 2348 | extern int simple_readpage(struct file *file, struct page *page); |
2362 | extern int simple_prepare_write(struct file *file, struct page *page, | ||
2363 | unsigned offset, unsigned to); | ||
2364 | extern int simple_write_begin(struct file *file, struct address_space *mapping, | 2349 | extern int simple_write_begin(struct file *file, struct address_space *mapping, |
2365 | loff_t pos, unsigned len, unsigned flags, | 2350 | loff_t pos, unsigned len, unsigned flags, |
2366 | struct page **pagep, void **fsdata); | 2351 | struct page **pagep, void **fsdata); |
@@ -2482,5 +2467,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
2482 | 2467 | ||
2483 | int __init get_filesystem_list(char *buf); | 2468 | int __init get_filesystem_list(char *buf); |
2484 | 2469 | ||
2470 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | ||
2471 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
2472 | |||
2485 | #endif /* __KERNEL__ */ | 2473 | #endif /* __KERNEL__ */ |
2486 | #endif /* _LINUX_FS_H */ | 2474 | #endif /* _LINUX_FS_H */ |