mirror of
https://github.com/raspberrypi/linux.git
synced 2026-01-04 18:27:36 +00:00
ext4: support uncached buffered I/O
Set FOP_DONTCACHE in ext4_file_operations to declare support for uncached buffered I/O. To handle this flag, update ext4_write_begin() and ext4_da_write_begin() to use write_begin_get_folio(), which encapsulates FGP_DONTCACHE logic based on iocb->ki_flags. Part of a series refactoring address_space_operations write_begin and write_end callbacks to use struct kiocb for passing write context and flags. Signed-off-by: Taotao Chen <chentaotao@didiglobal.com> Link: https://lore.kernel.org/20250716093559.217344-6-chentaotao@didiglobal.com Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
committed by
Christian Brauner
parent
b799474b9a
commit
ae21c0c0ac
@@ -1264,7 +1264,6 @@ static int ext4_write_begin(const struct kiocb *iocb,
|
||||
struct folio *folio;
|
||||
pgoff_t index;
|
||||
unsigned from, to;
|
||||
fgf_t fgp = FGP_WRITEBEGIN;
|
||||
|
||||
ret = ext4_emergency_state(inode->i_sb);
|
||||
if (unlikely(ret))
|
||||
@@ -1288,16 +1287,14 @@ static int ext4_write_begin(const struct kiocb *iocb,
|
||||
}
|
||||
|
||||
/*
|
||||
* __filemap_get_folio() can take a long time if the
|
||||
* write_begin_get_folio() can take a long time if the
|
||||
* system is thrashing due to memory pressure, or if the folio
|
||||
* is being written back. So grab it first before we start
|
||||
* the transaction handle. This also allows us to allocate
|
||||
* the folio (if needed) without using GFP_NOFS.
|
||||
*/
|
||||
retry_grab:
|
||||
fgp |= fgf_set_order(len);
|
||||
folio = __filemap_get_folio(mapping, index, fgp,
|
||||
mapping_gfp_mask(mapping));
|
||||
folio = write_begin_get_folio(iocb, mapping, index, len);
|
||||
if (IS_ERR(folio))
|
||||
return PTR_ERR(folio);
|
||||
|
||||
@@ -3046,7 +3043,6 @@ static int ext4_da_write_begin(const struct kiocb *iocb,
|
||||
struct folio *folio;
|
||||
pgoff_t index;
|
||||
struct inode *inode = mapping->host;
|
||||
fgf_t fgp = FGP_WRITEBEGIN;
|
||||
|
||||
ret = ext4_emergency_state(inode->i_sb);
|
||||
if (unlikely(ret))
|
||||
@@ -3072,9 +3068,7 @@ static int ext4_da_write_begin(const struct kiocb *iocb,
|
||||
}
|
||||
|
||||
retry:
|
||||
fgp |= fgf_set_order(len);
|
||||
folio = __filemap_get_folio(mapping, index, fgp,
|
||||
mapping_gfp_mask(mapping));
|
||||
folio = write_begin_get_folio(iocb, mapping, index, len);
|
||||
if (IS_ERR(folio))
|
||||
return PTR_ERR(folio);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user