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.h70
1 files changed, 29 insertions, 41 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a057f48eb156..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
1095extern void send_sigio(struct fown_struct *fown, int fd, int band); 1096extern void send_sigio(struct fown_struct *fown, int fd, int band);
1096 1097
1097/* fs/sync.c */
1098extern 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
1102extern int fcntl_getlk(struct file *, struct flock __user *); 1099extern int fcntl_getlk(struct file *, struct flock __user *);
1103extern int fcntl_setlk(unsigned int, struct file *, unsigned int, 1100extern 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)
@@ -2189,7 +2180,6 @@ static inline void insert_inode_hash(struct inode *inode) {
2189 __insert_inode_hash(inode, inode->i_ino); 2180 __insert_inode_hash(inode, inode->i_ino);
2190} 2181}
2191 2182
2192extern struct file * get_empty_filp(void);
2193extern void file_move(struct file *f, struct list_head *list); 2183extern void file_move(struct file *f, struct list_head *list);
2194extern void file_kill(struct file *f); 2184extern void file_kill(struct file *f);
2195#ifdef CONFIG_BLOCK 2185#ifdef CONFIG_BLOCK
@@ -2264,9 +2254,11 @@ ssize_t __blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
2264 int lock_type); 2254 int lock_type);
2265 2255
2266enum { 2256enum {
2267 DIO_LOCKING = 1, /* need locking between buffered and direct access */ 2257 /* need locking between buffered and direct access */
2268 DIO_NO_LOCKING, /* bdev; no locking at all between buffered/direct */ 2258 DIO_LOCKING = 0x01,
2269 DIO_OWN_LOCKING, /* filesystem locks buffered and direct internally */ 2259
2260 /* filesystem does not support filling holes */
2261 DIO_SKIP_HOLES = 0x02,
2270}; 2262};
2271 2263
2272static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb, 2264static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
@@ -2275,7 +2267,8 @@ static inline ssize_t blockdev_direct_IO(int rw, struct kiocb *iocb,
2275 dio_iodone_t end_io) 2267 dio_iodone_t end_io)
2276{ 2268{
2277 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2269 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2278 nr_segs, get_block, end_io, DIO_LOCKING); 2270 nr_segs, get_block, end_io,
2271 DIO_LOCKING | DIO_SKIP_HOLES);
2279} 2272}
2280 2273
2281static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb, 2274static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
@@ -2284,16 +2277,7 @@ static inline ssize_t blockdev_direct_IO_no_locking(int rw, struct kiocb *iocb,
2284 dio_iodone_t end_io) 2277 dio_iodone_t end_io)
2285{ 2278{
2286 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset, 2279 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2287 nr_segs, get_block, end_io, DIO_NO_LOCKING); 2280 nr_segs, get_block, end_io, 0);
2288}
2289
2290static inline ssize_t blockdev_direct_IO_own_locking(int rw, struct kiocb *iocb,
2291 struct inode *inode, struct block_device *bdev, const struct iovec *iov,
2292 loff_t offset, unsigned long nr_segs, get_block_t get_block,
2293 dio_iodone_t end_io)
2294{
2295 return __blockdev_direct_IO(rw, iocb, inode, bdev, iov, offset,
2296 nr_segs, get_block, end_io, DIO_OWN_LOCKING);
2297} 2281}
2298#endif 2282#endif
2299 2283
@@ -2313,6 +2297,7 @@ extern const struct inode_operations page_symlink_inode_operations;
2313extern int generic_readlink(struct dentry *, char __user *, int); 2297extern int generic_readlink(struct dentry *, char __user *, int);
2314extern void generic_fillattr(struct inode *, struct kstat *); 2298extern void generic_fillattr(struct inode *, struct kstat *);
2315extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2299extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
2300void __inode_add_bytes(struct inode *inode, loff_t bytes);
2316void inode_add_bytes(struct inode *inode, loff_t bytes); 2301void inode_add_bytes(struct inode *inode, loff_t bytes);
2317void inode_sub_bytes(struct inode *inode, loff_t bytes); 2302void inode_sub_bytes(struct inode *inode, loff_t bytes);
2318loff_t inode_get_bytes(struct inode *inode); 2303loff_t inode_get_bytes(struct inode *inode);
@@ -2478,5 +2463,8 @@ int proc_nr_files(struct ctl_table *table, int write,
2478 2463
2479int __init get_filesystem_list(char *buf); 2464int __init get_filesystem_list(char *buf);
2480 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
2481#endif /* __KERNEL__ */ 2469#endif /* __KERNEL__ */
2482#endif /* _LINUX_FS_H */ 2470#endif /* _LINUX_FS_H */