fs: change write_begin/write_end interface to take struct kiocb *
Change the address_space_operations callbacks write_begin() and write_end() to take struct kiocb * as the first argument instead of struct file *. Update all affected function prototypes, implementations, call sites, and related documentation across VFS, filesystems, and block layer. 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-4-chentaotao@didiglobal.com Signed-off-by: Christian Brauner <brauner@kernel.org>pull/1309/head
parent
048832a3f4
commit
e9d8e2bf23
|
|
@ -253,10 +253,10 @@ prototypes::
|
|||
int (*writepages)(struct address_space *, struct writeback_control *);
|
||||
bool (*dirty_folio)(struct address_space *, struct folio *folio);
|
||||
void (*readahead)(struct readahead_control *);
|
||||
int (*write_begin)(struct file *, struct address_space *mapping,
|
||||
int (*write_begin)(const struct kiocb *, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata);
|
||||
int (*write_end)(struct file *, struct address_space *mapping,
|
||||
int (*write_end)(const struct kiocb *, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata);
|
||||
sector_t (*bmap)(struct address_space *, sector_t);
|
||||
|
|
|
|||
|
|
@ -823,10 +823,10 @@ cache in your filesystem. The following members are defined:
|
|||
int (*writepages)(struct address_space *, struct writeback_control *);
|
||||
bool (*dirty_folio)(struct address_space *, struct folio *);
|
||||
void (*readahead)(struct readahead_control *);
|
||||
int (*write_begin)(struct file *, struct address_space *mapping,
|
||||
int (*write_begin)(const struct kiocb *, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct page **pagep, void **fsdata);
|
||||
int (*write_end)(struct file *, struct address_space *mapping,
|
||||
struct page **pagep, void **fsdata);
|
||||
int (*write_end)(const struct kiocb *, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata);
|
||||
sector_t (*bmap)(struct address_space *, sector_t);
|
||||
|
|
|
|||
13
block/fops.c
13
block/fops.c
|
|
@ -496,15 +496,18 @@ static void blkdev_readahead(struct readahead_control *rac)
|
|||
mpage_readahead(rac, blkdev_get_block);
|
||||
}
|
||||
|
||||
static int blkdev_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
|
||||
static int blkdev_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
unsigned len, struct folio **foliop,
|
||||
void **fsdata)
|
||||
{
|
||||
return block_write_begin(mapping, pos, len, foliop, blkdev_get_block);
|
||||
}
|
||||
|
||||
static int blkdev_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied, struct folio *folio,
|
||||
void *fsdata)
|
||||
static int blkdev_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
int ret;
|
||||
ret = block_write_end(pos, len, copied, folio);
|
||||
|
|
|
|||
|
|
@ -53,13 +53,14 @@ static void adfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
truncate_pagecache(inode, inode->i_size);
|
||||
}
|
||||
|
||||
static int adfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int adfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
|
||||
ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata,
|
||||
adfs_get_block,
|
||||
&ADFS_I(mapping->host)->mmu_private);
|
||||
if (unlikely(ret))
|
||||
|
|
|
|||
|
|
@ -415,13 +415,14 @@ affs_direct_IO(struct kiocb *iocb, struct iov_iter *iter)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int affs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int affs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
|
||||
ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata,
|
||||
affs_get_block,
|
||||
&AFFS_I(mapping->host)->mmu_private);
|
||||
if (unlikely(ret))
|
||||
|
|
@ -430,14 +431,15 @@ static int affs_write_begin(struct file *file, struct address_space *mapping,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int affs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned int len, unsigned int copied,
|
||||
static int affs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
unsigned int len, unsigned int copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
int ret;
|
||||
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
|
||||
/* Clear Archived bit on file writes, as AmigaOS would do */
|
||||
if (AFFS_I(inode)->i_protect & FIBF_ARCHIVED) {
|
||||
|
|
@ -645,7 +647,8 @@ static int affs_read_folio_ofs(struct file *file, struct folio *folio)
|
|||
return err;
|
||||
}
|
||||
|
||||
static int affs_write_begin_ofs(struct file *file, struct address_space *mapping,
|
||||
static int affs_write_begin_ofs(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -684,9 +687,10 @@ static int affs_write_begin_ofs(struct file *file, struct address_space *mapping
|
|||
return err;
|
||||
}
|
||||
|
||||
static int affs_write_end_ofs(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int affs_write_end_ofs(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct super_block *sb = inode->i_sb;
|
||||
|
|
|
|||
|
|
@ -674,7 +674,7 @@ int bch2_writepages(struct address_space *mapping, struct writeback_control *wbc
|
|||
|
||||
/* buffered writes: */
|
||||
|
||||
int bch2_write_begin(struct file *file, struct address_space *mapping,
|
||||
int bch2_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -757,7 +757,7 @@ err_unlock:
|
|||
return bch2_err_class(ret);
|
||||
}
|
||||
|
||||
int bch2_write_end(struct file *file, struct address_space *mapping,
|
||||
int bch2_write_end(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ int bch2_read_folio(struct file *, struct folio *);
|
|||
int bch2_writepages(struct address_space *, struct writeback_control *);
|
||||
void bch2_readahead(struct readahead_control *);
|
||||
|
||||
int bch2_write_begin(struct file *, struct address_space *, loff_t pos,
|
||||
int bch2_write_begin(const struct kiocb *, struct address_space *, loff_t pos,
|
||||
unsigned len, struct folio **, void **);
|
||||
int bch2_write_end(struct file *, struct address_space *, loff_t,
|
||||
int bch2_write_end(const struct kiocb *, struct address_space *, loff_t,
|
||||
unsigned len, unsigned copied, struct folio *, void *);
|
||||
|
||||
ssize_t bch2_write_iter(struct kiocb *, struct iov_iter *);
|
||||
|
|
|
|||
|
|
@ -170,9 +170,10 @@ static void bfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
truncate_pagecache(inode, inode->i_size);
|
||||
}
|
||||
|
||||
static int bfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int bfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
26
fs/buffer.c
26
fs/buffer.c
|
|
@ -2297,9 +2297,9 @@ int block_write_end(loff_t pos, unsigned len, unsigned copied,
|
|||
}
|
||||
EXPORT_SYMBOL(block_write_end);
|
||||
|
||||
int generic_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
int generic_write_end(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
loff_t old_size = inode->i_size;
|
||||
|
|
@ -2494,7 +2494,8 @@ out:
|
|||
}
|
||||
EXPORT_SYMBOL(generic_cont_expand_simple);
|
||||
|
||||
static int cont_expand_zero(struct file *file, struct address_space *mapping,
|
||||
static int cont_expand_zero(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, loff_t *bytes)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
|
|
@ -2518,12 +2519,12 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
|
|||
}
|
||||
len = PAGE_SIZE - zerofrom;
|
||||
|
||||
err = aops->write_begin(file, mapping, curpos, len,
|
||||
err = aops->write_begin(iocb, mapping, curpos, len,
|
||||
&folio, &fsdata);
|
||||
if (err)
|
||||
goto out;
|
||||
folio_zero_range(folio, offset_in_folio(folio, curpos), len);
|
||||
err = aops->write_end(file, mapping, curpos, len, len,
|
||||
err = aops->write_end(iocb, mapping, curpos, len, len,
|
||||
folio, fsdata);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
|
@ -2551,12 +2552,12 @@ static int cont_expand_zero(struct file *file, struct address_space *mapping,
|
|||
}
|
||||
len = offset - zerofrom;
|
||||
|
||||
err = aops->write_begin(file, mapping, curpos, len,
|
||||
err = aops->write_begin(iocb, mapping, curpos, len,
|
||||
&folio, &fsdata);
|
||||
if (err)
|
||||
goto out;
|
||||
folio_zero_range(folio, offset_in_folio(folio, curpos), len);
|
||||
err = aops->write_end(file, mapping, curpos, len, len,
|
||||
err = aops->write_end(iocb, mapping, curpos, len, len,
|
||||
folio, fsdata);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
|
|
@ -2571,17 +2572,16 @@ out:
|
|||
* For moronic filesystems that do not allow holes in file.
|
||||
* We may have to extend the file.
|
||||
*/
|
||||
int cont_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata,
|
||||
get_block_t *get_block, loff_t *bytes)
|
||||
int cont_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop,
|
||||
void **fsdata, get_block_t *get_block, loff_t *bytes)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
unsigned int blocksize = i_blocksize(inode);
|
||||
unsigned int zerofrom;
|
||||
int err;
|
||||
|
||||
err = cont_expand_zero(file, mapping, pos, bytes);
|
||||
err = cont_expand_zero(iocb, mapping, pos, bytes);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
|
|
|
|||
|
|
@ -1864,10 +1864,12 @@ static int ceph_netfs_check_write_begin(struct file *file, loff_t pos, unsigned
|
|||
* We are only allowed to write into/dirty the page if the page is
|
||||
* clean, or already dirty within the same snap context.
|
||||
*/
|
||||
static int ceph_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int ceph_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_inode_info *ci = ceph_inode(inode);
|
||||
int r;
|
||||
|
|
@ -1885,10 +1887,12 @@ static int ceph_write_begin(struct file *file, struct address_space *mapping,
|
|||
* we don't do anything in here that simple_write_end doesn't do
|
||||
* except adjust dirty page accounting
|
||||
*/
|
||||
static int ceph_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
static int ceph_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct ceph_client *cl = ceph_inode_to_client(inode);
|
||||
bool check_cap = false;
|
||||
|
|
|
|||
|
|
@ -228,7 +228,7 @@ out:
|
|||
|
||||
/**
|
||||
* ecryptfs_write_begin
|
||||
* @file: The eCryptfs file
|
||||
* @iocb: I/O control block for the eCryptfs file
|
||||
* @mapping: The eCryptfs object
|
||||
* @pos: The file offset at which to start writing
|
||||
* @len: Length of the write
|
||||
|
|
@ -239,7 +239,7 @@ out:
|
|||
*
|
||||
* Returns zero on success; non-zero otherwise
|
||||
*/
|
||||
static int ecryptfs_write_begin(struct file *file,
|
||||
static int ecryptfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
|
|
@ -322,7 +322,7 @@ static int ecryptfs_write_begin(struct file *file,
|
|||
* Note, this will increase i_size. */
|
||||
if (index != 0) {
|
||||
if (prev_page_end_size > i_size_read(mapping->host)) {
|
||||
rc = ecryptfs_truncate(file->f_path.dentry,
|
||||
rc = ecryptfs_truncate(iocb->ki_filp->f_path.dentry,
|
||||
prev_page_end_size);
|
||||
if (rc) {
|
||||
printk(KERN_ERR "%s: Error on attempt to "
|
||||
|
|
@ -429,7 +429,7 @@ int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode)
|
|||
|
||||
/**
|
||||
* ecryptfs_write_end
|
||||
* @file: The eCryptfs file object
|
||||
* @iocb: I/O control block for the eCryptfs file
|
||||
* @mapping: The eCryptfs object
|
||||
* @pos: The file position
|
||||
* @len: The length of the data (unused)
|
||||
|
|
@ -437,7 +437,7 @@ int ecryptfs_write_inode_size_to_metadata(struct inode *ecryptfs_inode)
|
|||
* @folio: The eCryptfs folio
|
||||
* @fsdata: The fsdata (unused)
|
||||
*/
|
||||
static int ecryptfs_write_end(struct file *file,
|
||||
static int ecryptfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
|
|
|
|||
|
|
@ -532,11 +532,10 @@ int exfat_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
|
|||
return blkdev_issue_flush(inode->i_sb->s_bdev);
|
||||
}
|
||||
|
||||
static int exfat_extend_valid_size(struct file *file, loff_t new_valid_size)
|
||||
static int exfat_extend_valid_size(struct inode *inode, loff_t new_valid_size)
|
||||
{
|
||||
int err;
|
||||
loff_t pos;
|
||||
struct inode *inode = file_inode(file);
|
||||
struct exfat_inode_info *ei = EXFAT_I(inode);
|
||||
struct address_space *mapping = inode->i_mapping;
|
||||
const struct address_space_operations *ops = mapping->a_ops;
|
||||
|
|
@ -551,14 +550,14 @@ static int exfat_extend_valid_size(struct file *file, loff_t new_valid_size)
|
|||
if (pos + len > new_valid_size)
|
||||
len = new_valid_size - pos;
|
||||
|
||||
err = ops->write_begin(file, mapping, pos, len, &folio, NULL);
|
||||
err = ops->write_begin(NULL, mapping, pos, len, &folio, NULL);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
off = offset_in_folio(folio, pos);
|
||||
folio_zero_new_buffers(folio, off, off + len);
|
||||
|
||||
err = ops->write_end(file, mapping, pos, len, len, folio, NULL);
|
||||
err = ops->write_end(NULL, mapping, pos, len, len, folio, NULL);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
pos += len;
|
||||
|
|
@ -604,7 +603,7 @@ static ssize_t exfat_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
|
|||
}
|
||||
|
||||
if (pos > valid_size) {
|
||||
ret = exfat_extend_valid_size(file, pos);
|
||||
ret = exfat_extend_valid_size(inode, pos);
|
||||
if (ret < 0 && ret != -ENOSPC) {
|
||||
exfat_err(inode->i_sb,
|
||||
"write: fail to zero from %llu to %llu(%zd)",
|
||||
|
|
@ -665,7 +664,7 @@ static vm_fault_t exfat_page_mkwrite(struct vm_fault *vmf)
|
|||
start + vma->vm_end - vma->vm_start);
|
||||
|
||||
if (ei->valid_size < end) {
|
||||
err = exfat_extend_valid_size(file, end);
|
||||
err = exfat_extend_valid_size(inode, end);
|
||||
if (err < 0) {
|
||||
inode_unlock(inode);
|
||||
return vmf_fs_error(err);
|
||||
|
|
|
|||
|
|
@ -446,9 +446,10 @@ static void exfat_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int exfat_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned int len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int exfat_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned int len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -463,15 +464,16 @@ static int exfat_write_begin(struct file *file, struct address_space *mapping,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int exfat_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned int len, unsigned int copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int exfat_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned int len, unsigned int copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct exfat_inode_info *ei = EXFAT_I(inode);
|
||||
int err;
|
||||
|
||||
err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
err = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
if (err < len)
|
||||
exfat_write_failed(mapping, pos+len);
|
||||
|
||||
|
|
|
|||
|
|
@ -915,7 +915,7 @@ static void ext2_readahead(struct readahead_control *rac)
|
|||
}
|
||||
|
||||
static int
|
||||
ext2_write_begin(struct file *file, struct address_space *mapping,
|
||||
ext2_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
|
@ -926,13 +926,14 @@ ext2_write_begin(struct file *file, struct address_space *mapping,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ext2_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int ext2_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
if (ret < len)
|
||||
ext2_write_failed(mapping, pos + len);
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -1252,7 +1252,8 @@ int ext4_block_write_begin(handle_t *handle, struct folio *folio,
|
|||
* and the ext4_write_end(). So doing the jbd2_journal_start at the start of
|
||||
* ext4_write_begin() is the right place.
|
||||
*/
|
||||
static int ext4_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int ext4_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -1400,12 +1401,12 @@ static int write_end_fn(handle_t *handle, struct inode *inode,
|
|||
|
||||
/*
|
||||
* We need to pick up the new inode size which generic_commit_write gave us
|
||||
* `file' can be NULL - eg, when called from page_symlink().
|
||||
* `iocb` can be NULL - eg, when called from page_symlink().
|
||||
*
|
||||
* ext4 never places buffers on inode->i_mapping->i_private_list. metadata
|
||||
* buffers are managed internally.
|
||||
*/
|
||||
static int ext4_write_end(struct file *file,
|
||||
static int ext4_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
|
|
@ -1510,7 +1511,7 @@ static void ext4_journalled_zero_new_buffers(handle_t *handle,
|
|||
} while (bh != head);
|
||||
}
|
||||
|
||||
static int ext4_journalled_write_end(struct file *file,
|
||||
static int ext4_journalled_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
|
|
@ -3036,7 +3037,8 @@ static int ext4_nonda_switch(struct super_block *sb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int ext4_da_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -3054,7 +3056,7 @@ static int ext4_da_write_begin(struct file *file, struct address_space *mapping,
|
|||
|
||||
if (ext4_nonda_switch(inode->i_sb) || ext4_verity_in_progress(inode)) {
|
||||
*fsdata = (void *)FALL_BACK_TO_NONDELALLOC;
|
||||
return ext4_write_begin(file, mapping, pos,
|
||||
return ext4_write_begin(iocb, mapping, pos,
|
||||
len, foliop, fsdata);
|
||||
}
|
||||
*fsdata = (void *)0;
|
||||
|
|
@ -3195,7 +3197,7 @@ static int ext4_da_do_write_end(struct address_space *mapping,
|
|||
return copied;
|
||||
}
|
||||
|
||||
static int ext4_da_write_end(struct file *file,
|
||||
static int ext4_da_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
|
|
@ -3204,7 +3206,7 @@ static int ext4_da_write_end(struct file *file,
|
|||
int write_mode = (int)(unsigned long)fsdata;
|
||||
|
||||
if (write_mode == FALL_BACK_TO_NONDELALLOC)
|
||||
return ext4_write_end(file, mapping, pos,
|
||||
return ext4_write_end(iocb, mapping, pos,
|
||||
len, copied, folio, fsdata);
|
||||
|
||||
trace_ext4_da_write_end(inode, pos, len, copied);
|
||||
|
|
|
|||
|
|
@ -3519,8 +3519,10 @@ reserve_block:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int f2fs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
|
||||
static int f2fs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop,
|
||||
void **fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct f2fs_sb_info *sbi = F2FS_I_SB(inode);
|
||||
|
|
@ -3656,7 +3658,7 @@ fail:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int f2fs_write_end(struct file *file,
|
||||
static int f2fs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
|
|
|
|||
|
|
@ -219,13 +219,14 @@ static void fat_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int fat_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int fat_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = cont_write_begin(file, mapping, pos, len,
|
||||
err = cont_write_begin(iocb, mapping, pos, len,
|
||||
foliop, fsdata, fat_get_block,
|
||||
&MSDOS_I(mapping->host)->mmu_private);
|
||||
if (err < 0)
|
||||
|
|
@ -233,13 +234,14 @@ static int fat_write_begin(struct file *file, struct address_space *mapping,
|
|||
return err;
|
||||
}
|
||||
|
||||
static int fat_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int fat_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
int err;
|
||||
err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
err = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
if (err < len)
|
||||
fat_write_failed(mapping, pos + len);
|
||||
if (!(err < 0) && !(MSDOS_I(inode)->i_attrs & ATTR_ARCH)) {
|
||||
|
|
|
|||
|
|
@ -2213,10 +2213,13 @@ out:
|
|||
* It's worthy to make sure that space is reserved on disk for the write,
|
||||
* but how to implement it without killing performance need more thinking.
|
||||
*/
|
||||
static int fuse_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
|
||||
static int fuse_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop,
|
||||
void **fsdata)
|
||||
{
|
||||
pgoff_t index = pos >> PAGE_SHIFT;
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct fuse_conn *fc = get_fuse_conn(file_inode(file));
|
||||
struct folio *folio;
|
||||
loff_t fsize;
|
||||
|
|
@ -2256,9 +2259,10 @@ error:
|
|||
return err;
|
||||
}
|
||||
|
||||
static int fuse_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int fuse_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = folio->mapping->host;
|
||||
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ extern int hfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
|
|||
extern const struct address_space_operations hfs_aops;
|
||||
extern const struct address_space_operations hfs_btree_aops;
|
||||
|
||||
int hfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
int hfs_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata);
|
||||
extern struct inode *hfs_new_inode(struct inode *, const struct qstr *, umode_t);
|
||||
extern void hfs_inode_write_fork(struct inode *, struct hfs_extent *, __be32 *, __be32 *);
|
||||
|
|
|
|||
|
|
@ -44,12 +44,12 @@ static void hfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
int hfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
int hfs_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
|
||||
ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata,
|
||||
hfs_get_block,
|
||||
&HFS_I(mapping->host)->phys_size);
|
||||
if (unlikely(ret))
|
||||
|
|
|
|||
|
|
@ -473,8 +473,10 @@ extern const struct address_space_operations hfsplus_aops;
|
|||
extern const struct address_space_operations hfsplus_btree_aops;
|
||||
extern const struct dentry_operations hfsplus_dentry_operations;
|
||||
|
||||
int hfsplus_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata);
|
||||
int hfsplus_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop,
|
||||
void **fsdata);
|
||||
struct inode *hfsplus_new_inode(struct super_block *sb, struct inode *dir,
|
||||
umode_t mode);
|
||||
void hfsplus_delete_inode(struct inode *inode);
|
||||
|
|
|
|||
|
|
@ -38,12 +38,14 @@ static void hfsplus_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
int hfsplus_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop, void **fsdata)
|
||||
int hfsplus_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
unsigned len, struct folio **foliop,
|
||||
void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
|
||||
ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata,
|
||||
hfsplus_get_block,
|
||||
&HFSPLUS_I(mapping->host)->phys_size);
|
||||
if (unlikely(ret))
|
||||
|
|
|
|||
|
|
@ -445,7 +445,8 @@ static int hostfs_read_folio(struct file *file, struct folio *folio)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hostfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int hostfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -458,7 +459,8 @@ static int hostfs_write_begin(struct file *file, struct address_space *mapping,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int hostfs_write_end(struct file *file, struct address_space *mapping,
|
||||
static int hostfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
|
|
@ -468,7 +470,7 @@ static int hostfs_write_end(struct file *file, struct address_space *mapping,
|
|||
int err;
|
||||
|
||||
buffer = kmap_local_folio(folio, from);
|
||||
err = write_file(FILE_HOSTFS_I(file)->fd, &pos, buffer, copied);
|
||||
err = write_file(FILE_HOSTFS_I(iocb->ki_filp)->fd, &pos, buffer, copied);
|
||||
kunmap_local(buffer);
|
||||
|
||||
if (!folio_test_uptodate(folio) && err == folio_size(folio))
|
||||
|
|
|
|||
|
|
@ -188,13 +188,14 @@ static void hpfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
hpfs_unlock(inode->i_sb);
|
||||
}
|
||||
|
||||
static int hpfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int hpfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = cont_write_begin(file, mapping, pos, len, foliop, fsdata,
|
||||
ret = cont_write_begin(iocb, mapping, pos, len, foliop, fsdata,
|
||||
hpfs_get_block,
|
||||
&hpfs_i(mapping->host)->mmu_private);
|
||||
if (unlikely(ret))
|
||||
|
|
@ -203,13 +204,14 @@ static int hpfs_write_begin(struct file *file, struct address_space *mapping,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hpfs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int hpfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
int err;
|
||||
err = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
err = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
if (err < len)
|
||||
hpfs_write_failed(mapping, pos + len);
|
||||
if (!(err < 0)) {
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ static ssize_t hugetlbfs_read_iter(struct kiocb *iocb, struct iov_iter *to)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int hugetlbfs_write_begin(struct file *file,
|
||||
static int hugetlbfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
|
|
@ -319,9 +319,10 @@ static int hugetlbfs_write_begin(struct file *file,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int hugetlbfs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int hugetlbfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
BUG();
|
||||
return -EINVAL;
|
||||
|
|
|
|||
|
|
@ -21,12 +21,14 @@
|
|||
#include <linux/jffs2.h>
|
||||
#include "nodelist.h"
|
||||
|
||||
static int jffs2_write_end(struct file *filp, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata);
|
||||
static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata);
|
||||
static int jffs2_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata);
|
||||
static int jffs2_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata);
|
||||
static int jffs2_read_folio(struct file *filp, struct folio *folio);
|
||||
|
||||
int jffs2_fsync(struct file *filp, loff_t start, loff_t end, int datasync)
|
||||
|
|
@ -121,9 +123,10 @@ static int jffs2_read_folio(struct file *file, struct folio *folio)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int jffs2_write_begin(struct file *filp, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int jffs2_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
struct folio *folio;
|
||||
struct inode *inode = mapping->host;
|
||||
|
|
@ -235,9 +238,10 @@ out_err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int jffs2_write_end(struct file *filp, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int jffs2_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
/* Actually commit the write from the page cache page we're looking at.
|
||||
* For now, we write the full page out each time. It sucks, but it's simple
|
||||
|
|
|
|||
|
|
@ -290,9 +290,10 @@ static void jfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int jfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int jfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -303,13 +304,14 @@ static int jfs_write_begin(struct file *file, struct address_space *mapping,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int jfs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied, struct folio *folio,
|
||||
void *fsdata)
|
||||
static int jfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
if (ret < len)
|
||||
jfs_write_failed(mapping, pos + len);
|
||||
return ret;
|
||||
|
|
|
|||
11
fs/libfs.c
11
fs/libfs.c
|
|
@ -910,7 +910,7 @@ static int simple_read_folio(struct file *file, struct folio *folio)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int simple_write_begin(struct file *file, struct address_space *mapping,
|
||||
int simple_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -935,7 +935,7 @@ EXPORT_SYMBOL(simple_write_begin);
|
|||
|
||||
/**
|
||||
* simple_write_end - .write_end helper for non-block-device FSes
|
||||
* @file: See .write_end of address_space_operations
|
||||
* @iocb: kernel I/O control block
|
||||
* @mapping: "
|
||||
* @pos: "
|
||||
* @len: "
|
||||
|
|
@ -956,9 +956,10 @@ EXPORT_SYMBOL(simple_write_begin);
|
|||
*
|
||||
* Use *ONLY* with simple_read_folio()
|
||||
*/
|
||||
static int simple_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int simple_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = folio->mapping->host;
|
||||
loff_t last_pos = pos + copied;
|
||||
|
|
|
|||
|
|
@ -442,9 +442,10 @@ static void minix_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int minix_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int minix_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -342,12 +342,14 @@ static bool nfs_want_read_modify_write(struct file *file, struct folio *folio,
|
|||
* If the writer ends up delaying the write, the writer needs to
|
||||
* increment the page use counts until he is done with the page.
|
||||
*/
|
||||
static int nfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int nfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, struct folio **foliop,
|
||||
void **fsdata)
|
||||
{
|
||||
fgf_t fgp = FGP_WRITEBEGIN;
|
||||
struct folio *folio;
|
||||
struct file *file = iocb->ki_filp;
|
||||
int once_thru = 0;
|
||||
int ret;
|
||||
|
||||
|
|
@ -377,10 +379,12 @@ start:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int nfs_write_end(struct file *file, struct address_space *mapping,
|
||||
static int nfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct nfs_open_context *ctx = nfs_file_open_context(file);
|
||||
unsigned offset = offset_in_folio(folio, pos);
|
||||
int status;
|
||||
|
|
|
|||
|
|
@ -218,7 +218,8 @@ void nilfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int nilfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int nilfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
|
||||
|
|
@ -237,7 +238,8 @@ static int nilfs_write_begin(struct file *file, struct address_space *mapping,
|
|||
return err;
|
||||
}
|
||||
|
||||
static int nilfs_write_end(struct file *file, struct address_space *mapping,
|
||||
static int nilfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
|
|
@ -248,7 +250,7 @@ static int nilfs_write_end(struct file *file, struct address_space *mapping,
|
|||
|
||||
nr_dirty = nilfs_page_count_clean_buffers(folio, start,
|
||||
start + copied);
|
||||
copied = generic_write_end(file, mapping, pos, len, copied, folio,
|
||||
copied = generic_write_end(iocb, mapping, pos, len, copied, folio,
|
||||
fsdata);
|
||||
nilfs_set_file_dirty(inode, nr_dirty);
|
||||
err = nilfs_transaction_commit(inode->i_sb);
|
||||
|
|
|
|||
|
|
@ -154,13 +154,13 @@ static int ntfs_extend_initialized_size(struct file *file,
|
|||
if (pos + len > new_valid)
|
||||
len = new_valid - pos;
|
||||
|
||||
err = ntfs_write_begin(file, mapping, pos, len, &folio, NULL);
|
||||
err = ntfs_write_begin(NULL, mapping, pos, len, &folio, NULL);
|
||||
if (err)
|
||||
goto out;
|
||||
|
||||
folio_zero_range(folio, zerofrom, folio_size(folio) - zerofrom);
|
||||
|
||||
err = ntfs_write_end(file, mapping, pos, len, len, folio, NULL);
|
||||
err = ntfs_write_end(NULL, mapping, pos, len, len, folio, NULL);
|
||||
if (err < 0)
|
||||
goto out;
|
||||
pos += len;
|
||||
|
|
|
|||
|
|
@ -912,7 +912,7 @@ static int ntfs_get_block_write_begin(struct inode *inode, sector_t vbn,
|
|||
bh_result, create, GET_BLOCK_WRITE_BEGIN);
|
||||
}
|
||||
|
||||
int ntfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
int ntfs_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, u32 len, struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int err;
|
||||
|
|
@ -957,7 +957,8 @@ out:
|
|||
/*
|
||||
* ntfs_write_end - Address_space_operations::write_end.
|
||||
*/
|
||||
int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
|
||||
int ntfs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
u32 len, u32 copied, struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
|
|
@ -989,7 +990,7 @@ int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
|
|||
folio_unlock(folio);
|
||||
folio_put(folio);
|
||||
} else {
|
||||
err = generic_write_end(file, mapping, pos, len, copied, folio,
|
||||
err = generic_write_end(iocb, mapping, pos, len, copied, folio,
|
||||
fsdata);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -702,10 +702,12 @@ struct inode *ntfs_iget5(struct super_block *sb, const struct MFT_REF *ref,
|
|||
int ntfs_set_size(struct inode *inode, u64 new_size);
|
||||
int ntfs_get_block(struct inode *inode, sector_t vbn,
|
||||
struct buffer_head *bh_result, int create);
|
||||
int ntfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, u32 len, struct folio **foliop, void **fsdata);
|
||||
int ntfs_write_end(struct file *file, struct address_space *mapping, loff_t pos,
|
||||
u32 len, u32 copied, struct folio *folio, void *fsdata);
|
||||
int ntfs_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, u32 len, struct folio **foliop,
|
||||
void **fsdata);
|
||||
int ntfs_write_end(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, u32 len, u32 copied, struct folio *folio,
|
||||
void *fsdata);
|
||||
int ntfs3_write_inode(struct inode *inode, struct writeback_control *wbc);
|
||||
int ntfs_sync_inode(struct inode *inode);
|
||||
int inode_read_data(struct inode *inode, void *data, size_t bytes);
|
||||
|
|
|
|||
|
|
@ -1856,7 +1856,8 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ocfs2_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int ocfs2_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -2047,7 +2048,8 @@ out:
|
|||
return copied;
|
||||
}
|
||||
|
||||
static int ocfs2_write_end(struct file *file, struct address_space *mapping,
|
||||
static int ocfs2_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -310,9 +310,10 @@ static void omfs_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int omfs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int omfs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
|
|||
|
|
@ -285,9 +285,10 @@ static int orangefs_read_folio(struct file *file, struct folio *folio)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int orangefs_write_begin(struct file *file,
|
||||
struct address_space *mapping, loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int orangefs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
unsigned len, struct folio **foliop,
|
||||
void **fsdata)
|
||||
{
|
||||
struct orangefs_write_range *wr;
|
||||
struct folio *folio;
|
||||
|
|
@ -340,9 +341,10 @@ okay:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int orangefs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied, struct folio *folio,
|
||||
void *fsdata)
|
||||
static int orangefs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = folio->mapping->host;
|
||||
loff_t last_pos = pos + copied;
|
||||
|
|
@ -372,7 +374,7 @@ static int orangefs_write_end(struct file *file, struct address_space *mapping,
|
|||
folio_unlock(folio);
|
||||
folio_put(folio);
|
||||
|
||||
mark_inode_dirty_sync(file_inode(file));
|
||||
mark_inode_dirty_sync(file_inode(iocb->ki_filp));
|
||||
return copied;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -404,7 +404,8 @@ static int allocate_budget(struct ubifs_info *c, struct folio *folio,
|
|||
* there is a plenty of flash space and the budget will be acquired quickly,
|
||||
* without forcing write-back. The slow path does not make this assumption.
|
||||
*/
|
||||
static int ubifs_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int ubifs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
|
|
@ -514,8 +515,9 @@ static void cancel_budget(struct ubifs_info *c, struct folio *folio,
|
|||
}
|
||||
}
|
||||
|
||||
static int ubifs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
static int ubifs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping, loff_t pos,
|
||||
unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
|
|
|
|||
|
|
@ -244,10 +244,12 @@ static void udf_readahead(struct readahead_control *rac)
|
|||
mpage_readahead(rac, udf_get_block);
|
||||
}
|
||||
|
||||
static int udf_write_begin(struct file *file, struct address_space *mapping,
|
||||
static int udf_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
struct file *file = iocb->ki_filp;
|
||||
struct udf_inode_info *iinfo = UDF_I(file_inode(file));
|
||||
struct folio *folio;
|
||||
int ret;
|
||||
|
|
@ -271,15 +273,16 @@ static int udf_write_begin(struct file *file, struct address_space *mapping,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int udf_write_end(struct file *file, struct address_space *mapping,
|
||||
static int udf_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = file_inode(file);
|
||||
struct inode *inode = file_inode(iocb->ki_filp);
|
||||
loff_t last_pos;
|
||||
|
||||
if (UDF_I(inode)->i_alloc_type != ICBTAG_FLAG_AD_IN_ICB)
|
||||
return generic_write_end(file, mapping, pos, len, copied, folio,
|
||||
return generic_write_end(iocb, mapping, pos, len, copied, folio,
|
||||
fsdata);
|
||||
last_pos = pos + copied;
|
||||
if (last_pos > inode->i_size)
|
||||
|
|
|
|||
|
|
@ -474,9 +474,10 @@ static void ufs_write_failed(struct address_space *mapping, loff_t to)
|
|||
}
|
||||
}
|
||||
|
||||
static int ufs_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
static int ufs_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
|
@ -487,13 +488,14 @@ static int ufs_write_begin(struct file *file, struct address_space *mapping,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ufs_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
static int ufs_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = generic_write_end(file, mapping, pos, len, copied, folio, fsdata);
|
||||
ret = generic_write_end(iocb, mapping, pos, len, copied, folio, fsdata);
|
||||
if (ret < len)
|
||||
ufs_write_failed(mapping, pos + len);
|
||||
return ret;
|
||||
|
|
|
|||
|
|
@ -300,12 +300,13 @@ static int vboxsf_writepages(struct address_space *mapping,
|
|||
return error;
|
||||
}
|
||||
|
||||
static int vboxsf_write_end(struct file *file, struct address_space *mapping,
|
||||
static int vboxsf_write_end(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned int len, unsigned int copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct vboxsf_handle *sf_handle = file->private_data;
|
||||
struct vboxsf_handle *sf_handle = iocb->ki_filp->private_data;
|
||||
size_t from = offset_in_folio(folio, pos);
|
||||
u32 nwritten = len;
|
||||
u8 *buf;
|
||||
|
|
|
|||
|
|
@ -263,11 +263,11 @@ int block_write_begin(struct address_space *mapping, loff_t pos, unsigned len,
|
|||
int __block_write_begin(struct folio *folio, loff_t pos, unsigned len,
|
||||
get_block_t *get_block);
|
||||
int block_write_end(loff_t pos, unsigned len, unsigned copied, struct folio *);
|
||||
int generic_write_end(struct file *, struct address_space *,
|
||||
int generic_write_end(const struct kiocb *, struct address_space *,
|
||||
loff_t, unsigned len, unsigned copied,
|
||||
struct folio *, void *);
|
||||
void folio_zero_new_buffers(struct folio *folio, size_t from, size_t to);
|
||||
int cont_write_begin(struct file *, struct address_space *, loff_t,
|
||||
int cont_write_begin(const struct kiocb *, struct address_space *, loff_t,
|
||||
unsigned, struct folio **, void **,
|
||||
get_block_t *, loff_t *);
|
||||
int generic_cont_expand_simple(struct inode *inode, loff_t size);
|
||||
|
|
|
|||
|
|
@ -444,10 +444,10 @@ struct address_space_operations {
|
|||
|
||||
void (*readahead)(struct readahead_control *);
|
||||
|
||||
int (*write_begin)(struct file *, struct address_space *mapping,
|
||||
int (*write_begin)(const struct kiocb *, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata);
|
||||
int (*write_end)(struct file *, struct address_space *mapping,
|
||||
int (*write_end)(const struct kiocb *, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata);
|
||||
|
||||
|
|
@ -3598,9 +3598,10 @@ extern void simple_recursive_removal(struct dentry *,
|
|||
extern int noop_fsync(struct file *, loff_t, loff_t, int);
|
||||
extern ssize_t noop_direct_IO(struct kiocb *iocb, struct iov_iter *iter);
|
||||
extern int simple_empty(struct dentry *);
|
||||
extern int simple_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata);
|
||||
extern int simple_write_begin(const struct kiocb *iocb,
|
||||
struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata);
|
||||
extern const struct address_space_operations ram_aops;
|
||||
extern int always_delete_dentry(const struct dentry *);
|
||||
extern struct inode *alloc_anon_inode(struct super_block *);
|
||||
|
|
|
|||
|
|
@ -4109,7 +4109,7 @@ retry:
|
|||
break;
|
||||
}
|
||||
|
||||
status = a_ops->write_begin(file, mapping, pos, bytes,
|
||||
status = a_ops->write_begin(iocb, mapping, pos, bytes,
|
||||
&folio, &fsdata);
|
||||
if (unlikely(status < 0))
|
||||
break;
|
||||
|
|
@ -4130,7 +4130,7 @@ retry:
|
|||
copied = copy_folio_from_iter_atomic(folio, offset, bytes, i);
|
||||
flush_dcache_folio(folio);
|
||||
|
||||
status = a_ops->write_end(file, mapping, pos, bytes, copied,
|
||||
status = a_ops->write_end(iocb, mapping, pos, bytes, copied,
|
||||
folio, fsdata);
|
||||
if (unlikely(status != copied)) {
|
||||
iov_iter_revert(i, copied - max(status, 0L));
|
||||
|
|
|
|||
12
mm/shmem.c
12
mm/shmem.c
|
|
@ -3266,9 +3266,9 @@ static const struct inode_operations shmem_symlink_inode_operations;
|
|||
static const struct inode_operations shmem_short_symlink_operations;
|
||||
|
||||
static int
|
||||
shmem_write_begin(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
shmem_write_begin(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len,
|
||||
struct folio **foliop, void **fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
struct shmem_inode_info *info = SHMEM_I(inode);
|
||||
|
|
@ -3300,9 +3300,9 @@ shmem_write_begin(struct file *file, struct address_space *mapping,
|
|||
}
|
||||
|
||||
static int
|
||||
shmem_write_end(struct file *file, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
shmem_write_end(const struct kiocb *iocb, struct address_space *mapping,
|
||||
loff_t pos, unsigned len, unsigned copied,
|
||||
struct folio *folio, void *fsdata)
|
||||
{
|
||||
struct inode *inode = mapping->host;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue