diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 72 |
1 files changed, 29 insertions, 43 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 891f7d642e5c..b1bcb275b596 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -152,6 +152,7 @@ struct inodes_stat_t { | |||
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_PLUG (WRITE | (1 << BIO_RW_SYNCIO)) | 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)) |
@@ -1094,10 +1095,6 @@ struct file_lock { | |||
1094 | 1095 | ||
1095 | 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); |
1096 | 1097 | ||
1097 | /* fs/sync.c */ | ||
1098 | extern int do_sync_mapping_range(struct address_space *mapping, loff_t offset, | ||
1099 | loff_t endbyte, unsigned int flags); | ||
1100 | |||
1101 | #ifdef CONFIG_FILE_LOCKING | 1098 | #ifdef CONFIG_FILE_LOCKING |
1102 | extern int fcntl_getlk(struct file *, struct flock __user *); | 1099 | extern int fcntl_getlk(struct file *, struct flock __user *); |
1103 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, | 1100 | extern int fcntl_setlk(unsigned int, struct file *, unsigned int, |
@@ -1590,7 +1587,7 @@ struct super_operations { | |||
1590 | * 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 |
1591 | * various stages of removing an inode. | 1588 | * various stages of removing an inode. |
1592 | * | 1589 | * |
1593 | * 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. |
1594 | * | 1591 | * |
1595 | * 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 |
1596 | * fdatasync(). i_atime is the usual cause. | 1593 | * fdatasync(). i_atime is the usual cause. |
@@ -1599,8 +1596,14 @@ struct super_operations { | |||
1599 | * don't have to write inode on fdatasync() when only | 1596 | * don't have to write inode on fdatasync() when only |
1600 | * mtime has changed in it. | 1597 | * mtime has changed in it. |
1601 | * 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. |
1602 | * 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. |
1603 | * 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. | ||
1604 | * 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 |
1605 | * 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 |
1606 | * cleared. | 1609 | * cleared. |
@@ -1614,35 +1617,23 @@ struct super_operations { | |||
1614 | * prohibited for many purposes. iget() must wait for | 1617 | * prohibited for many purposes. iget() must wait for |
1615 | * the inode to be completely released, then create it | 1618 | * the inode to be completely released, then create it |
1616 | * anew. Other functions will just ignore such inodes, | 1619 | * anew. Other functions will just ignore such inodes, |
1617 | * if appropriate. I_LOCK is used for waiting. | 1620 | * if appropriate. I_NEW is used for waiting. |
1618 | * | 1621 | * |
1619 | * I_LOCK Serves as both a mutex and completion notification. | 1622 | * I_SYNC Synchonized write of dirty inode data. The bits is |
1620 | * New inodes set I_LOCK. If two processes both create | 1623 | * set during data writeback, and cleared with a wakeup |
1621 | * the same inode, one of them will release its inode and | 1624 | * on the bit address once it is done. |
1622 | * wait for I_LOCK to be released before returning. | ||
1623 | * Inodes in I_WILL_FREE, I_FREEING or I_CLEAR state can | ||
1624 | * also cause waiting on I_LOCK, without I_LOCK actually | ||
1625 | * being set. find_inode() uses this to prevent returning | ||
1626 | * nearly-dead inodes. | ||
1627 | * I_SYNC Similar to I_LOCK, but limited in scope to writeback | ||
1628 | * of inode dirty data. Having a separate lock for this | ||
1629 | * purpose reduces latency and prevents some filesystem- | ||
1630 | * specific deadlocks. | ||
1631 | * | 1625 | * |
1632 | * 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? |
1633 | * Q: igrab() only checks on (I_FREEING|I_WILL_FREE). Should it also check on | ||
1634 | * I_CLEAR? If not, why? | ||
1635 | */ | 1627 | */ |
1636 | #define I_DIRTY_SYNC 1 | 1628 | #define I_DIRTY_SYNC 1 |
1637 | #define I_DIRTY_DATASYNC 2 | 1629 | #define I_DIRTY_DATASYNC 2 |
1638 | #define I_DIRTY_PAGES 4 | 1630 | #define I_DIRTY_PAGES 4 |
1639 | #define I_NEW 8 | 1631 | #define __I_NEW 3 |
1632 | #define I_NEW (1 << __I_NEW) | ||
1640 | #define I_WILL_FREE 16 | 1633 | #define I_WILL_FREE 16 |
1641 | #define I_FREEING 32 | 1634 | #define I_FREEING 32 |
1642 | #define I_CLEAR 64 | 1635 | #define I_CLEAR 64 |
1643 | #define __I_LOCK 7 | 1636 | #define __I_SYNC 7 |
1644 | #define I_LOCK (1 << __I_LOCK) | ||
1645 | #define __I_SYNC 8 | ||
1646 | #define I_SYNC (1 << __I_SYNC) | 1637 | #define I_SYNC (1 << __I_SYNC) |
1647 | 1638 | ||
1648 | #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) |
@@ -2091,8 +2082,6 @@ extern int filemap_fdatawait_range(struct address_space *, loff_t lstart, | |||
2091 | extern int filemap_write_and_wait(struct address_space *mapping); | 2082 | extern int filemap_write_and_wait(struct address_space *mapping); |
2092 | extern int filemap_write_and_wait_range(struct address_space *mapping, | 2083 | extern int filemap_write_and_wait_range(struct address_space *mapping, |
2093 | loff_t lstart, loff_t lend); | 2084 | loff_t lstart, loff_t lend); |
2094 | extern int wait_on_page_writeback_range(struct address_space *mapping, | ||
2095 | pgoff_t start, pgoff_t end); | ||
2096 | extern int __filemap_fdatawrite_range(struct address_space *mapping, | 2085 | extern int __filemap_fdatawrite_range(struct address_space *mapping, |
2097 | loff_t start, loff_t end, int sync_mode); | 2086 | loff_t start, loff_t end, int sync_mode); |
2098 | extern int filemap_fdatawrite_range(struct address_space *mapping, | 2087 | extern int filemap_fdatawrite_range(struct address_space *mapping, |
@@ -2191,7 +2180,6 @@ static inline void insert_inode_hash(struct inode *inode) { | |||
2191 | __insert_inode_hash(inode, inode->i_ino); | 2180 | __insert_inode_hash(inode, inode->i_ino); |
2192 | } | 2181 | } |
2193 | 2182 | ||
2194 | extern struct file * get_empty_filp(void); | ||
2195 | extern void file_move(struct file *f, struct list_head *list); | 2183 | extern void file_move(struct file *f, struct list_head *list); |
2196 | extern void file_kill(struct file *f); | 2184 | extern void file_kill(struct file *f); |
2197 | #ifdef CONFIG_BLOCK | 2185 | #ifdef CONFIG_BLOCK |
@@ -2266,9 +2254,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
2266 | int lock_type); | 2254 | int lock_type); |
2267 | 2255 | ||
2268 | enum { | 2256 | enum { |
2269 | DIO_LOCKING = 1, /* need locking between buffered and direct access */ | 2257 | /* need locking between buffered and direct access */ |
2270 | DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ | 2258 | DIO_LOCKING = 0x01, |
2271 | DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ | 2259 | |
2260 | /* filesystem does not support filling holes */ | ||
2261 | DIO_SKIP_HOLES = 0x02, | ||
2272 | }; | 2262 | }; |
2273 | 2263 | ||
2274 | 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, |
@@ -2277,7 +2267,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, | |||
2277 | dio_iodone_t end_io) | 2267 | dio_iodone_t end_io) |
2278 | { | 2268 | { |
2279 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2269 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2280 | nr_segs, get_block, end_io, DIO_LOCKING); | 2270 | nr_segs, get_block, end_io, |
2271 | DIO_LOCKING | DIO_SKIP_HOLES); | ||
2281 | } | 2272 | } |
2282 | 2273 | ||
2283 | 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, |
@@ -2286,16 +2277,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, | |||
2286 | dio_iodone_t end_io) | 2277 | dio_iodone_t end_io) |
2287 | { | 2278 | { |
2288 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | 2279 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, |
2289 | nr_segs, get_block, end_io, DIO_NO_LOCKING); | 2280 | nr_segs, get_block, end_io, 0); |
2290 | } | ||
2291 | |||
2292 | static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb, | ||
2293 | struct inode *inode, struct block_device *bdev, const struct iovec *iov, | ||
2294 | loff_t offset, unsigned long nr_segs, get_block_t get_block, | ||
2295 | dio_iodone_t end_io) | ||
2296 | { | ||
2297 | return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, | ||
2298 | nr_segs, get_block, end_io, DIO_OWN_LOCKING); | ||
2299 | } | 2281 | } |
2300 | #endif | 2282 | #endif |
2301 | 2283 | ||
@@ -2315,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations; | |||
2315 | extern int generic_readlink(struct dentry *, char __user *, int); | 2297 | extern int generic_readlink(struct dentry *, char __user *, int); |
2316 | extern void generic_fillattr(struct inode *, struct kstat *); | 2298 | extern void generic_fillattr(struct inode *, struct kstat *); |
2317 | 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); | ||
2318 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2301 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2319 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2302 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |
2320 | loff_t inode_get_bytes(struct inode *inode); | 2303 | loff_t inode_get_bytes(struct inode *inode); |
@@ -2480,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write, | |||
2480 | 2463 | ||
2481 | int __init get_filesystem_list(char *buf); | 2464 | int __init get_filesystem_list(char *buf); |
2482 | 2465 | ||
2466 | #define ACC_MODE(x) ("\004\002\006\006"[(x)&O_ACCMODE]) | ||
2467 | #define OPEN_FMODE(flag) ((__force fmode_t)((flag + 1) & O_ACCMODE)) | ||
2468 | |||
2483 | #endif /* __KERNEL__ */ | 2469 | #endif /* __KERNEL__ */ |
2484 | #endif /* _LINUX_FS_H */ | 2470 | #endif /* _LINUX_FS_H */ |