|
@@ -3281,29 +3281,29 @@ static ssize_t ext4_ext_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
|
|
* case, we allocate an io_end structure to hook to the iocb.
|
|
* case, we allocate an io_end structure to hook to the iocb.
|
|
*/
|
|
*/
|
|
iocb->private = NULL;
|
|
iocb->private = NULL;
|
|
- ext4_inode_aio_set(inode, NULL);
|
|
|
|
- if (!is_sync_kiocb(iocb)) {
|
|
|
|
- io_end = ext4_init_io_end(inode, GFP_NOFS);
|
|
|
|
- if (!io_end) {
|
|
|
|
- ret = -ENOMEM;
|
|
|
|
- goto retake_lock;
|
|
|
|
- }
|
|
|
|
- /*
|
|
|
|
- * Grab reference for DIO. Will be dropped in ext4_end_io_dio()
|
|
|
|
- */
|
|
|
|
- iocb->private = ext4_get_io_end(io_end);
|
|
|
|
- /*
|
|
|
|
- * we save the io structure for current async direct
|
|
|
|
- * IO, so that later ext4_map_blocks() could flag the
|
|
|
|
- * io structure whether there is a unwritten extents
|
|
|
|
- * needs to be converted when IO is completed.
|
|
|
|
- */
|
|
|
|
- ext4_inode_aio_set(inode, io_end);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
if (overwrite) {
|
|
if (overwrite) {
|
|
get_block_func = ext4_get_block_overwrite;
|
|
get_block_func = ext4_get_block_overwrite;
|
|
} else {
|
|
} else {
|
|
|
|
+ ext4_inode_aio_set(inode, NULL);
|
|
|
|
+ if (!is_sync_kiocb(iocb)) {
|
|
|
|
+ io_end = ext4_init_io_end(inode, GFP_NOFS);
|
|
|
|
+ if (!io_end) {
|
|
|
|
+ ret = -ENOMEM;
|
|
|
|
+ goto retake_lock;
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * Grab reference for DIO. Will be dropped in
|
|
|
|
+ * ext4_end_io_dio()
|
|
|
|
+ */
|
|
|
|
+ iocb->private = ext4_get_io_end(io_end);
|
|
|
|
+ /*
|
|
|
|
+ * we save the io structure for current async direct
|
|
|
|
+ * IO, so that later ext4_map_blocks() could flag the
|
|
|
|
+ * io structure whether there is a unwritten extents
|
|
|
|
+ * needs to be converted when IO is completed.
|
|
|
|
+ */
|
|
|
|
+ ext4_inode_aio_set(inode, io_end);
|
|
|
|
+ }
|
|
get_block_func = ext4_get_block_write;
|
|
get_block_func = ext4_get_block_write;
|
|
dio_flags = DIO_LOCKING;
|
|
dio_flags = DIO_LOCKING;
|
|
}
|
|
}
|