]> Pileus Git - ~andy/linux/blobdiff - include/linux/fs.h
vfs: rename I_MUTEX_QUOTA now that it's not used for quotas
[~andy/linux] / include / linux / fs.h
index 3f40547ba1917cd038f085bcdb6c6e577a9d4538..ed7f94af1ab2a867dddd1dc0fc9e9e91f5afa040 100644 (file)
@@ -623,10 +623,13 @@ static inline int inode_unhashed(struct inode *inode)
  * 0: the object of the current VFS operation
  * 1: parent
  * 2: child/target
- * 3: quota file
+ * 3: xattr
+ * 4: second non-directory
+ * The last is for certain operations (such as rename) which lock two
+ * non-directories at once.
  *
  * The locking order between these classes is
- * parent -> child -> normal -> xattr -> quota
+ * parent -> child -> normal -> xattr -> second non-directory
  */
 enum inode_i_mutex_lock_class
 {
@@ -634,9 +637,12 @@ enum inode_i_mutex_lock_class
        I_MUTEX_PARENT,
        I_MUTEX_CHILD,
        I_MUTEX_XATTR,
-       I_MUTEX_QUOTA
+       I_MUTEX_NONDIR2
 };
 
+void lock_two_nondirectories(struct inode *, struct inode*);
+void unlock_two_nondirectories(struct inode *, struct inode*);
+
 /*
  * NOTE: in a 32bit arch with a preemptable kernel and
  * an UP compile the i_size_read/write must be atomic
@@ -764,12 +770,7 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)
 #define FILE_MNT_WRITE_RELEASED        2
 
 struct file {
-       /*
-        * fu_list becomes invalid after file_free is called and queued via
-        * fu_rcuhead for RCU freeing
-        */
        union {
-               struct list_head        fu_list;
                struct llist_node       fu_llist;
                struct rcu_head         fu_rcuhead;
        } f_u;
@@ -783,9 +784,6 @@ struct file {
         * Must not be taken from IRQ context.
         */
        spinlock_t              f_lock;
-#ifdef CONFIG_SMP
-       int                     f_sb_list_cpu;
-#endif
        atomic_long_t           f_count;
        unsigned int            f_flags;
        fmode_t                 f_mode;
@@ -1264,11 +1262,6 @@ struct super_block {
 
        struct list_head        s_inodes;       /* all inodes */
        struct hlist_bl_head    s_anon;         /* anonymous dentries for (nfs) exporting */
-#ifdef CONFIG_SMP
-       struct list_head __percpu *s_files;
-#else
-       struct list_head        s_files;
-#endif
        struct list_head        s_mounts;       /* list of mounts; _not_ for fs use */
        struct block_device     *s_bdev;
        struct backing_dev_info *s_bdi;
@@ -1330,6 +1323,7 @@ struct super_block {
         */
        struct list_lru         s_dentry_lru ____cacheline_aligned_in_smp;
        struct list_lru         s_inode_lru ____cacheline_aligned_in_smp;
+       struct rcu_head         rcu;
 };
 
 extern struct timespec current_fs_time(struct super_block *sb);
@@ -1875,6 +1869,17 @@ extern struct dentry *mount_pseudo(struct file_system_type *, char *,
        (((fops) && try_module_get((fops)->owner) ? (fops) : NULL))
 #define fops_put(fops) \
        do { if (fops) module_put((fops)->owner); } while(0)
+/*
+ * This one is to be used *ONLY* from ->open() instances.
+ * fops must be non-NULL, pinned down *and* module dependencies
+ * should be sufficient to pin the caller down as well.
+ */
+#define replace_fops(f, fops) \
+       do {    \
+               struct file *__file = (f); \
+               fops_put(__file->f_op); \
+               BUG_ON(!(__file->f_op = (fops))); \
+       } while(0)
 
 extern int register_filesystem(struct file_system_type *);
 extern int unregister_filesystem(struct file_system_type *);
@@ -2502,8 +2507,10 @@ extern int __page_symlink(struct inode *inode, const char *symname, int len,
                int nofs);
 extern int page_symlink(struct inode *inode, const char *symname, int len);
 extern const struct inode_operations page_symlink_inode_operations;
+extern void kfree_put_link(struct dentry *, struct nameidata *, void *);
 extern int generic_readlink(struct dentry *, char __user *, int);
 extern void generic_fillattr(struct inode *, struct kstat *);
+int vfs_getattr_nosec(struct path *path, struct kstat *stat);
 extern int vfs_getattr(struct path *, struct kstat *);
 void __inode_add_bytes(struct inode *inode, loff_t bytes);
 void inode_add_bytes(struct inode *inode, loff_t bytes);
@@ -2562,6 +2569,7 @@ extern int simple_write_begin(struct file *file, struct address_space *mapping,
 extern int simple_write_end(struct file *file, struct address_space *mapping,
                        loff_t pos, unsigned len, unsigned copied,
                        struct page *page, void *fsdata);
+extern struct inode *alloc_anon_inode(struct super_block *);
 
 extern struct dentry *simple_lookup(struct inode *, struct dentry *, unsigned int flags);
 extern ssize_t generic_read_dir(struct file *, char __user *, size_t, loff_t *);