aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-03-04 15:24:06 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:32:43 -0400
commitcb66a7a1f149ff705fa37cad6d1252b046e0ad4f (patch)
tree32dd17f294e9ef96bfea727bba313a33590917ab /fs
parent0ae5e4d370599592eab845527b31708a4f3411be (diff)
kill generic_segment_checks()
all callers of ->aio_read() and ->aio_write() have iov/nr_segs already checked - generic_segment_checks() done after that is just an odd way to spell iov_length(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/file.c7
-rw-r--r--fs/ceph/file.c13
-rw-r--r--fs/fuse/file.c7
-rw-r--r--fs/ntfs/file.c5
-rw-r--r--fs/ocfs2/file.c7
-rw-r--r--fs/xfs/xfs_file.c9
6 files changed, 9 insertions, 39 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index 1dafe0701daf..a0a94a30d85a 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -1726,12 +1726,7 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
1726 1726
1727 mutex_lock(&inode->i_mutex); 1727 mutex_lock(&inode->i_mutex);
1728 1728
1729 err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); 1729 count = ocount = iov_length(iov, nr_segs);
1730 if (err) {
1731 mutex_unlock(&inode->i_mutex);
1732 goto out;
1733 }
1734 count = ocount;
1735 1730
1736 current->backing_dev_info = inode->i_mapping->backing_dev_info; 1731 current->backing_dev_info = inode->i_mapping->backing_dev_info;
1737 err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode)); 1732 err = generic_write_checks(file, &pos, &count, S_ISBLK(inode->i_mode));
diff --git a/fs/ceph/file.c b/fs/ceph/file.c
index ef9115e4a6fa..21a56c27b74c 100644
--- a/fs/ceph/file.c
+++ b/fs/ceph/file.c
@@ -828,12 +828,8 @@ again:
828 inode, ceph_vinop(inode), iocb->ki_pos, (unsigned)len, 828 inode, ceph_vinop(inode), iocb->ki_pos, (unsigned)len,
829 ceph_cap_string(got)); 829 ceph_cap_string(got));
830 830
831 if (!read) { 831 if (!read)
832 ret = generic_segment_checks(iov, &nr_segs, 832 len = iov_length(iov, nr_segs);
833 &len, VERIFY_WRITE);
834 if (ret)
835 goto out;
836 }
837 833
838 iov_iter_init(&i, iov, nr_segs, len, read); 834 iov_iter_init(&i, iov, nr_segs, len, read);
839 835
@@ -855,7 +851,6 @@ again:
855 851
856 ret = generic_file_aio_read(iocb, iov, nr_segs, pos); 852 ret = generic_file_aio_read(iocb, iov, nr_segs, pos);
857 } 853 }
858out:
859 dout("aio_read %p %llx.%llx dropping cap refs on %s = %d\n", 854 dout("aio_read %p %llx.%llx dropping cap refs on %s = %d\n",
860 inode, ceph_vinop(inode), ceph_cap_string(got), (int)ret); 855 inode, ceph_vinop(inode), ceph_cap_string(got), (int)ret);
861 ceph_put_cap_refs(ci, got); 856 ceph_put_cap_refs(ci, got);
@@ -911,9 +906,7 @@ static ssize_t ceph_aio_write(struct kiocb *iocb, const struct iovec *iov,
911 906
912 mutex_lock(&inode->i_mutex); 907 mutex_lock(&inode->i_mutex);
913 908
914 err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ); 909 count = iov_length(iov, nr_segs);
915 if (err)
916 goto out;
917 910
918 /* We can write back this queue in page reclaim */ 911 /* We can write back this queue in page reclaim */
919 current->backing_dev_info = file->f_mapping->backing_dev_info; 912 current->backing_dev_info = file->f_mapping->backing_dev_info;
diff --git a/fs/fuse/file.c b/fs/fuse/file.c
index 126deb5d0a9c..9c7f346879e7 100644
--- a/fs/fuse/file.c
+++ b/fs/fuse/file.c
@@ -1208,12 +1208,7 @@ static ssize_t fuse_file_aio_write(struct kiocb *iocb, const struct iovec *iov,
1208 1208
1209 WARN_ON(iocb->ki_pos != pos); 1209 WARN_ON(iocb->ki_pos != pos);
1210 1210
1211 ocount = 0; 1211 count = ocount = iov_length(iov, nr_segs);
1212 err = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
1213 if (err)
1214 return err;
1215
1216 count = ocount;
1217 mutex_lock(&inode->i_mutex); 1212 mutex_lock(&inode->i_mutex);
1218 1213
1219 /* We can write back this queue in page reclaim */ 1214 /* We can write back this queue in page reclaim */
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index db9bd8a31725..b6fa457d8d01 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -2091,10 +2091,7 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb,
2091 size_t count; /* after file limit checks */ 2091 size_t count; /* after file limit checks */
2092 ssize_t written, err; 2092 ssize_t written, err;
2093 2093
2094 count = 0; 2094 count = iov_length(iov, nr_segs);
2095 err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ);
2096 if (err)
2097 return err;
2098 pos = *ppos; 2095 pos = *ppos;
2099 /* We can write back this queue in page reclaim. */ 2096 /* We can write back this queue in page reclaim. */
2100 current->backing_dev_info = mapping->backing_dev_info; 2097 current->backing_dev_info = mapping->backing_dev_info;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index d6d78c2aa96e..d33c4ced0baf 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2355,12 +2355,7 @@ relock:
2355 /* communicate with ocfs2_dio_end_io */ 2355 /* communicate with ocfs2_dio_end_io */
2356 ocfs2_iocb_set_rw_locked(iocb, rw_level); 2356 ocfs2_iocb_set_rw_locked(iocb, rw_level);
2357 2357
2358 ret = generic_segment_checks(iov, &nr_segs, &ocount, 2358 count = ocount = iov_length(iov, nr_segs);
2359 VERIFY_READ);
2360 if (ret)
2361 goto out_dio;
2362
2363 count = ocount;
2364 ret = generic_write_checks(file, ppos, &count, 2359 ret = generic_write_checks(file, ppos, &count,
2365 S_ISBLK(inode->i_mode)); 2360 S_ISBLK(inode->i_mode));
2366 if (ret) 2361 if (ret)
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
index 8617497867c7..f0f8084a67be 100644
--- a/fs/xfs/xfs_file.c
+++ b/fs/xfs/xfs_file.c
@@ -253,9 +253,7 @@ xfs_file_aio_read(
253 if (file->f_mode & FMODE_NOCMTIME) 253 if (file->f_mode & FMODE_NOCMTIME)
254 ioflags |= IO_INVIS; 254 ioflags |= IO_INVIS;
255 255
256 ret = generic_segment_checks(iovp, &nr_segs, &size, VERIFY_WRITE); 256 size = iov_length(iovp, nr_segs);
257 if (ret < 0)
258 return ret;
259 257
260 if (unlikely(ioflags & IO_ISDIRECT)) { 258 if (unlikely(ioflags & IO_ISDIRECT)) {
261 xfs_buftarg_t *target = 259 xfs_buftarg_t *target =
@@ -777,10 +775,7 @@ xfs_file_aio_write(
777 775
778 BUG_ON(iocb->ki_pos != pos); 776 BUG_ON(iocb->ki_pos != pos);
779 777
780 ret = generic_segment_checks(iovp, &nr_segs, &ocount, VERIFY_READ); 778 ocount = iov_length(iovp, nr_segs);
781 if (ret)
782 return ret;
783
784 if (ocount == 0) 779 if (ocount == 0)
785 return 0; 780 return 0;
786 781