|
@@ -833,6 +833,13 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
|
|
|
struct f2fs_map_blocks map;
|
|
struct f2fs_map_blocks map;
|
|
|
int err = 0;
|
|
int err = 0;
|
|
|
|
|
|
|
|
|
|
+ /* convert inline data for Direct I/O*/
|
|
|
|
|
+ if (iocb->ki_flags & IOCB_DIRECT) {
|
|
|
|
|
+ err = f2fs_convert_inline_inode(inode);
|
|
|
|
|
+ if (err)
|
|
|
|
|
+ return err;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (is_inode_flag_set(inode, FI_NO_PREALLOC))
|
|
if (is_inode_flag_set(inode, FI_NO_PREALLOC))
|
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
|
@@ -845,15 +852,11 @@ int f2fs_preallocate_blocks(struct kiocb *iocb, struct iov_iter *from)
|
|
|
|
|
|
|
|
map.m_next_pgofs = NULL;
|
|
map.m_next_pgofs = NULL;
|
|
|
|
|
|
|
|
- if (iocb->ki_flags & IOCB_DIRECT) {
|
|
|
|
|
- err = f2fs_convert_inline_inode(inode);
|
|
|
|
|
- if (err)
|
|
|
|
|
- return err;
|
|
|
|
|
|
|
+ if (iocb->ki_flags & IOCB_DIRECT)
|
|
|
return f2fs_map_blocks(inode, &map, 1,
|
|
return f2fs_map_blocks(inode, &map, 1,
|
|
|
__force_buffered_io(inode, WRITE) ?
|
|
__force_buffered_io(inode, WRITE) ?
|
|
|
F2FS_GET_BLOCK_PRE_AIO :
|
|
F2FS_GET_BLOCK_PRE_AIO :
|
|
|
F2FS_GET_BLOCK_PRE_DIO);
|
|
F2FS_GET_BLOCK_PRE_DIO);
|
|
|
- }
|
|
|
|
|
if (iocb->ki_pos + iov_iter_count(from) > MAX_INLINE_DATA(inode)) {
|
|
if (iocb->ki_pos + iov_iter_count(from) > MAX_INLINE_DATA(inode)) {
|
|
|
err = f2fs_convert_inline_inode(inode);
|
|
err = f2fs_convert_inline_inode(inode);
|
|
|
if (err)
|
|
if (err)
|