mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-10 12:57:06 +09:00
Revert "f2fs: preserve direct write semantics when buffering is forced"
This reverts commit 82ab408329.
Change-Id: Ia0ad2463619b391a6589ba637edca394ff7b71eb
Signed-off-by: yao zhang1 <yao.zhang1@amlogic.com>
This commit is contained in:
@@ -4550,6 +4550,7 @@ static const struct iomap_dio_ops f2fs_iomap_dio_write_ops = {
|
||||
.end_io = f2fs_dio_write_end_io,
|
||||
};
|
||||
|
||||
#if !IS_ENABLED(CONFIG_AMLOGIC_F2FS_OPTIMIZATION)
|
||||
static void f2fs_flush_buffered_write(struct address_space *mapping,
|
||||
loff_t start_pos, loff_t end_pos)
|
||||
{
|
||||
@@ -4562,6 +4563,7 @@ static void f2fs_flush_buffered_write(struct address_space *mapping,
|
||||
start_pos >> PAGE_SHIFT,
|
||||
end_pos >> PAGE_SHIFT);
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,
|
||||
bool *may_need_sync)
|
||||
@@ -4661,9 +4663,20 @@ static ssize_t f2fs_dio_write_iter(struct kiocb *iocb, struct iov_iter *from,
|
||||
|
||||
ret += ret2;
|
||||
|
||||
#if IS_ENABLED(CONFIG_AMLOGIC_F2FS_OPTIMIZATION)
|
||||
ret2 = filemap_write_and_wait_range(file->f_mapping,
|
||||
bufio_start_pos,
|
||||
bufio_end_pos);
|
||||
if (ret2 < 0)
|
||||
goto out;
|
||||
invalidate_mapping_pages(file->f_mapping,
|
||||
bufio_start_pos >> PAGE_SHIFT,
|
||||
bufio_end_pos >> PAGE_SHIFT);
|
||||
#else
|
||||
f2fs_flush_buffered_write(file->f_mapping,
|
||||
bufio_start_pos,
|
||||
bufio_end_pos);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
/* iomap_dio_rw() already handled the generic_write_sync(). */
|
||||
@@ -4750,6 +4763,7 @@ out:
|
||||
if (ret > 0 && may_need_sync)
|
||||
ret = generic_write_sync(iocb, ret);
|
||||
|
||||
#if !IS_ENABLED(CONFIG_AMLOGIC_F2FS_OPTIMIZATION)
|
||||
/* If buffered IO was forced, flush and drop the data from
|
||||
* the page cache to preserve O_DIRECT semantics
|
||||
*/
|
||||
@@ -4757,6 +4771,7 @@ out:
|
||||
f2fs_flush_buffered_write(iocb->ki_filp->f_mapping,
|
||||
orig_pos,
|
||||
orig_pos + ret - 1);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user