Merge git://git.kvack.org/~bcrl/aio-next
authorLinus Torvalds <torvalds@linux-foundation.org>
Sun, 14 Dec 2014 21:36:57 +0000 (13:36 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 14 Dec 2014 21:36:57 +0000 (13:36 -0800)
Pull aio updates from Benjamin LaHaise.

* git://git.kvack.org/~bcrl/aio-next:
  aio: Skip timer for io_getevents if timeout=0
  aio: Make it possible to remap aio ring

1  2 
include/linux/fs.h
mm/mremap.c

diff --combined include/linux/fs.h
@@@ -18,7 -18,6 +18,7 @@@
  #include <linux/pid.h>
  #include <linux/bug.h>
  #include <linux/mutex.h>
 +#include <linux/rwsem.h>
  #include <linux/capability.h>
  #include <linux/semaphore.h>
  #include <linux/fiemap.h>
@@@ -402,7 -401,7 +402,7 @@@ struct address_space 
        atomic_t                i_mmap_writable;/* count VM_SHARED mappings */
        struct rb_root          i_mmap;         /* tree of private and shared mappings */
        struct list_head        i_mmap_nonlinear;/*list VM_NONLINEAR mappings */
 -      struct mutex            i_mmap_mutex;   /* protect tree, count, list */
 +      struct rw_semaphore     i_mmap_rwsem;   /* protect tree, count, list */
        /* Protected by tree_lock together with the radix tree */
        unsigned long           nrpages;        /* number of total pages */
        unsigned long           nrshadows;      /* number of shadow entries */
@@@ -468,26 -467,6 +468,26 @@@ struct block_device 
  
  int mapping_tagged(struct address_space *mapping, int tag);
  
 +static inline void i_mmap_lock_write(struct address_space *mapping)
 +{
 +      down_write(&mapping->i_mmap_rwsem);
 +}
 +
 +static inline void i_mmap_unlock_write(struct address_space *mapping)
 +{
 +      up_write(&mapping->i_mmap_rwsem);
 +}
 +
 +static inline void i_mmap_lock_read(struct address_space *mapping)
 +{
 +      down_read(&mapping->i_mmap_rwsem);
 +}
 +
 +static inline void i_mmap_unlock_read(struct address_space *mapping)
 +{
 +      up_read(&mapping->i_mmap_rwsem);
 +}
 +
  /*
   * Might pages of this file be mapped into userspace?
   */
@@@ -627,6 -606,9 +627,6 @@@ struct inode 
        const struct file_operations    *i_fop; /* former ->i_op->default_file_ops */
        struct file_lock        *i_flock;
        struct address_space    i_data;
 -#ifdef CONFIG_QUOTA
 -      struct dquot            *i_dquot[MAXQUOTAS];
 -#endif
        struct list_head        i_devices;
        union {
                struct pipe_inode_info  *i_pipe;
@@@ -807,6 -789,7 +807,6 @@@ struct file 
                struct rcu_head         fu_rcuhead;
        } f_u;
        struct path             f_path;
 -#define f_dentry      f_path.dentry
        struct inode            *f_inode;       /* cached value */
        const struct file_operations    *f_op;
  
@@@ -1241,7 -1224,6 +1241,7 @@@ struct super_block 
        struct backing_dev_info *s_bdi;
        struct mtd_info         *s_mtd;
        struct hlist_node       s_instances;
 +      unsigned int            s_quota_types;  /* Bitmask of supported quota types */
        struct quota_info       s_dquot;        /* Diskquota specific options */
  
        struct sb_writers       s_writers;
@@@ -1485,10 -1467,7 +1485,10 @@@ int fiemap_check_flags(struct fiemap_ex
   * This allows the kernel to read directories into kernel space or
   * to have different dirent layouts depending on the binary type.
   */
 -typedef int (*filldir_t)(void *, const char *, int, loff_t, u64, unsigned);
 +struct dir_context;
 +typedef int (*filldir_t)(struct dir_context *, const char *, int, loff_t, u64,
 +                       unsigned);
 +
  struct dir_context {
        const filldir_t actor;
        loff_t pos;
@@@ -1518,6 -1497,7 +1518,7 @@@ struct file_operations 
        long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
        long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
        int (*mmap) (struct file *, struct vm_area_struct *);
+       void (*mremap)(struct file *, struct vm_area_struct *);
        int (*open) (struct inode *, struct file *);
        int (*flush) (struct file *, fl_owner_t id);
        int (*release) (struct inode *, struct file *);
        int (*setlease)(struct file *, long, struct file_lock **, void **);
        long (*fallocate)(struct file *file, int mode, loff_t offset,
                          loff_t len);
 -      int (*show_fdinfo)(struct seq_file *m, struct file *f);
 +      void (*show_fdinfo)(struct seq_file *m, struct file *f);
  };
  
  struct inode_operations {
@@@ -1598,9 -1578,7 +1599,9 @@@ struct super_operations 
        void (*evict_inode) (struct inode *);
        void (*put_super) (struct super_block *);
        int (*sync_fs)(struct super_block *sb, int wait);
 +      int (*freeze_super) (struct super_block *);
        int (*freeze_fs) (struct super_block *);
 +      int (*thaw_super) (struct super_block *);
        int (*unfreeze_fs) (struct super_block *);
        int (*statfs) (struct dentry *, struct kstatfs *);
        int (*remount_fs) (struct super_block *, int *, char *);
  #ifdef CONFIG_QUOTA
        ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t);
        ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t);
 +      struct dquot **(*get_dquots)(struct inode *);
  #endif
        int (*bdev_try_to_free_page)(struct super_block*, struct page*, gfp_t);
        long (*nr_cached_objects)(struct super_block *, int);
@@@ -2096,7 -2073,6 +2097,7 @@@ extern int vfs_open(const struct path *
  extern struct file * dentry_open(const struct path *, int, const struct cred *);
  extern int filp_close(struct file *, fl_owner_t id);
  
 +extern struct filename *getname_flags(const char __user *, int, int *);
  extern struct filename *getname(const char __user *);
  extern struct filename *getname_kernel(const char *);
  
@@@ -2811,11 -2787,6 +2812,11 @@@ static inline void inode_has_no_xattr(s
                inode->i_flags |= S_NOSEC;
  }
  
 +static inline bool is_root_inode(struct inode *inode)
 +{
 +      return inode == inode->i_sb->s_root->d_inode;
 +}
 +
  static inline bool dir_emit(struct dir_context *ctx,
                            const char *name, int namelen,
                            u64 ino, unsigned type)
diff --combined mm/mremap.c
@@@ -99,7 -99,7 +99,7 @@@ static void move_ptes(struct vm_area_st
        spinlock_t *old_ptl, *new_ptl;
  
        /*
 -       * When need_rmap_locks is true, we take the i_mmap_mutex and anon_vma
 +       * When need_rmap_locks is true, we take the i_mmap_rwsem and anon_vma
         * locks to ensure that rmap will always observe either the old or the
         * new ptes. This is the easiest way to avoid races with
         * truncate_pagecache(), page migration, etc...
        if (need_rmap_locks) {
                if (vma->vm_file) {
                        mapping = vma->vm_file->f_mapping;
 -                      mutex_lock(&mapping->i_mmap_mutex);
 +                      i_mmap_lock_write(mapping);
                }
                if (vma->anon_vma) {
                        anon_vma = vma->anon_vma;
        if (anon_vma)
                anon_vma_unlock_write(anon_vma);
        if (mapping)
 -              mutex_unlock(&mapping->i_mmap_mutex);
 +              i_mmap_unlock_write(mapping);
  }
  
  #define LATENCY_LIMIT (64 * PAGE_SIZE)
@@@ -288,7 -288,8 +288,8 @@@ static unsigned long move_vma(struct vm
                old_len = new_len;
                old_addr = new_addr;
                new_addr = -ENOMEM;
-       }
+       } else if (vma->vm_file && vma->vm_file->f_op->mremap)
+               vma->vm_file->f_op->mremap(vma->vm_file, new_vma);
  
        /* Conceal VM_ACCOUNT so old reservation is not undone */
        if (vm_flags & VM_ACCOUNT) {