summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2015-04-16 23:27:56 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2015-04-16 23:27:56 -0400
commit4fc8adcfec3da639da76e8314c9ccefe5bf9a045 (patch)
treee07a2dea8acf04d8bbbecd4fd3a571653ecdd953 /fs/btrfs/inode.c
parent84588e7a5d8220446d677d7b909a20ee7a4496b9 (diff)
parentaa4d86163e4e91a1ac560954a554bab417e338f4 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull third hunk of vfs changes from Al Viro: "This contains the ->direct_IO() changes from Omar + saner generic_write_checks() + dealing with fcntl()/{read,write}() races (mirroring O_APPEND/O_DIRECT into iocb->ki_flags and instead of repeatedly looking at ->f_flags, which can be changed by fcntl(2), check ->ki_flags - which cannot) + infrastructure bits for dhowells' d_inode annotations + Christophs switch of /dev/loop to vfs_iter_write()" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (30 commits) block: loop: switch to VFS ITER_BVEC configfs: Fix inconsistent use of file_inode() vs file->f_path.dentry->d_inode VFS: Make pathwalk use d_is_reg() rather than S_ISREG() VFS: Fix up debugfs to use d_is_dir() in place of S_ISDIR() VFS: Combine inode checks with d_is_negative() and d_is_positive() in pathwalk NFS: Don't use d_inode as a variable name VFS: Impose ordering on accesses of d_inode and d_flags VFS: Add owner-filesystem positive/negative dentry checks nfs: generic_write_checks() shouldn't be done on swapout... ocfs2: use __generic_file_write_iter() mirror O_APPEND and O_DIRECT into iocb->ki_flags switch generic_write_checks() to iocb and iter ocfs2: move generic_write_checks() before the alignment checks ocfs2_file_write_iter: stop messing with ppos udf_file_write_iter: reorder and simplify fuse: ->direct_IO() doesn't need generic_write_checks() ext4_file_write_iter: move generic_write_checks() up xfs_file_aio_write_checks: switch to iocb/iov_iter generic_write_checks(): drop isblk argument blkdev_write_iter: expand generic_file_checks() call in there ...
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 686331f22b15..43192e10cc43 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8081,7 +8081,7 @@ free_ordered:
8081 bio_endio(dio_bio, ret); 8081 bio_endio(dio_bio, ret);
8082} 8082}
8083 8083
8084static ssize_t check_direct_IO(struct btrfs_root *root, int rw, struct kiocb *iocb, 8084static ssize_t check_direct_IO(struct btrfs_root *root, struct kiocb *iocb,
8085 const struct iov_iter *iter, loff_t offset) 8085 const struct iov_iter *iter, loff_t offset)
8086{ 8086{
8087 int seg; 8087 int seg;
@@ -8096,7 +8096,7 @@ static ssize_t check_direct_IO(struct btrfs_root *root, int rw, struct kiocb *io
8096 goto out; 8096 goto out;
8097 8097
8098 /* If this is a write we don't need to check anymore */ 8098 /* If this is a write we don't need to check anymore */
8099 if (rw & WRITE) 8099 if (iov_iter_rw(iter) == WRITE)
8100 return 0; 8100 return 0;
8101 /* 8101 /*
8102 * Check to make sure we don't have duplicate iov_base's in this 8102 * Check to make sure we don't have duplicate iov_base's in this
@@ -8114,8 +8114,8 @@ out:
8114 return retval; 8114 return retval;
8115} 8115}
8116 8116
8117static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb, 8117static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
8118 struct iov_iter *iter, loff_t offset) 8118 loff_t offset)
8119{ 8119{
8120 struct file *file = iocb->ki_filp; 8120 struct file *file = iocb->ki_filp;
8121 struct inode *inode = file->f_mapping->host; 8121 struct inode *inode = file->f_mapping->host;
@@ -8126,7 +8126,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
8126 bool relock = false; 8126 bool relock = false;
8127 ssize_t ret; 8127 ssize_t ret;
8128 8128
8129 if (check_direct_IO(BTRFS_I(inode)->root, rw, iocb, iter, offset)) 8129 if (check_direct_IO(BTRFS_I(inode)->root, iocb, iter, offset))
8130 return 0; 8130 return 0;
8131 8131
8132 atomic_inc(&inode->i_dio_count); 8132 atomic_inc(&inode->i_dio_count);
@@ -8144,7 +8144,7 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
8144 filemap_fdatawrite_range(inode->i_mapping, offset, 8144 filemap_fdatawrite_range(inode->i_mapping, offset,
8145 offset + count - 1); 8145 offset + count - 1);
8146 8146
8147 if (rw & WRITE) { 8147 if (iov_iter_rw(iter) == WRITE) {
8148 /* 8148 /*
8149 * If the write DIO is beyond the EOF, we need update 8149 * If the write DIO is beyond the EOF, we need update
8150 * the isize, but it is protected by i_mutex. So we can 8150 * the isize, but it is protected by i_mutex. So we can
@@ -8174,11 +8174,11 @@ static ssize_t btrfs_direct_IO(int rw, struct kiocb *iocb,
8174 wakeup = false; 8174 wakeup = false;
8175 } 8175 }
8176 8176
8177 ret = __blockdev_direct_IO(rw, iocb, inode, 8177 ret = __blockdev_direct_IO(iocb, inode,
8178 BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev, 8178 BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev,
8179 iter, offset, btrfs_get_blocks_direct, NULL, 8179 iter, offset, btrfs_get_blocks_direct, NULL,
8180 btrfs_submit_direct, flags); 8180 btrfs_submit_direct, flags);
8181 if (rw & WRITE) { 8181 if (iov_iter_rw(iter) == WRITE) {
8182 current->journal_info = NULL; 8182 current->journal_info = NULL;
8183 if (ret < 0 && ret != -EIOCBQUEUED) 8183 if (ret < 0 && ret != -EIOCBQUEUED)
8184 btrfs_delalloc_release_space(inode, count); 8184 btrfs_delalloc_release_space(inode, count);