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.h97
1 files changed, 36 insertions, 61 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 34406ed467c3..adce6e1d70c2 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -269,6 +269,7 @@ extern int dir_notify_enable;
269#include <linux/types.h> 269#include <linux/types.h>
270#include <linux/kdev_t.h> 270#include <linux/kdev_t.h>
271#include <linux/dcache.h> 271#include <linux/dcache.h>
272#include <linux/namei.h>
272#include <linux/stat.h> 273#include <linux/stat.h>
273#include <linux/cache.h> 274#include <linux/cache.h>
274#include <linux/kobject.h> 275#include <linux/kobject.h>
@@ -276,7 +277,7 @@ extern int dir_notify_enable;
276#include <linux/radix-tree.h> 277#include <linux/radix-tree.h>
277#include <linux/prio_tree.h> 278#include <linux/prio_tree.h>
278#include <linux/init.h> 279#include <linux/init.h>
279#include <linux/sched.h> 280#include <linux/pid.h>
280#include <linux/mutex.h> 281#include <linux/mutex.h>
281 282
282#include <asm/atomic.h> 283#include <asm/atomic.h>
@@ -482,21 +483,6 @@ struct block_device {
482}; 483};
483 484
484/* 485/*
485 * bdev->bd_mutex nesting subclasses for the lock validator:
486 *
487 * 0: normal
488 * 1: 'whole'
489 * 2: 'partition'
490 */
491enum bdev_bd_mutex_lock_class
492{
493 BD_MUTEX_NORMAL,
494 BD_MUTEX_WHOLE,
495 BD_MUTEX_PARTITION
496};
497
498
499/*
500 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache 486 * Radix-tree tags, for tagging dirty and writeback pages within the pagecache
501 * radix trees 487 * radix trees
502 */ 488 */
@@ -543,19 +529,22 @@ struct inode {
543 struct list_head i_dentry; 529 struct list_head i_dentry;
544 unsigned long i_ino; 530 unsigned long i_ino;
545 atomic_t i_count; 531 atomic_t i_count;
546 umode_t i_mode;
547 unsigned int i_nlink; 532 unsigned int i_nlink;
548 uid_t i_uid; 533 uid_t i_uid;
549 gid_t i_gid; 534 gid_t i_gid;
550 dev_t i_rdev; 535 dev_t i_rdev;
536 unsigned long i_version;
551 loff_t i_size; 537 loff_t i_size;
538#ifdef __NEED_I_SIZE_ORDERED
539 seqcount_t i_size_seqcount;
540#endif
552 struct timespec i_atime; 541 struct timespec i_atime;
553 struct timespec i_mtime; 542 struct timespec i_mtime;
554 struct timespec i_ctime; 543 struct timespec i_ctime;
555 unsigned int i_blkbits; 544 unsigned int i_blkbits;
556 unsigned long i_version;
557 blkcnt_t i_blocks; 545 blkcnt_t i_blocks;
558 unsigned short i_bytes; 546 unsigned short i_bytes;
547 umode_t i_mode;
559 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ 548 spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */
560 struct mutex i_mutex; 549 struct mutex i_mutex;
561 struct rw_semaphore i_alloc_sem; 550 struct rw_semaphore i_alloc_sem;
@@ -598,9 +587,6 @@ struct inode {
598 void *i_security; 587 void *i_security;
599#endif 588#endif
600 void *i_private; /* fs or device private pointer */ 589 void *i_private; /* fs or device private pointer */
601#ifdef __NEED_I_SIZE_ORDERED
602 seqcount_t i_size_seqcount;
603#endif
604}; 590};
605 591
606/* 592/*
@@ -623,6 +609,9 @@ enum inode_i_mutex_lock_class
623 I_MUTEX_QUOTA 609 I_MUTEX_QUOTA
624}; 610};
625 611
612extern void inode_double_lock(struct inode *inode1, struct inode *inode2);
613extern void inode_double_unlock(struct inode *inode1, struct inode *inode2);
614
626/* 615/*
627 * NOTE: in a 32bit arch with a preemptable kernel and 616 * NOTE: in a 32bit arch with a preemptable kernel and
628 * an UP compile the i_size_read/write must be atomic 617 * an UP compile the i_size_read/write must be atomic
@@ -633,7 +622,7 @@ enum inode_i_mutex_lock_class
633 * cmpxchg8b without the need of the lock prefix). For SMP compiles 622 * cmpxchg8b without the need of the lock prefix). For SMP compiles
634 * and 64bit archs it makes no difference if preempt is enabled or not. 623 * and 64bit archs it makes no difference if preempt is enabled or not.
635 */ 624 */
636static inline loff_t i_size_read(struct inode *inode) 625static inline loff_t i_size_read(const struct inode *inode)
637{ 626{
638#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 627#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
639 loff_t i_size; 628 loff_t i_size;
@@ -656,7 +645,11 @@ static inline loff_t i_size_read(struct inode *inode)
656#endif 645#endif
657} 646}
658 647
659 648/*
649 * NOTE: unlike i_size_read(), i_size_write() does need locking around it
650 * (normally i_mutex), otherwise on 32bit/SMP an update of i_size_seqcount
651 * can be lost, resulting in subsequent i_size_read() calls spinning forever.
652 */
660static inline void i_size_write(struct inode *inode, loff_t i_size) 653static inline void i_size_write(struct inode *inode, loff_t i_size)
661{ 654{
662#if BITS_PER_LONG==32 && defined(CONFIG_SMP) 655#if BITS_PER_LONG==32 && defined(CONFIG_SMP)
@@ -672,12 +665,12 @@ static inline void i_size_write(struct inode *inode, loff_t i_size)
672#endif 665#endif
673} 666}
674 667
675static inline unsigned iminor(struct inode *inode) 668static inline unsigned iminor(const struct inode *inode)
676{ 669{
677 return MINOR(inode->i_rdev); 670 return MINOR(inode->i_rdev);
678} 671}
679 672
680static inline unsigned imajor(struct inode *inode) 673static inline unsigned imajor(const struct inode *inode)
681{ 674{
682 return MAJOR(inode->i_rdev); 675 return MAJOR(inode->i_rdev);
683} 676}
@@ -719,8 +712,9 @@ struct file {
719 struct list_head fu_list; 712 struct list_head fu_list;
720 struct rcu_head fu_rcuhead; 713 struct rcu_head fu_rcuhead;
721 } f_u; 714 } f_u;
722 struct dentry *f_dentry; 715 struct path f_path;
723 struct vfsmount *f_vfsmnt; 716#define f_dentry f_path.dentry
717#define f_vfsmnt f_path.mnt
724 const struct file_operations *f_op; 718 const struct file_operations *f_op;
725 atomic_t f_count; 719 atomic_t f_count;
726 unsigned int f_flags; 720 unsigned int f_flags;
@@ -970,36 +964,13 @@ enum {
970#define vfs_check_frozen(sb, level) \ 964#define vfs_check_frozen(sb, level) \
971 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level))) 965 wait_event((sb)->s_wait_unfrozen, ((sb)->s_frozen < (level)))
972 966
973static inline void get_fs_excl(void) 967#define get_fs_excl() atomic_inc(&current->fs_excl)
974{ 968#define put_fs_excl() atomic_dec(&current->fs_excl)
975 atomic_inc(&current->fs_excl); 969#define has_fs_excl() atomic_read(&current->fs_excl)
976}
977
978static inline void put_fs_excl(void)
979{
980 atomic_dec(&current->fs_excl);
981}
982
983static inline int has_fs_excl(void)
984{
985 return atomic_read(&current->fs_excl);
986}
987 970
988 971/* not quite ready to be deprecated, but... */
989/* 972extern void lock_super(struct super_block *);
990 * Superblock locking. 973extern void unlock_super(struct super_block *);
991 */
992static inline void lock_super(struct super_block * sb)
993{
994 get_fs_excl();
995 mutex_lock(&sb->s_lock);
996}
997
998static inline void unlock_super(struct super_block * sb)
999{
1000 put_fs_excl();
1001 mutex_unlock(&sb->s_lock);
1002}
1003 974
1004/* 975/*
1005 * VFS helper functions.. 976 * VFS helper functions..
@@ -1255,7 +1226,7 @@ extern void touch_atime(struct vfsmount *mnt, struct dentry *dentry);
1255static inline void file_accessed(struct file *file) 1226static inline void file_accessed(struct file *file)
1256{ 1227{
1257 if (!(file->f_flags & O_NOATIME)) 1228 if (!(file->f_flags & O_NOATIME))
1258 touch_atime(file->f_vfsmnt, file->f_dentry); 1229 touch_atime(file->f_path.mnt, file->f_path.dentry);
1259} 1230}
1260 1231
1261int sync_inode(struct inode *inode, struct writeback_control *wbc); 1232int sync_inode(struct inode *inode, struct writeback_control *wbc);
@@ -1497,7 +1468,9 @@ extern char * getname(const char __user *);
1497extern void __init vfs_caches_init_early(void); 1468extern void __init vfs_caches_init_early(void);
1498extern void __init vfs_caches_init(unsigned long); 1469extern void __init vfs_caches_init(unsigned long);
1499 1470
1500#define __getname() kmem_cache_alloc(names_cachep, SLAB_KERNEL) 1471extern struct kmem_cache *names_cachep;
1472
1473#define __getname() kmem_cache_alloc(names_cachep, GFP_KERNEL)
1501#define __putname(name) kmem_cache_free(names_cachep, (void *)(name)) 1474#define __putname(name) kmem_cache_free(names_cachep, (void *)(name))
1502#ifndef CONFIG_AUDITSYSCALL 1475#ifndef CONFIG_AUDITSYSCALL
1503#define putname(name) __putname(name) 1476#define putname(name) __putname(name)
@@ -1513,7 +1486,6 @@ extern void bd_set_size(struct block_device *, loff_t size);
1513extern void bd_forget(struct inode *inode); 1486extern void bd_forget(struct inode *inode);
1514extern void bdput(struct block_device *); 1487extern void bdput(struct block_device *);
1515extern struct block_device *open_by_devnum(dev_t, unsigned); 1488extern struct block_device *open_by_devnum(dev_t, unsigned);
1516extern struct block_device *open_partition_by_devnum(dev_t, unsigned);
1517extern const struct address_space_operations def_blk_aops; 1489extern const struct address_space_operations def_blk_aops;
1518#else 1490#else
1519static inline void bd_forget(struct inode *inode) {} 1491static inline void bd_forget(struct inode *inode) {}
@@ -1531,7 +1503,6 @@ extern int blkdev_driver_ioctl(struct inode *inode, struct file *file,
1531extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long); 1503extern long compat_blkdev_ioctl(struct file *, unsigned, unsigned long);
1532extern int blkdev_get(struct block_device *, mode_t, unsigned); 1504extern int blkdev_get(struct block_device *, mode_t, unsigned);
1533extern int blkdev_put(struct block_device *); 1505extern int blkdev_put(struct block_device *);
1534extern int blkdev_put_partition(struct block_device *);
1535extern int bd_claim(struct block_device *, void *); 1506extern int bd_claim(struct block_device *, void *);
1536extern void bd_release(struct block_device *); 1507extern void bd_release(struct block_device *);
1537#ifdef CONFIG_SYSFS 1508#ifdef CONFIG_SYSFS
@@ -1646,7 +1617,7 @@ static inline void put_write_access(struct inode * inode)
1646static inline void allow_write_access(struct file *file) 1617static inline void allow_write_access(struct file *file)
1647{ 1618{
1648 if (file) 1619 if (file)
1649 atomic_inc(&file->f_dentry->d_inode->i_writecount); 1620 atomic_inc(&file->f_path.dentry->d_inode->i_writecount);
1650} 1621}
1651extern int do_pipe(int *); 1622extern int do_pipe(int *);
1652extern struct file *create_read_pipe(struct file *f); 1623extern struct file *create_read_pipe(struct file *f);
@@ -1705,6 +1676,8 @@ extern void __iget(struct inode * inode);
1705extern void clear_inode(struct inode *); 1676extern void clear_inode(struct inode *);
1706extern void destroy_inode(struct inode *); 1677extern void destroy_inode(struct inode *);
1707extern struct inode *new_inode(struct super_block *); 1678extern struct inode *new_inode(struct super_block *);
1679extern int __remove_suid(struct dentry *, int);
1680extern int should_remove_suid(struct dentry *);
1708extern int remove_suid(struct dentry *); 1681extern int remove_suid(struct dentry *);
1709extern void remove_dquot_ref(struct super_block *, int, struct list_head *); 1682extern void remove_dquot_ref(struct super_block *, int, struct list_head *);
1710 1683
@@ -1751,6 +1724,8 @@ extern ssize_t generic_file_splice_read(struct file *, loff_t *,
1751 struct pipe_inode_info *, size_t, unsigned int); 1724 struct pipe_inode_info *, size_t, unsigned int);
1752extern ssize_t generic_file_splice_write(struct pipe_inode_info *, 1725extern ssize_t generic_file_splice_write(struct pipe_inode_info *,
1753 struct file *, loff_t *, size_t, unsigned int); 1726 struct file *, loff_t *, size_t, unsigned int);
1727extern ssize_t generic_file_splice_write_nolock(struct pipe_inode_info *,
1728 struct file *, loff_t *, size_t, unsigned int);
1754extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 1729extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
1755 struct file *out, loff_t *, size_t len, unsigned int flags); 1730 struct file *out, loff_t *, size_t len, unsigned int flags);
1756extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, 1731extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,