diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 77 |
1 files changed, 32 insertions, 45 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 2620a8c63571..9147ca88f253 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -129,7 +129,7 @@ struct inodes_stat_t { | |||
129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device | 129 | * WRITE_SYNC Like WRITE_SYNC_PLUG, but also unplugs the device |
130 | * immediately after submission. The write equivalent | 130 | * immediately after submission. The write equivalent |
131 | * of READ_SYNC. | 131 | * of READ_SYNC. |
132 | * WRITE_ODIRECT Special case write for O_DIRECT only. | 132 | * WRITE_ODIRECT_PLUG Special case write for O_DIRECT only. |
133 | * SWRITE_SYNC | 133 | * SWRITE_SYNC |
134 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. | 134 | * SWRITE_SYNC_PLUG Like WRITE_SYNC/WRITE_SYNC_PLUG, but locks the buffer. |
135 | * See SWRITE. | 135 | * See SWRITE. |
@@ -151,7 +151,8 @@ struct inodes_stat_t { | |||
151 | #define READ_META (READ | (1 << BIO_RW_META)) | 151 | #define READ_META (READ | (1 << BIO_RW_META)) |
152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 152 | #define WRITE_SYNC_PLUG (WRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
153 | #define WRITE_SYNC (WRITE_SYNC_PLUG | (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)) | 154 | #define WRITE_ODIRECT_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) |
155 | #define WRITE_META (WRITE | (1 << BIO_RW_META)) | ||
155 | #define SWRITE_SYNC_PLUG \ | 156 | #define SWRITE_SYNC_PLUG \ |
156 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) | 157 | (SWRITE | (1 << BIO_RW_SYNCIO) | (1 << BIO_RW_NOIDLE)) |
157 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) | 158 | #define SWRITE_SYNC (SWRITE_SYNC_PLUG | (1 << BIO_RW_UNPLUG)) |
@@ -304,6 +305,7 @@ struct inodes_stat_t { | |||
304 | #define BLKIOOPT _IO(0x12,121) | 305 | #define BLKIOOPT _IO(0x12,121) |
305 | #define BLKALIGNOFF _IO(0x12,122) | 306 | #define BLKALIGNOFF _IO(0x12,122) |
306 | #define BLKPBSZGET _IO(0x12,123) | 307 | #define BLKPBSZGET _IO(0x12,123) |
308 | #define BLKDISCARDZEROES _IO(0x12,124) | ||
307 | 309 | ||
308 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ | 310 | #define BMAP_IOCTL 1 /* obsolete - kept for compatibility */ |
309 | #define FIBMAP _IO(0x00,1) /* bmap access */ | 311 | #define FIBMAP _IO(0x00,1) /* bmap access */ |
@@ -1093,10 +1095,6 @@ struct file_lock { | |||
1093 | 1095 | ||
1094 | extern void send_sigio(struct fown_struct *fown, int fd, int band); | 1096 | extern void send_sigio(struct fown_struct *fown, int fd, int band); |
1095 | 1097 | ||
1096 | /* fs/sync.c */ | ||
1097 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1098 | loff_t endbyte, unsigned int flags); | ||
1099 | |||
1100 | #ifdef CONFIG_FILE_LOCKING | 1098 | #ifdef CONFIG_FILE_LOCKING |
1101 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1099 | extern int fcntl_getlk(struct file *, struct flock __user *); |
1102 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1100 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
@@ -1589,7 +1587,7 @@ struct super_operations { | |||
1589 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at | 1587 | * until that flag is cleared. I_WILL_FREE, I_FREEING and I_CLEAR are set at |
1590 | * various stages of removing an inode. | 1588 | * various stages of removing an inode. |
1591 | * | 1589 | * |
1592 | * Two bits are used for locking and completion notification, I_LOCK and I_SYNC. | 1590 | * Two bits are used for locking and completion notification, I_NEW and I_SYNC. |
1593 | * | 1591 | * |
1594 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on | 1592 | * I_DIRTY_SYNC Inode is dirty, but doesn't have to be written on |
1595 | * fdatasync(). i_atime is the usual cause. | 1593 | * fdatasync(). i_atime is the usual cause. |
@@ -1598,8 +1596,14 @@ struct super_operations { | |||
1598 | * don't have to write inode on fdatasync() when only | 1596 | * don't have to write inode on fdatasync() when only |
1599 | * mtime has changed in it. | 1597 | * mtime has changed in it. |
1600 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. | 1598 | * I_DIRTY_PAGES Inode has dirty pages. Inode itself may be clean. |
1601 | * I_NEW get_new_inode() sets i_state to I_LOCK|I_NEW. Both | 1599 | * I_NEW Serves as both a mutex and completion notification. |
1602 | * are cleared by unlock_new_inode(), called from iget(). | 1600 | * New inodes set I_NEW. If two processes both create |
1601 | * the same inode, one of them will release its inode and | ||
1602 | * wait for I_NEW to be released before returning. | ||
1603 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1604 | * also cause waiting on I_NEW, without I_NEW actually | ||
1605 | * being set. find_inode() uses this to prevent returning | ||
1606 | * nearly-dead inodes. | ||
1603 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count | 1607 | * I_WILL_FREE Must be set when calling write_inode_now() if i_count |
1604 | * is zero. I_FREEING must be set when I_WILL_FREE is | 1608 | * is zero. I_FREEING must be set when I_WILL_FREE is |
1605 | * cleared. | 1609 | * cleared. |
@@ -1613,35 +1617,23 @@ struct super_operations { | |||
1613 | * prohibited for many purposes. iget() must wait for | 1617 | * prohibited for many purposes. iget() must wait for |
1614 | * the inode to be completely released, then create it | 1618 | * the inode to be completely released, then create it |
1615 | * anew. Other functions will just ignore such inodes, | 1619 | * anew. Other functions will just ignore such inodes, |
1616 | * if appropriate. I_LOCK is used for waiting. | 1620 | * if appropriate. I_NEW is used for waiting. |
1617 | * | 1621 | * |
1618 | * I_LOCK Serves as both a mutex and completion notification. | 1622 | * I_SYNC Synchonized write of dirty inode data. The bits is |
1619 | * New inodes set I_LOCK. If two processes both create | 1623 | * set during data writeback, and cleared with a wakeup |
1620 | * the same inode, one of them will release its inode and | 1624 | * on the bit address once it is done. |
1621 | * wait for I_LOCK to be released before returning. | ||
1622 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1623 | * also cause waiting on I_LOCK, without I_LOCK actually | ||
1624 | * being set. find_inode() uses this to prevent returning | ||
1625 | * nearly-dead inodes. | ||
1626 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | ||
1627 | * of inode dirty data. Having a separate lock for this | ||
1628 | * purpose reduces latency and prevents some filesystem- | ||
1629 | * specific deadlocks. | ||
1630 | * | 1625 | * |
1631 | * Q: What is the difference between I_WILL_FREE and I_FREEING? | 1626 | * Q: What is the difference between I_WILL_FREE and I_FREEING? |
1632 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
1633 | * I_CLEAR? If not, why? | ||
1634 | */ | 1627 | */ |
1635 | #define I_DIRTY_SYNC 1 | 1628 | #define I_DIRTY_SYNC 1 |
1636 | #define I_DIRTY_DATASYNC 2 | 1629 | #define I_DIRTY_DATASYNC 2 |
1637 | #define I_DIRTY_PAGES 4 | 1630 | #define I_DIRTY_PAGES 4 |
1638 | #define I_NEW 8 | 1631 | #define __I_NEW 3 |
1632 | #define I_NEW (1 << __I_NEW) | ||
1639 | #define I_WILL_FREE 16 | 1633 | #define I_WILL_FREE 16 |
1640 | #define I_FREEING 32 | 1634 | #define I_FREEING 32 |
1641 | #define I_CLEAR 64 | 1635 | #define I_CLEAR 64 |
1642 | #define __I_LOCK 7 | 1636 | #define __I_SYNC 7 |
1643 | #define I_LOCK (1 << __I_LOCK) | ||
1644 | #define __I_SYNC 8 | ||
1645 | #define I_SYNC (1 << __I_SYNC) | 1637 | #define I_SYNC (1 << __I_SYNC) |
1646 | 1638 | ||
1647 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) | 1639 | #define I_DIRTY (I_DIRTY_SYNC | I_DIRTY_DATASYNC | I_DIRTY_PAGES) |
@@ -2090,8 +2082,6 @@ extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | |||
2090 | extern int filemap_write_and_wait(struct address_space *mapping); | 2082 | extern int filemap_write_and_wait(struct address_space *mapping); |
2091 | extern int filemap_write_and_wait_range(struct address_space *mapping, | 2083 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
2092 | loff_t lstart, loff_t lend); | 2084 | loff_t lstart, loff_t lend); |
2093 | extern int wait_on_page_writeback_range(struct address_space *mapping, | ||
2094 | pgoff_t start, pgoff_t end); | ||
2095 | extern int __filemap_fdatawrite_range(struct address_space *mapping, | 2085 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
2096 | loff_t start, loff_t end, int sync_mode); | 2086 | loff_t start, loff_t end, int sync_mode); |
2097 | extern int filemap_fdatawrite_range(struct address_space *mapping, | 2087 | extern int filemap_fdatawrite_range(struct address_space *mapping, |
@@ -2190,7 +2180,6 @@ static inline void insert_inode_hash(struct inode *inode) { | |||
2190 | __insert_inode_hash(inode, inode->i_ino); | 2180 | __insert_inode_hash(inode, inode->i_ino); |
2191 | } | 2181 | } |
2192 | 2182 | ||
2193 | extern struct file * get_empty_filp(void); | ||
2194 | extern void file_move(struct file *f, struct list_head *list); | 2183 | extern void file_move(struct file *f, struct list_head *list); |
2195 | extern void file_kill(struct file *f); | 2184 | extern void file_kill(struct file *f); |
2196 | #ifdef CONFIG_BLOCK | 2185 | #ifdef CONFIG_BLOCK |
@@ -2265,9 +2254,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
2265 | int lock_type); | 2254 | int lock_type); |
2266 | 2255 | ||
2267 | enum { | 2256 | enum { |
2268 | DIO_LOCKING = 1, /* need locking between buffered and direct access */ | 2257 | /* need locking between buffered and direct access */ |
2269 | DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ | 2258 | DIO_LOCKING = 0x01, |
2270 | DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ | 2259 | |
2260 | /* filesystem does not support filling holes */ | ||
2261 | DIO_SKIP_HOLES = 0x02, | ||
2271 | }; | 2262 | }; |
2272 | 2263 | ||
2273 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | 2264 | static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, |
@@ -2276,7 +2267,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | |||
2276 | dio_iodone_t end_io) | 2267 | dio_iodone_t end_io) |
2277 | { | 2268 | { |
2278 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2269 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2279 | nr_segs, get_block, end_io, DIO_LOCKING); | 2270 | nr_segs, get_block, end_io, |
2271 | DIO_LOCKING | DIO_SKIP_HOLES); | ||
2280 | } | 2272 | } |
2281 | 2273 | ||
2282 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | 2274 | static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, |
@@ -2285,16 +2277,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | |||
2285 | dio_iodone_t end_io) | 2277 | dio_iodone_t end_io) |
2286 | { | 2278 | { |
2287 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2279 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2288 | nr_segs, get_block, end_io, DIO_NO_LOCKING); | 2280 | nr_segs, get_block, end_io, 0); |
2289 | } | ||
2290 | |||
2291 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, | ||
2292 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
2293 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
2294 | dio_iodone_t end_io) | ||
2295 | { | ||
2296 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | ||
2297 | nr_segs, get_block, end_io, DIO_OWN_LOCKING); | ||
2298 | } | 2281 | } |
2299 | #endif | 2282 | #endif |
2300 | 2283 | ||
@@ -2314,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
2314 | extern int generic_readlink(struct dentry *, char __user *, int); | 2297 | extern int generic_readlink(struct dentry *, char __user *, int); |
2315 | extern void generic_fillattr(struct inode *, struct kstat *); | 2298 | extern void generic_fillattr(struct inode *, struct kstat *); |
2316 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2299 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); |
2300 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | ||
2317 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2301 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2318 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2302 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
2319 | loff_t inode_get_bytes(struct inode *inode); | 2303 | loff_t inode_get_bytes(struct inode *inode); |
@@ -2479,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
2479 | 2463 | ||
2480 | int __init get_filesystem_list(char *buf); | 2464 | int __init get_filesystem_list(char *buf); |
2481 | 2465 | ||
2466 | #define ACC_MODE(x) ("\000\004\002\006"[(x)&O_ACCMODE]) | ||
2467 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
2468 | |||
2482 | #endif /* __KERNEL__ */ | 2469 | #endif /* __KERNEL__ */ |
2483 | #endif /* _LINUX_FS_H */ | 2470 | #endif /* _LINUX_FS_H */ |