Merge branch 'work.copy_file_range' of git://git.kernel.org/pub/scm/linux/kernel...
authorLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Jan 2016 00:30:34 +0000 (16:30 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 13 Jan 2016 00:30:34 +0000 (16:30 -0800)
Pull vfs copy_file_range updates from Al Viro:
 "Several series around copy_file_range/CLONE"

* 'work.copy_file_range' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  btrfs: use new dedupe data function pointer
  vfs: hoist the btrfs deduplication ioctl to the vfs
  vfs: wire up compat ioctl for CLONE/CLONE_RANGE
  cifs: avoid unused variable and label
  nfsd: implement the NFSv4.2 CLONE operation
  nfsd: Pass filehandle to nfs4_preprocess_stateid_op()
  vfs: pull btrfs clone API to vfs layer
  locks: new locks_mandatory_area calling convention
  vfs: Add vfs_copy_file_range() support for pagecache copies
  btrfs: add .copy_file_range file operation
  x86: add sys_copy_file_range to syscall tables
  vfs: add copy_file_range syscall and vfs helper

1  2 
fs/btrfs/file.c
fs/cifs/cifsfs.c
fs/cifs/cifsfs.h
fs/compat_ioctl.c
fs/ioctl.c
fs/locks.c
include/linux/fs.h

diff --cc fs/btrfs/file.c
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc fs/ioctl.c
Simple merge
diff --cc fs/locks.c
Simple merge
@@@ -2027,12 -2039,9 +2039,9 @@@ extern struct kobject *fs_kobj
  
  #define MAX_RW_COUNT (INT_MAX & PAGE_CACHE_MASK)
  
- #define FLOCK_VERIFY_READ  1
- #define FLOCK_VERIFY_WRITE 2
 -#ifdef CONFIG_FILE_LOCKING
 +#ifdef CONFIG_MANDATORY_FILE_LOCKING
  extern int locks_mandatory_locked(struct file *);
- extern int locks_mandatory_area(int, struct inode *, struct file *, loff_t, size_t);
+ extern int locks_mandatory_area(struct inode *, struct file *, loff_t, loff_t, unsigned char);
  
  /*
   * Candidates for mandatory locking have the setgid bit set
@@@ -2062,58 -2071,21 +2071,59 @@@ static inline int locks_verify_locked(s
  }
  
  static inline int locks_verify_truncate(struct inode *inode,
-                                   struct file *filp,
+                                   struct file *f,
                                    loff_t size)
  {
-       if (inode->i_flctx && mandatory_lock(inode))
-               return locks_mandatory_area(
-                       FLOCK_VERIFY_WRITE, inode, filp,
-                       size < inode->i_size ? size : inode->i_size,
-                       (size < inode->i_size ? inode->i_size - size
-                        : size - inode->i_size)
-               );
-       return 0;
+       if (!inode->i_flctx || !mandatory_lock(inode))
+               return 0;
+       if (size < inode->i_size) {
+               return locks_mandatory_area(inode, f, size, inode->i_size - 1,
+                               F_WRLCK);
+       } else {
+               return locks_mandatory_area(inode, f, inode->i_size, size - 1,
+                               F_WRLCK);
+       }
  }
  
- static inline int locks_mandatory_area(int rw, struct inode *inode,
-                                      struct file *filp, loff_t offset,
-                                      size_t count)
 +#else /* !CONFIG_MANDATORY_FILE_LOCKING */
 +
 +static inline int locks_mandatory_locked(struct file *file)
 +{
 +      return 0;
 +}
 +
++static inline int locks_mandatory_area(struct inode *inode, struct file *filp,
++                                       loff_t start, loff_t end, unsigned char type)
 +{
 +      return 0;
 +}
 +
 +static inline int __mandatory_lock(struct inode *inode)
 +{
 +      return 0;
 +}
 +
 +static inline int mandatory_lock(struct inode *inode)
 +{
 +      return 0;
 +}
 +
 +static inline int locks_verify_locked(struct file *file)
 +{
 +      return 0;
 +}
 +
 +static inline int locks_verify_truncate(struct inode *inode, struct file *filp,
 +                                      size_t size)
 +{
 +      return 0;
 +}
 +
 +#endif /* CONFIG_MANDATORY_FILE_LOCKING */
 +
 +
 +#ifdef CONFIG_FILE_LOCKING
  static inline int break_lease(struct inode *inode, unsigned int mode)
  {
        /*