diff options
author | Dave Chinner <dchinner@redhat.com> | 2012-06-08 01:45:44 -0400 |
---|---|---|
committer | Ben Myers <bpm@sgi.com> | 2012-06-14 13:28:25 -0400 |
commit | 5276432997feb2366ac1e77949e94fe86a394813 (patch) | |
tree | d0baa43c4163d417da717606cfa2d065cdc80515 /fs/xfs | |
parent | 32972383ca46223aa2b129826b3789721ec147aa (diff) |
xfs: kill copy and paste segment checks in xfs_file_aio_read
The generic segment check code now returns a count of the number of
bytes in the iovec, so we don't need to roll our own anymore.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r-- | fs/xfs/xfs_file.c | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 59e22c989cd4..c4559c6e6f2c 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -236,7 +236,6 @@ xfs_file_aio_read( | |||
236 | ssize_t ret = 0; | 236 | ssize_t ret = 0; |
237 | int ioflags = 0; | 237 | int ioflags = 0; |
238 | xfs_fsize_t n; | 238 | xfs_fsize_t n; |
239 | unsigned long seg; | ||
240 | 239 | ||
241 | XFS_STATS_INC(xs_read_calls); | 240 | XFS_STATS_INC(xs_read_calls); |
242 | 241 | ||
@@ -247,19 +246,9 @@ xfs_file_aio_read( | |||
247 | if (file->f_mode & FMODE_NOCMTIME) | 246 | if (file->f_mode & FMODE_NOCMTIME) |
248 | ioflags |= IO_INVIS; | 247 | ioflags |= IO_INVIS; |
249 | 248 | ||
250 | /* START copy & waste from filemap.c */ | 249 | ret = generic_segment_checks(iovp, &nr_segs, &size, VERIFY_WRITE); |
251 | for (seg = 0; seg < nr_segs; seg++) { | 250 | if (ret < 0) |
252 | const struct iovec *iv = &iovp[seg]; | 251 | return ret; |
253 | |||
254 | /* | ||
255 | * If any segment has a negative length, or the cumulative | ||
256 | * length ever wraps negative then return -EINVAL. | ||
257 | */ | ||
258 | size += iv->iov_len; | ||
259 | if (unlikely((ssize_t)(size|iv->iov_len) < 0)) | ||
260 | return XFS_ERROR(-EINVAL); | ||
261 | } | ||
262 | /* END copy & waste from filemap.c */ | ||
263 | 252 | ||
264 | if (unlikely(ioflags & IO_ISDIRECT)) { | 253 | if (unlikely(ioflags & IO_ISDIRECT)) { |
265 | xfs_buftarg_t *target = | 254 | xfs_buftarg_t *target = |