diff options
| author | Christoph Hellwig <hch@lst.de> | 2016-07-19 21:38:01 -0400 |
|---|---|---|
| committer | Dave Chinner <david@fromorbit.com> | 2016-07-19 21:38:01 -0400 |
| commit | fa8d972d055c723cc427e14d4d7919640f418730 (patch) | |
| tree | bc369f3712fa66d86563a42344282d2ce9aa08a9 | |
| parent | f1285ff0acf9040a39921355d07bd83a3308c402 (diff) | |
xfs: direct calls in the direct I/O path
We control both the callers and callees of ->direct_IO, so remove the
indirect calls.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
| -rw-r--r-- | fs/xfs/xfs_aops.c | 24 | ||||
| -rw-r--r-- | fs/xfs/xfs_aops.h | 3 | ||||
| -rw-r--r-- | fs/xfs/xfs_file.c | 17 |
3 files changed, 23 insertions, 21 deletions
diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c index 4c463b99fe57..3ba0809e0be8 100644 --- a/fs/xfs/xfs_aops.c +++ b/fs/xfs/xfs_aops.c | |||
| @@ -1336,7 +1336,7 @@ xfs_get_blocks_dax_fault( | |||
| 1336 | * whereas if we have flags set we will always be called in task context | 1336 | * whereas if we have flags set we will always be called in task context |
| 1337 | * (i.e. from a workqueue). | 1337 | * (i.e. from a workqueue). |
| 1338 | */ | 1338 | */ |
| 1339 | STATIC int | 1339 | int |
| 1340 | xfs_end_io_direct_write( | 1340 | xfs_end_io_direct_write( |
| 1341 | struct kiocb *iocb, | 1341 | struct kiocb *iocb, |
| 1342 | loff_t offset, | 1342 | loff_t offset, |
| @@ -1407,24 +1407,10 @@ xfs_vm_direct_IO( | |||
| 1407 | struct kiocb *iocb, | 1407 | struct kiocb *iocb, |
| 1408 | struct iov_iter *iter) | 1408 | struct iov_iter *iter) |
| 1409 | { | 1409 | { |
| 1410 | struct inode *inode = iocb->ki_filp->f_mapping->host; | 1410 | /* |
| 1411 | dio_iodone_t *endio = NULL; | 1411 | * We just need the method present so that open/fcntl allow direct I/O. |
| 1412 | int flags = 0; | 1412 | */ |
| 1413 | struct block_device *bdev; | 1413 | return -EINVAL; |
| 1414 | |||
| 1415 | if (iov_iter_rw(iter) == WRITE) { | ||
| 1416 | endio = xfs_end_io_direct_write; | ||
| 1417 | flags = DIO_ASYNC_EXTEND; | ||
| 1418 | } | ||
| 1419 | |||
| 1420 | if (IS_DAX(inode)) { | ||
| 1421 | return dax_do_io(iocb, inode, iter, | ||
| 1422 | xfs_get_blocks_direct, endio, 0); | ||
| 1423 | } | ||
| 1424 | |||
| 1425 | bdev = xfs_find_bdev_for_inode(inode); | ||
| 1426 | return __blockdev_direct_IO(iocb, inode, bdev, iter, | ||
| 1427 | xfs_get_blocks_direct, endio, NULL, flags); | ||
| 1428 | } | 1414 | } |
| 1429 | 1415 | ||
| 1430 | /* | 1416 | /* |
diff --git a/fs/xfs/xfs_aops.h b/fs/xfs/xfs_aops.h index 814aab790713..bf2d9a141a73 100644 --- a/fs/xfs/xfs_aops.h +++ b/fs/xfs/xfs_aops.h | |||
| @@ -60,6 +60,9 @@ int xfs_get_blocks_direct(struct inode *inode, sector_t offset, | |||
| 60 | int xfs_get_blocks_dax_fault(struct inode *inode, sector_t offset, | 60 | int xfs_get_blocks_dax_fault(struct inode *inode, sector_t offset, |
| 61 | struct buffer_head *map_bh, int create); | 61 | struct buffer_head *map_bh, int create); |
| 62 | 62 | ||
| 63 | int xfs_end_io_direct_write(struct kiocb *iocb, loff_t offset, | ||
| 64 | ssize_t size, void *private); | ||
| 65 | |||
| 63 | extern void xfs_count_page_state(struct page *, int *, int *); | 66 | extern void xfs_count_page_state(struct page *, int *, int *); |
| 64 | extern struct block_device *xfs_find_bdev_for_inode(struct inode *); | 67 | extern struct block_device *xfs_find_bdev_for_inode(struct inode *); |
| 65 | 68 | ||
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index 440bb8b5c64d..dd5185dafc9f 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
| @@ -360,7 +360,13 @@ xfs_file_dio_aio_read( | |||
| 360 | } | 360 | } |
| 361 | 361 | ||
| 362 | data = *to; | 362 | data = *to; |
| 363 | ret = mapping->a_ops->direct_IO(iocb, &data); | 363 | if (IS_DAX(inode)) { |
| 364 | ret = dax_do_io(iocb, inode, &data, xfs_get_blocks_direct, | ||
| 365 | NULL, 0); | ||
| 366 | } else { | ||
| 367 | ret = __blockdev_direct_IO(iocb, inode, target->bt_bdev, &data, | ||
| 368 | xfs_get_blocks_direct, NULL, NULL, 0); | ||
| 369 | } | ||
| 364 | if (ret > 0) { | 370 | if (ret > 0) { |
| 365 | iocb->ki_pos += ret; | 371 | iocb->ki_pos += ret; |
| 366 | iov_iter_advance(to, ret); | 372 | iov_iter_advance(to, ret); |
| @@ -819,7 +825,14 @@ xfs_file_dio_aio_write( | |||
| 819 | trace_xfs_file_direct_write(ip, count, iocb->ki_pos); | 825 | trace_xfs_file_direct_write(ip, count, iocb->ki_pos); |
| 820 | 826 | ||
| 821 | data = *from; | 827 | data = *from; |
| 822 | ret = mapping->a_ops->direct_IO(iocb, &data); | 828 | if (IS_DAX(inode)) { |
| 829 | ret = dax_do_io(iocb, inode, &data, xfs_get_blocks_direct, | ||
| 830 | xfs_end_io_direct_write, 0); | ||
| 831 | } else { | ||
| 832 | ret = __blockdev_direct_IO(iocb, inode, target->bt_bdev, &data, | ||
| 833 | xfs_get_blocks_direct, xfs_end_io_direct_write, | ||
| 834 | NULL, DIO_ASYNC_EXTEND); | ||
| 835 | } | ||
| 823 | 836 | ||
| 824 | /* see generic_file_direct_write() for why this is necessary */ | 837 | /* see generic_file_direct_write() for why this is necessary */ |
| 825 | if (mapping->nrpages) { | 838 | if (mapping->nrpages) { |
