diff options
author | Jens Axboe <jaxboe@fusionio.com> | 2010-06-24 09:05:37 -0400 |
---|---|---|
committer | Jens Axboe <jaxboe@fusionio.com> | 2011-03-10 02:52:26 -0500 |
commit | 55602dd66f5353981b53f734e26c307f310ced37 (patch) | |
tree | c1478f1f0fd8f8e08ce5dceb352fa6b18a534745 /mm/filemap.c | |
parent | 7eaceaccab5f40bbfda044629a6298616aeaed50 (diff) |
fs: make generic file read/write functions plug
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r-- | mm/filemap.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/filemap.c b/mm/filemap.c index 380776c2a9ac..f9a29c87a2cf 100644 --- a/mm/filemap.c +++ b/mm/filemap.c | |||
@@ -1243,12 +1243,15 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1243 | unsigned long seg = 0; | 1243 | unsigned long seg = 0; |
1244 | size_t count; | 1244 | size_t count; |
1245 | loff_t *ppos = &iocb->ki_pos; | 1245 | loff_t *ppos = &iocb->ki_pos; |
1246 | struct blk_plug plug; | ||
1246 | 1247 | ||
1247 | count = 0; | 1248 | count = 0; |
1248 | retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE); | 1249 | retval = generic_segment_checks(iov, &nr_segs, &count, VERIFY_WRITE); |
1249 | if (retval) | 1250 | if (retval) |
1250 | return retval; | 1251 | return retval; |
1251 | 1252 | ||
1253 | blk_start_plug(&plug); | ||
1254 | |||
1252 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ | 1255 | /* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ |
1253 | if (filp->f_flags & O_DIRECT) { | 1256 | if (filp->f_flags & O_DIRECT) { |
1254 | loff_t size; | 1257 | loff_t size; |
@@ -1321,6 +1324,7 @@ generic_file_aio_read(struct kiocb *iocb, const struct iovec *iov, | |||
1321 | break; | 1324 | break; |
1322 | } | 1325 | } |
1323 | out: | 1326 | out: |
1327 | blk_finish_plug(&plug); | ||
1324 | return retval; | 1328 | return retval; |
1325 | } | 1329 | } |
1326 | EXPORT_SYMBOL(generic_file_aio_read); | 1330 | EXPORT_SYMBOL(generic_file_aio_read); |
@@ -2432,11 +2436,13 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2432 | { | 2436 | { |
2433 | struct file *file = iocb->ki_filp; | 2437 | struct file *file = iocb->ki_filp; |
2434 | struct inode *inode = file->f_mapping->host; | 2438 | struct inode *inode = file->f_mapping->host; |
2439 | struct blk_plug plug; | ||
2435 | ssize_t ret; | 2440 | ssize_t ret; |
2436 | 2441 | ||
2437 | BUG_ON(iocb->ki_pos != pos); | 2442 | BUG_ON(iocb->ki_pos != pos); |
2438 | 2443 | ||
2439 | mutex_lock(&inode->i_mutex); | 2444 | mutex_lock(&inode->i_mutex); |
2445 | blk_start_plug(&plug); | ||
2440 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); | 2446 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); |
2441 | mutex_unlock(&inode->i_mutex); | 2447 | mutex_unlock(&inode->i_mutex); |
2442 | 2448 | ||
@@ -2447,6 +2453,7 @@ ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
2447 | if (err < 0 && ret > 0) | 2453 | if (err < 0 && ret > 0) |
2448 | ret = err; | 2454 | ret = err; |
2449 | } | 2455 | } |
2456 | blk_finish_plug(&plug); | ||
2450 | return ret; | 2457 | return ret; |
2451 | } | 2458 | } |
2452 | EXPORT_SYMBOL(generic_file_aio_write); | 2459 | EXPORT_SYMBOL(generic_file_aio_write); |