Merge remote-tracking branch 'xfs-async-aio-extend' into for-next
This commit is contained in:
@@ -1194,13 +1194,19 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* For file extending writes updating i_size before data
|
* For file extending writes updating i_size before data writeouts
|
||||||
* writeouts complete can expose uninitialized blocks. So
|
* complete can expose uninitialized blocks in dumb filesystems.
|
||||||
* even for AIO, we need to wait for i/o to complete before
|
* In that case we need to wait for I/O completion even if asked
|
||||||
* returning in this case.
|
* for an asynchronous write.
|
||||||
*/
|
*/
|
||||||
dio->is_async = !is_sync_kiocb(iocb) && !((rw & WRITE) &&
|
if (is_sync_kiocb(iocb))
|
||||||
(end > i_size_read(inode)));
|
dio->is_async = false;
|
||||||
|
else if (!(dio->flags & DIO_ASYNC_EXTEND) &&
|
||||||
|
(rw & WRITE) && end > i_size_read(inode))
|
||||||
|
dio->is_async = false;
|
||||||
|
else
|
||||||
|
dio->is_async = true;
|
||||||
|
|
||||||
dio->inode = inode;
|
dio->inode = inode;
|
||||||
dio->rw = rw;
|
dio->rw = rw;
|
||||||
|
|
||||||
|
@@ -1441,7 +1441,8 @@ xfs_vm_direct_IO(
|
|||||||
ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov,
|
ret = __blockdev_direct_IO(rw, iocb, inode, bdev, iov,
|
||||||
offset, nr_segs,
|
offset, nr_segs,
|
||||||
xfs_get_blocks_direct,
|
xfs_get_blocks_direct,
|
||||||
xfs_end_io_direct_write, NULL, 0);
|
xfs_end_io_direct_write, NULL,
|
||||||
|
DIO_ASYNC_EXTEND);
|
||||||
if (ret != -EIOCBQUEUED && iocb->private)
|
if (ret != -EIOCBQUEUED && iocb->private)
|
||||||
goto out_destroy_ioend;
|
goto out_destroy_ioend;
|
||||||
} else {
|
} else {
|
||||||
|
@@ -128,7 +128,6 @@ xfs_iomap_write_direct(
|
|||||||
xfs_fsblock_t firstfsb;
|
xfs_fsblock_t firstfsb;
|
||||||
xfs_extlen_t extsz, temp;
|
xfs_extlen_t extsz, temp;
|
||||||
int nimaps;
|
int nimaps;
|
||||||
int bmapi_flag;
|
|
||||||
int quota_flag;
|
int quota_flag;
|
||||||
int rt;
|
int rt;
|
||||||
xfs_trans_t *tp;
|
xfs_trans_t *tp;
|
||||||
@@ -200,18 +199,15 @@ xfs_iomap_write_direct(
|
|||||||
|
|
||||||
xfs_trans_ijoin(tp, ip, 0);
|
xfs_trans_ijoin(tp, ip, 0);
|
||||||
|
|
||||||
bmapi_flag = 0;
|
|
||||||
if (offset < XFS_ISIZE(ip) || extsz)
|
|
||||||
bmapi_flag |= XFS_BMAPI_PREALLOC;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From this point onwards we overwrite the imap pointer that the
|
* From this point onwards we overwrite the imap pointer that the
|
||||||
* caller gave to us.
|
* caller gave to us.
|
||||||
*/
|
*/
|
||||||
xfs_bmap_init(&free_list, &firstfsb);
|
xfs_bmap_init(&free_list, &firstfsb);
|
||||||
nimaps = 1;
|
nimaps = 1;
|
||||||
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb, bmapi_flag,
|
error = xfs_bmapi_write(tp, ip, offset_fsb, count_fsb,
|
||||||
&firstfsb, 0, imap, &nimaps, &free_list);
|
XFS_BMAPI_PREALLOC, &firstfsb, 0,
|
||||||
|
imap, &nimaps, &free_list);
|
||||||
if (error)
|
if (error)
|
||||||
goto out_bmap_cancel;
|
goto out_bmap_cancel;
|
||||||
|
|
||||||
|
@@ -2527,6 +2527,9 @@ enum {
|
|||||||
|
|
||||||
/* filesystem does not support filling holes */
|
/* filesystem does not support filling holes */
|
||||||
DIO_SKIP_HOLES = 0x02,
|
DIO_SKIP_HOLES = 0x02,
|
||||||
|
|
||||||
|
/* filesystem can handle aio writes beyond i_size */
|
||||||
|
DIO_ASYNC_EXTEND = 0x04,
|
||||||
};
|
};
|
||||||
|
|
||||||
void dio_end_io(struct bio *bio, int error);
|
void dio_end_io(struct bio *bio, int error);
|
||||||
|
Reference in New Issue
Block a user